about cpu -
[SF]RobMob - 02.06.2010
Hi my gamemode is about 13000 lines and im using 2 plugins my problem is when there is about 15 players on my cpu is this
CPU Usage: 2 %
Memory usage: 16.19 mb
Space in use: 57 mb
But for some reason about every 40 seconds sometime is less the that it spikes to this
CPU Usage: 56 %
Memory usage: 16.19 mb
Space in use: 57 mb
Ive tried taking off my plugins and filter scripts but still the same problem the cpu loads every 5 seconds and it only stays at 56 for then goes back to 2 % after the 5 seconds
this is a problem because when my server hits 30 players the cpu goes over a hundred and for some reason the server restarts .Any ideas on what it could be causing this?
Re: about cpu -
Agent Smith - 02.06.2010
Have you got any timers? If so check how often its running and stuff.
Re: about cpu -
azzerking - 02.06.2010
Please check your timers and make sure there is no other programs running and if your timers are like
1-3 seconds // that can cause restarts
100-150 secs // has got an error where if set here it can restart at certain points
Please Check Them!
Re: about cpu -
[SF]RobMob - 03.06.2010
this is what i have for times in total
SetTimer("UpdateTime", 1000, 1);
SetTimer("ServerPoints", 1000, true);
SetTimer("MinSpam",2500,1);
SetTimer("msgtimer",50000,1);
SetTimer("Speedboost",200,1);
Re: about cpu -
Calgon - 03.06.2010
pawn Код:
SetTimer("Speedboost",200,1);
Isn't that slightly excessive? Your timer runs every 200 milliseconds. Care to show the code which is called within this function?
Re: about cpu -
[SF]RobMob - 03.06.2010
top of gm
Код:
forward Speedboost();
top of gm
Код:
new bool:SpeedBoostDisabled[MAX_PLAYERS];
OnGameModeInIt
Код:
SetTimer("Speedboost",200,1);
My commands for turning it on and off
Код:
CMD:sbon(playerid,params[])
{
#pragma unused params
if (level[playerid] >= 4)
{
for(new i; i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SpeedBoostDisabled[i] = true;
}
}
} else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command");
return 1;
}
CMD:sboff(playerid,params[])
{
#pragma unused params
if (level[playerid] >= 4)
{
for(new i; i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SpeedBoostDisabled[i] = false;
}
}
} else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command");
return 1;
}
And the public for the speedboost
Код:
public Speedboost()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(SpeedBoostDisabled[i] == true)
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
new Keys,up,down;
GetPlayerKeys(i,Keys,up,down);
if(Keys &= 1024)
{
if(GetPlayerState(i) == PLAYER_STATE_ONFOOT)
{
new Float:x,Float:y,Float:z;
GetPlayerVelocity(i,x,y,z);
SetPlayerVelocity(i,x+(x / 4),y+(y / 4),z+(z / 4));
}
}
GetPlayerKeys(i,Keys,up,down);
if(Keys &= 4)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:x,Float:y,Float:z;
GetVehicleVelocity(GetPlayerVehicleID(i),x,y,z);
SetVehicleVelocity(GetPlayerVehicleID(i),x+(x / 4),y+(y / 4),z+(z / 4));
}
}
}
}
return 1;
}