SA-MP Forums Archive
Server Freezing 100% usage cpu core1 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Server Freezing 100% usage cpu core1 (/showthread.php?tid=455880)



Server Freezing 100% usage cpu core1 - dr1ftp0w3r - 03.08.2013

Hello there.

I'm getting a lot of this by CrashDetect:
Код:
[18:18:36] [debug] #0 004aa0cc in public OnPlayerUpdate () from bP.amx
[18:18:36] [debug] Run time error 4: "Array index out of bounds"
[18:18:36] [debug]  Accessing element at index 65535 past array upper bound 499
(every single second)

And after some hours, server gets frozen and no one can join, I mean, they can, but gamemode doesn't load.

I checked htop(proccess monitor for linux) and one of the cpu cores was 100% which is odd, so I believe it's due to this.

Код:
public OnPlayerUpdate(playerid)
{
new targetplayer = GetPlayerTargetPlayer(playerid); // Store the ID
if(DM[targetplayer] != INVALID_PLAYER_ID){
    if(DM[targetplayer] == 0 && targetplayer != INVALID_PLAYER_ID)
    {

        SetPlayerHealth(playerid,0.0);
        GameTextForPlayer(playerid, "~R~do not try to use weapons in fun zones!", 5000, 3);
    }
}
	return 1;
}
I tried that first IF but it didn't work at all, I was using this page https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer

Basically this checks if a player tries to spawn weapons outside the DM Zones and if shoots at stunters then he gets killed.

I hope someone can help me, thank you for reading.

EDT: Fixed, thanks to Niko_boy and [Comrade]Garsino. Also thanks for telling me about OnPlayerTakeDamage.

PS. way to fix was to check targetplayer != INVALID_PLAYER_ID before DM[targetplayer] == 0


Re: Server Freezing 100% usage cpu core1 - ColorHost-Kevin - 03.08.2013

Glad it got fixed for you


Re: Server Freezing 100% usage cpu core1 - dr1ftp0w3r - 06.08.2013

Quote:
Originally Posted by ColorHost-Kevin
Посмотреть сообщение
Glad it got fixed for you
I wish it was fixed, but turns out it's not.. I can't figure out which script is causing this!

Plugins: streamer.so mysql_debian.so crashdetect.so sscanf.so