Script stops (OnPlayerDeath)
#1

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

give us variable for Kills
Reply
#3

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

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

Insert your code in this:

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

ty lorenc_
Reply
#7

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

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;'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)