Error in server log
#1

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;

Reply
#2

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

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?
Reply
#4

Check if killerid is valid or not.
Reply
#5

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
Reply
#6

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.
Reply
#7

Thanks you bro <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)