SA-MP Forums Archive
Script stops (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: Script stops (OnPlayerDeath) (/showthread.php?tid=303867)



Script stops (OnPlayerDeath) - admantis - 15.12.2011

Hello,

I have this script:
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    printf("0");
    new szWepName[64], szString[128]/*, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2*/;
    printf("1");
    PlayerInfo[killerid][Kills]++;
    printf("2");
    PlayerSpree[killerid]++;
    PlayerSpree[playerid] = 0;
    // ..... a bunch of more code
For some reason, the OnPlayerDeath script stops after "1" is printed. "2" is not printed. I hope you can help me.


Re: Script stops (OnPlayerDeath) - kizla - 15.12.2011

give us variable for Kills


Re: Script stops (OnPlayerDeath) - admantis - 15.12.2011

Quote:
Originally Posted by kizla
Посмотреть сообщение
give us variable for Kills
pawn Код:
PlayerInfo[playerid][Kills]
Quote:
Originally Posted by belhot1992
Посмотреть сообщение
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    printf("0");
    new szWepName[64], szString[128]; /*, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2*/
    printf("1");
    PlayerInfo[killerid][Kills]++;
    printf("2");
    PlayerSpree[killerid]++;
    PlayerSpree[playerid] = 0;

    // ..... a bunch of more code
Post more of the code maybe?
I don't think that commenting text in between code is a good idea as well.
The other code is +800 lines. Yet irrevelant since the error is probaby nowhere there since the code stops after "1". Commenting text between code is nothing wrong. And I tried your "new code" it does no difference honestly..

Help, please.


Re: Script stops (OnPlayerDeath) - kizla - 15.12.2011

i really dont now why dosent work...

pawn Код:
PlayerInfo[killerid][Kills] ++;
i have that and works for me fine

p.s he dont need to post all code if "2" isnt printing.


Re: Script stops (OnPlayerDeath) - Lorenc_ - 15.12.2011

Insert your code in this:

pawn Код:
if(IsPlayerConnected(killerid))
{
}



Re: Script stops (OnPlayerDeath) - admantis - 15.12.2011

ty lorenc_


AW: Script stops (OnPlayerDeath) - BigETI - 15.12.2011

The reason is why your script stopped working because if the variable killerid is INVALID_PLAYER_ID then it means that it goes out of bounds from array.


Re: AW: Script stops (OnPlayerDeath) - Joe Staff - 15.12.2011

Quote:
Originally Posted by BigETI
Посмотреть сообщение
The reason is why your script stopped working because if the variable killerid is INVALID_PLAYER_ID then it means that it goes out of bounds from array.
To elaborate, a script halt is the result of an array attempting to reach beyond its boundaries. Reacts equally to 'return 0;'