OnPlayerDeath doesn't get called if updating variables
#1

Made a MySQL account system for my gamemode. Now OnPlayerDeath doesn't get called for some reason if I set variables there.

Doesn't get called:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Kills[killerid] ++;
    Deaths[playerid] ++;
    SetPlayerColor(playerid, NOCLASS);
    SendDeathMessage(killerid, playerid, reason);
    TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
    return 1;
}
Gets called:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPlayerColor(playerid, NOCLASS);
    SendDeathMessage(killerid, playerid, reason);
    TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
    return 1;
}
Reply
#2

Remove the space between the "]" and the "++".
Reply
#3

Doesn't work. Also it looks ugly :P

EDIT: also, when I spawn after dying (OnPlayerDeath wasn't called), I see some random bottles on the ground?
Reply
#4

Quote:
Originally Posted by spedico
Посмотреть сообщение
Doesn't work. Also it looks ugly :P

EDIT: also, when I spawn after dying (OnPlayerDeath wasn't called), I see some random bottles on the ground?
Code always looks ugly. You'll pickup certain styles as you develop your skills.
Reply
#5

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if ( killerid != INVALID_PLAYER_ID )
        Kills[killerid] ++;

    Deaths[playerid] ++;
    SetPlayerColor(playerid, NOCLASS);
    SendDeathMessage(killerid, playerid, reason);
    TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
    TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)