Give Ammo Pack Plugin by Beware

Модератор: АМХX Скриптъри

Отговори
Потребителски аватар

АВТОР НА ТЕМАТА
Beware
AMXX Скриптър
AMXX Скриптър
Мнения: 9
Регистриран: 17 окт 2018, 23:36
Ник в CS: AwakeDx

22 окт 2018, 22:06

Версия: 2.0
Автор: Beware // Аз


Описание: Прост плъгин с който админите могат да дават Ammo Pack, на играчите в сървъра и извън сървъра по ID!

Команда
amx_ap

Source Code:

Код: Избери всички

/*****************************************************
* [ZP]Extended Give Ammo 2.0                         *
* Copyright 2018 Beware	     *
* 						     *
******************************************************
*						     *
* http://cs-nation.info                                 *
* ibkotm@gmail.com                           *
* Skype v1rgo55                            *                                *
*                                                    *
******************************************************
*						     *
* Usage:                                             *
*						     *
* amx_ap - open ammo packs menu		     *
*						     *					     *
*****************************************************/



#include <amxmisc>
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extended Give Ammo"
#define VERSION "2.0"
#define AUTHOR "AwakeDx"

new g_msgSayText, cur_add_amount = 10;

public plugin_init() {

	register_cvar("amx_ap", VERSION, FCVAR_SERVER|FCVAR_SPONLY);

	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_concmd("amx_ap", "menu_init",ADMIN_LEVEL_A, "");
	
	register_dictionary("amx_give_ap.txt");
	
	g_msgSayText = get_user_msgid("SayText");
}

public give_ammo_e (id, ammo){
	
	new user_ammo = zp_get_user_ammo_packs(id) + ammo;
	
	zp_set_user_ammo_packs ( id, max ( 1, user_ammo) );
	
	return PLUGIN_HANDLED;
}

public amx_ammo_e_self(id, level, cid){
if ( !cmd_access ( id, level, cid, 2 ) )
    {
        return PLUGIN_HANDLED;
    }

new amount[5];

read_argv ( 1, amount, charsmax(amount));

give_ammo_e( id, str_to_num(amount));

return PLUGIN_HANDLED;
}

public menu_init(id){
	new MenuName[64]
	format(MenuName, 63, "\r%L", id, "AM")
	
	new menu = menu_create(MenuName, "menu_handler");
	
	new players[32], inum, tempid;

	get_players(players, inum);

	new nomer[10], name[32];
 
	switch(cur_add_amount){
	
		case 10:
		{
			menu_additem(menu, "\w10 ammo", "33", 0);
		}

		case 100:
		{
			menu_additem(menu, "\w100 ammo", "34", 0);
		}

		case 1000:
		{
			menu_additem(menu, "\w1000 ammo", "35", 0);
		}
	
	}

	menu_additem(menu, "", "36", 0);
	
	for ( new i; i<inum; i++)
	{		
		tempid = players[i];
		get_user_name(tempid, name, 31);
		num_to_str(tempid, nomer, 9);
		menu_additem(menu, name, nomer, ADMIN_LEVEL_A);
	}

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	
	menu_display(id, menu, 0);
}

public menu_handler(id, menu, item){
if ( item == MENU_EXIT )
{
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
	
new data[6], iName[64];
new access, callback;

menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback);

new tempid = str_to_num(data);

switch(tempid){
	case 33:
		{
			cur_add_amount = 100;
			client_printcolor(id, "/g[AP] /y%L /t%i /y%L", id, "CHANGED", cur_add_amount, id, "AMMO");
			menu_destroy(menu);
			menu_init(id);

		}
	case 34:
		{
			cur_add_amount = 1000;
			client_printcolor(id, "/g[AP] /y%L /t%i /y%L", id, "CHANGED", cur_add_amount, id, "AMMO");
			menu_destroy(menu);
			menu_init(id);

		}
	case 35:
		{
			cur_add_amount = 10;
			client_printcolor(id, "/g[AP] /y%L /t%i /y%L", id, "CHANGED", cur_add_amount, id, "AMMO");
			menu_destroy(menu);
			menu_init(id);
		}
	case 36:
		{
			menu_destroy(menu);
			menu_init(id);

		}
	default:
		{
			if(is_user_connected(tempid)){
			give_ammo_e(tempid, cur_add_amount);
			
			new Nick[32];
			get_user_name(tempid, Nick, 31);
			
			client_printcolor(id, "/g[AP] /t%s /y%L /t%i /t%L!", Nick, id, "WAS_G", cur_add_amount, id, "AMMO")
			} else {
			menu_destroy(menu);
			menu_init(id);
			}
		}
}


return PLUGIN_HANDLED;
}

stock client_printcolor(id, const input[], any:...)
{
    static iPlayersNum[32], iCount; iCount = 1
    static szMsg[191]
    
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    replace_all(szMsg, 190, "/g", "^4") // green txt
    replace_all(szMsg, 190, "/y", "^1") // orange txt
    replace_all(szMsg, 190, "/t", "^3") // team txt
    
    if(id) iPlayersNum[0] = id
    else get_players(iPlayersNum, iCount, "ch")
        
    for (new i = 0; i < iCount; i++)
    {
        if (is_user_connected(iPlayersNum[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayersNum[i])
            write_byte(iPlayersNum[i])
            write_string(szMsg)
            message_end()
        }
    }
}
Не се страхувам от по добрия НЕПОБЕДИМИ НЯМА!!!
Отговори

Върни се в “Плъгини”

  • Информация
  • Кой е на линия

    Потребители, разглеждащи този форум: Няма регистрирани потребители и 1 гост