Aby plugin działal poprawnie musisz włączyć restmenu.amxx oraz wpisać ten plugin pod nim.
#include <amxmodx> #include <hamsandwich> #pragma semicolon 1 enum _:eInfoPlugin { PLUGIN, VERSION, AUTHOR, URL, DESCRIPTION }; new const PLUGIN_INFO[eInfoPlugin][] = { "Block AWP", "1.0", "KoRrNiK", "https://github.com/KoRrNiK/", "The plugin blocks the use of AWP" }; #define OFFSET_ITEM_LINUX 4 #define OFFSET_PLAYER 41 #define NEEDED_PLAYERS 5 public plugin_init() { register_plugin( .plugin_name = PLUGIN_INFO[PLUGIN], .version = PLUGIN_INFO[VERSION], .author = PLUGIN_INFO[AUTHOR], .url = PLUGIN_INFO[URL], .description = PLUGIN_INFO[DESCRIPTION] ); RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "ham_PrimaryAttack"); RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_awp", "ham_SecondaryAttack"); __b(); } public client_putinserver(id) set_task(1.0, "__b"); public client_disconnect(id) set_task(1.0, "__b"); public __b(){ chcecBlock(true); } static chcecBlock(bool:block = true){ new players = numPlayers(); new bool:check = !!(players >= NEEDED_PLAYERS); if(block) server_cmd("amx_restrict %s awp", check ? "off" : "on"); return check; } public ham_PrimaryAttack(const entity){ if(chcecBlock(false)) return HAM_IGNORED; static owner; owner = get_pdata_cbase(entity, OFFSET_PLAYER, OFFSET_ITEM_LINUX); changeWeapon(owner); return HAM_SUPERCEDE; } public ham_SecondaryAttack(const entity){ if(chcecBlock(false)) return HAM_IGNORED; static owner; owner = get_pdata_cbase(entity, OFFSET_PLAYER, OFFSET_ITEM_LINUX); changeWeapon(owner); return HAM_SUPERCEDE; } public changeWeapon(index){ if(!is_user_alive(index)) return HAM_IGNORED; engclient_cmd(index, "weapon_knife"); client_print(index, print_center, "AWP ZABLOKOWANE DO CZASU AZ NIE BEDZIE %d GRACZY", NEEDED_PLAYERS); return HAM_SUPERCEDE; } public numPlayers(){ new iNum=0; for(new i=1; i < 33; i++){ if(!is_user_connected(i) || is_user_hltv(i)) continue; iNum++; } return iNum; }