04.11.2013, 03:26
"It depends how many players you'll have on the server.. If very few it might be preferable to use OnPlayerUpdate.. because using a timer with a loop within it would be inefficient.
However if you had a server that was near capacity (198/200) You would want to stay well clear of OnPlayerUpdate, as it would be being called hundreds of times a second.. Every time a player changed their weapon, or moved, or did anything it would be called.."
To make it into a timer, do this:
However if you had a server that was near capacity (198/200) You would want to stay well clear of OnPlayerUpdate, as it would be being called hundreds of times a second.. Every time a player changed their weapon, or moved, or did anything it would be called.."
To make it into a timer, do this:
pawn Код:
SetTimer("AntiCheatTimer", 5000, true); //add to OnGameModeInit
forward AntiCheatTimer();
public AntiCheatTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerWeapon(i) == 38) //minigun
{
Ban(i);
}
}
}
return 1;
}

