SA-MP Forums Archive
Problem With OnPlayerDeath - 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: Problem With OnPlayerDeath (/showthread.php?tid=313894)



Problem With OnPlayerDeath - matute - 27.01.2012

Fixed


Re: Problem With OnPlayerDeath - MP2 - 27.01.2012

You need to check whether killedid != INVALID_PLAYER_ID before you use it in any arrays.


Respuesta: Re: Problem With OnPlayerDeath - matute - 27.01.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
You need to check whether killedid != INVALID_PLAYER_ID before you use it in any arrays.
So i do something like this? :
pawn Код:
if(killedid != INVALID_PLAYER_ID)
{
//here my code
return 1;
}



Re: Problem With OnPlayerDeath - henry jiggy - 27.01.2012

killerid.


Re: Problem With OnPlayerDeath - MP2 - 27.01.2012

Yes. If you try to set an array with [killerid] to something and it's INVALID_PLAYER_ID - it will stop the script.


Respuesta: Re: Problem With OnPlayerDeath - matute - 27.01.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Yes. If you try to set an array with [killerid] to something and it's INVALID_PLAYER_ID - it will stop the script.
Ok now i will try to see if it works and i tell you


Re: Problem With OnPlayerDeath - MP2 - 27.01.2012

Also, 'OnPlayerDeath' should have 'public' before it.


Respuesta: Re: Problem With OnPlayerDeath - matute - 27.01.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Also, 'OnPlayerDeath' should have 'public' before it.
Yes i know that, i just added the code here and forgot to add onplayerdeath fuction and i didnt type public.
Well i edited it but it seems to dont work :/ I forgot something?


Re: Problem With OnPlayerDeath - MP2 - 27.01.2012

You're doing

PlayerInfo[killerid][pKills]++;

but not checking if it's valid.


Respuesta: Re: Problem With OnPlayerDeath - matute - 27.01.2012

Oh thanks bro, now it works!!
I will give you +Rep