SA-MP Forums Archive
Error in server log - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error in server log (/showthread.php?tid=660911)



Error in server log - Spawe - 17.11.2018

Error:

PHP Code:
[debugRun time error 4"Array index out of bounds"
[00:53:59] [debugAMX backtrace:
[
00:53:59] [debug#0 00040b8c in public OnPlayerDeath (0, 65535, 255) from TDM.amx
[00:53:59] [deathSpawe died 255 
public OnPlayerDeath

PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killeridplayeridreason);
    
PlayerInfo[killerid][cDinero] += 400;
    
PlayerInfo[killerid][cKills] += 1;
    
    {
    
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
    
GivePlayerMoney(killerid400);
    }
    
    new 
string[50];
    
format(stringsizeof(string), "~g~+$400");
    
GameTextForPlayer(killeridstring30001);
    return 
1;




Re: Error in server log - BigETI - 17.11.2018

If you inspect your error message again, you will see that "killerid" has returned "65535", which is by definition an invalid player ID.


Re: Error in server log - Spawe - 17.11.2018

Quote:
Originally Posted by BigETI
View Post
If you inspect your error message again, you will see that "killerid" has returned "65535", which is by definition an invalid player ID.
What is the solution in this case?


Re: Error in server log - BigETI - 17.11.2018

Check if killerid is valid or not.


Re: Error in server log - Spawe - 17.11.2018

Quote:
Originally Posted by BigETI
View Post
Check if killerid is valid or not.
I do not know how, it's that I'm new xd


Re: Error in server log - CantBeJohn - 17.11.2018

Quote:
Originally Posted by Spawe
View Post
I do not know how, it's that I'm new xd
The SA:MP Wiki gives an example how, here: https://sampwiki.blast.hk/wiki/OnPlayerDeath

Otherwise, instead of how it's done in the wiki. You can use "if(IsPlayerConnected(killerid))" to check if killerid is valid (a valid player that's connected on the server currently) or not.


Re: Error in server log - Spawe - 17.11.2018

Thanks you bro <3