server crashing with low players
#6

Dont use onplayerupdate, use a timer.
pawn Код:
//OnPlayerSpawn
SetTimer("Check", 1000, true);

//Somewhere in script
forward Check(playerid);
public Check(playerid)
{
  //Max Money
  if(GetPlayerMoney(playerid) == 999999999)
  {
    new pName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[AntiCheat]: %s has been kicked for MAX MONEY.", pName);
    SendClientMessageToAll(orange, string);
    Kick(playerid);
    print(string);
  }

  //Health Hacks
  new Float:health;
  GetPlayerHealth(playerid,health);
 
  if(health > 101)
  {
    if(level[playerid] == 0)
    {
      new pName[MAX_PLAYER_NAME], string[128];
      GetPlayerName(playerid, pName, sizeof(pName));
      format(string, sizeof(string), "[AntiCheat]: %s has been kicked for Health Hacks.", pName);
      SendClientMessageToAll(orange, string);
      Kick(playerid);
      print(string);
    }
  }
  return 1;
}
EDIT: Sorry didnt read above but you should use this instead onplayerupdate because it gets called like 20-30 times per second. (500 - 750 times per second if you have 25 players)
Reply


Messages In This Thread
server crashing with low players - by [SF]RobMob - 21.02.2010, 21:30
Re: server crashing with low players - by [SF]RobMob - 22.02.2010, 02:59
Re: server crashing with low players - by [SF]RobMob - 22.02.2010, 18:09
Re: server crashing with low players - by Onyx09 - 22.02.2010, 18:39
Re: server crashing with low players - by [SF]RobMob - 23.02.2010, 09:51
Re: server crashing with low players - by bajskorv123 - 23.02.2010, 09:58

Forum Jump:


Users browsing this thread: 1 Guest(s)