I have two problems - 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: I have two problems (
/showthread.php?tid=602674)
I have two problems -
Antonio2323 - 11.03.2016
Hello,
On my chat log of server-samp see debug error:
#0 000e1698 in public OnPlayerDeath (playerid=6, killerid=65535, reason=255)
And i have an other problem: my gamemode has used 100% usage CPU, what's problem?
Please, help me, thank you.
Re: I have two problems -
CalvinC - 11.03.2016
Make sure the killerid isn't an invalid player ID:
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
// Your code here
}
return 1;
}
Quote:
Originally Posted by Wiki
You MUST check whether 'killerid' is valid (not INVALID_PLAYER_ID) before using it in an array (or really anywhere), as it will cause the OnPlayerDeath script to crash (not the entire script). This is because INVALID_PLAYER_ID is defined as 65535, and if an array only has 'MAX_PLAYERS' elements, e.g. 500, you're trying to access an index that is above 499, which is out of bounds.
|
Re: I have two problems -
Antonio2323 - 11.03.2016
Thanks, what the cause of lag on gamemode?
Re: I have two problems -
CalvinC - 11.03.2016
Quote:
Originally Posted by Antonio2323
Thanks, what the cause of lag on gamemode?
|
That's most likely too much code in your OnPlayerUpdate callback, make sure to keep it as simple as possible.
Or too many timers with too much code could also cause lag.