server crashing with low players
#1

I am having a problem were when theres 25 or more players on my server uses 3%cpu and no memory but for some reason when theres 10-20 players online CPU Usage: 22.1 % Memory usage:28.33mb Space in use:48 mb and my server crashes any ideas .... the only thing on onplayerupdate is this could it be the problem ..?




public OnPlayerUpdate(playerid)
{
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);
}
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;
}
Reply
#2

if it helps i just stoped my server and waited 5 min and the started and check with no players just there server ??

CPU Usage: 4 %
Memory usage: 28.33 mb
Reply
#3

anyone?
Reply
#4

maybe the Gm has bugs?
Reply
#5

no its not a game mode issue i tested everything lastnight in and out of my gm what seems to be the problem is MidoStream Now me server used to run with 25 players on mo memory and 3%cpu now with 0 players on no one at all this is my readins


CPU Usage: 9.7 %
Memory usage: 28.33 mb
Space in use: 48 mb


What i come to figure out if i dont load Midostream and my objects my cpu and memory is fine this just started happening i have not changed a thing any ideas on to how to fix thins i have about 5000 objects
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)