#include #include #include #include #define PLUGIN "AWP Limit" #define VERSION "1.0" #define AUTHOR "EFFEX" // flag t padrão #define isVip(%1) (get_user_flags(%1) & ADMIN_LEVEL_H) enum cCount { cVips, cPlayers } new g_iAwpCount[cCount][3] new pCvarMaxVipsAwp new pCvarMaxPlayersAwp public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("HLTV", "event_NewRound", "a", "1=0", "2=0") register_logevent("event_NewRound", 2, "1=Round_Start") RegisterHam(Ham_AddPlayerItem, "player", "ham_AddPlayerItem_Post", 1) pCvarMaxVipsAwp = register_cvar("max_vip_awp", "2") pCvarMaxPlayersAwp = register_cvar("max_player_awp", "2") } public event_NewRound() { g_iAwpCount[cVips][1] = 0 g_iAwpCount[cVips][2] = 0 g_iAwpCount[cPlayers][1] = 0 g_iAwpCount[cPlayers][2] = 0 } public ham_AddPlayerItem_Post(id, iItem) { static szClassName[MAX_PLAYERS] pev(iItem, pev_classname, szClassName, charsmax(szClassName)) if(equal(szClassName, "weapon_", 7) && (cs_get_weapon_id(iItem) == CSW_AWP)) { g_iAwpCount[isVip(id) ? cVips : cPlayers][get_user_team(id)]++ } } public CS_OnBuy(id, iItem) { if(iItem == CSW_AWP) { if(g_iAwpCount[isVip(id) ? cVips : cPlayers][get_user_team(id)] >= get_pcvar_num(isVip(id) ? pCvarMaxVipsAwp : pCvarMaxPlayersAwp)) { client_print_color(id, id, "^x04[AMXX]^x01: Limite de AWP por time atingido, aguarde um novo round.") return PLUGIN_HANDLED } } return PLUGIN_CONTINUE }