ya, I saw that possiblity, but didn't look through for the disconnect code to see if it got reset... just used the online compiler to make sure it would compile before I posted.
Here's the code suggested by thetwistedpanda so a new player doesn't glitch the plugin and get knives when they're not allowed to:
PHP Code:
public EventPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast) {
if (GetConVarBool(g_CVarEnable)) {
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (GetClientTeam(client) == 2 && CheckCommandAccess(client, "allow_throwing_knives", ADMFLAG_CUSTOM1))
{
g_iKnives[client] = GetConVarInt(g_CVarKnives);
}
else
{
g_iKnives[client] = 0;
}
}
}
__________________