08.01.2013, 22:12
how to make that is spamming 'Crouch' button kick player !?
new CrouchCount[MAX_PLAYERS];
forward ResetCrouchCount(playerid);
public ResetCrouchCount(playerid)
{
CrouchCount[playerid] = 0;
}
public OnPlayerConnect(playerid)
{
CrouchCount[playerid] = 0; // I don't think this is needed, but I put it anyways
SetTimerEx("ResetCrouchCount", 5000, true, "i", playerid);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
{
CrouchCount[playerid] ++;
if(CrouchCount[playerid] > 5) return Kick(playerid);
}
return 1;
}