Участник
Пользователь
- Сообщения
- 486
- Реакции
- 89
- Помог
- 5 раз(а)
И снова, Здравствуйте! Хотел бы уточнить, как отловить меню VGUI и Old Text. Ибо, я так понимаю, что проблема именно там. Щиты покупаются сколько угодно, но если ввести покупку через консоль (shield), то выводит инфо о лимите на покупку. На всякий случай, прикреплю код
Код:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#define SHIELD_LIMIT 1 // Кол-во Щитов на одну команду :)
#define ACCESS_IMMUNITY ADMIN_RCON // Иммунитет к функциям плагина. Для отключения Пропишите ADMIN_ALL
new g_iShieldCount[3];
new bool:g_bUseShield[33];
public plugin_init()
{
new sPref[][] = {"awp_", "aim_", "35hp", "fy_"};
new map[32]; get_mapname(map, charsmax(map));
for(new i; i < sizeof sPref; i++)
{
if(containi(map, sPref[i]) != -1)
{
pause("ad");
return;
}
}
register_menucmd(register_menuid("BuyItem", true), MENU_KEY_8, "HookBuyShield");
register_menucmd(-34, MENU_KEY_8, "HookBuyShield");
register_clcmd("drop", "ClCmdDrop");
register_clcmd("shield", "CmdShield");
RegisterHam(Ham_Touch, "weapon_shield", "HamHookTouchShield", true);
register_event("DeathMsg", "eDeathMsg", "a");
register_logevent("LeRoundStart", 2, "1=Round_Start");
}
public CmdShield(id)
{
#if ACCESS_IMMUNITY != ADMIN_ALL
if(get_user_flags(id) & ACCESS_IMMUNITY)
return PLUGIN_CONTINUE;
#endif
return WeaponsHandler(id, get_user_team(id));
}
public HookBuyShield(id)
{
#if ACCESS_IMMUNITY != ADMIN_ALL
if(get_user_flags(id) & ACCESS_IMMUNITY)
return PLUGIN_CONTINUE;
#endif
return WeaponsHandler(id, team);
}
public WeaponsHandler(id, team)
{
if(g_iShieldCount[team] >= SHIELD_LIMIT)
{
client_print_color(id, print_team_default, "[^4Shield Limit^1] Достигнуто ^3максимальное ^1количество ^4Щитов ^1на команду [^3%d^1/^3%d^1]", g_iShieldCount[team], SHIELD_LIMIT);
set_task(0.1, "DropWeapons", id);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public ClCmdDrop(id)
{
new team = get_user_team(id);
if(g_bUseShield[id])
{
if(g_iShieldCount[team])
g_iShieldCount[team]--;
g_bUseShield[id] = false;
}
}
public HamHookTouchShield(Ent, iClient)
{
static team, sClassName[8]; pev(iClient, pev_classname, sClassName, charsmax(sClassName));
if(equal(sClassName, "player"))
{
team = get_user_team(iClient);
if(!g_bUseShield[iClient])
{
#if ACCESS_IMMUNITY != ADMIN_ALL
if(~get_user_flags(iClient) & ACCESS_IMMUNITY && g_iShieldCount[team] >= SHIELD_LIMIT)
#else
if(g_iShieldCount[team] >= SHIELD_LIMIT)
#endif
WeaponsHandler(iClient, team);
else
{
g_iShieldCount[team]++;
g_bUseShield[iClient] = true;
}
}
else
{
if(g_iShieldCount[team])
g_iShieldCount[team]--;
g_bUseShield[iClient] = false;
}
}
}
public eDeathMsg()
FuncDiscDeath(read_data(2));
public client_disconnected(id)
FuncDiscDeath(id);
FuncDiscDeath(id)
{
if(!g_bUseShield[id]) return;
new team = get_user_team(id);
if(g_iShieldCount[team])
g_iShieldCount[team]--;
g_bUseShield[id] = false;
}
public DropWeapons(id)
engclient_cmd(id, "drop", "weapon_shield");
public LeRoundStart()
{
new players[32], pnum, i;
arrayset(g_iShieldCount, 0, 3);
get_players(players, pnum, "ae", "TERRORIST");
for(i = 0; i < pnum; i++)
{
if(fm_get_user_shield(players[i]))
{
g_iShieldCount[1]++;
g_bUseShield[players[i]] = true;
} else g_bUseShield[players[i]] = false;
}
get_players(players, pnum, "ae", "CT");
for(i = 0; i < pnum; i++)
{
if(fm_get_user_shield(players[i]))
{
g_iShieldCount[2]++;
g_bUseShield[players[i]] = true;
} else g_bUseShield[players[i]] = false;
}
}
stock fm_get_user_shield(id) return get_pdata_int(id, 510) & (1<<24) ? 1 : 0;