OnPlayerDeath doesn't get called if updating variables - 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: OnPlayerDeath doesn't get called if updating variables (
/showthread.php?tid=312086)
OnPlayerDeath doesn't get called if updating variables -
spedico - 19.01.2012
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;
}
Re: OnPlayerDeath doesn't get called if updating variables -
Scenario - 19.01.2012
Remove the space between the "]" and the "++".
Re: OnPlayerDeath doesn't get called if updating variables -
spedico - 19.01.2012
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?
Re: OnPlayerDeath doesn't get called if updating variables -
Scenario - 19.01.2012
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.
Re: OnPlayerDeath doesn't get called if updating variables -
Psymetrix - 19.01.2012
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;
}