how to check players
#2

"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:

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;
}
Reply


Messages In This Thread
how to check players - by ancezas - 04.11.2013, 03:07
Re: how to check players - by iGetty - 04.11.2013, 03:26
Re: how to check players - by ancezas - 04.11.2013, 03:27
Re: how to check players - by DeStunter - 04.11.2013, 03:31
Re: how to check players - by Pottus - 04.11.2013, 03:36
Re: how to check players - by iGetty - 04.11.2013, 03:46
Re: how to check players - by Pottus - 04.11.2013, 03:51
Re: how to check players - by iGetty - 04.11.2013, 04:02

Forum Jump:


Users browsing this thread: 1 Guest(s)