*** Terrible Title Removed - 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: *** Terrible Title Removed (
/showthread.php?tid=387543)
*** Terrible Title Removed -
Opah - 25.10.2012
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
if((killerid != playerid) || (killerid = INVALID_PLAYER_ID))
{
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
}
else
{
pInfo[playerid][Suicides]++;
}
return 1;
}
no errors or warnings but it doesn't work
Re: why ain't this working -
niels44 - 25.10.2012
pawn Код:
if((killerid != playerid) || (killerid = INVALID_PLAYER_ID))
shouldnt it be:
pawn Код:
if((killerid != playerid) || (killerid != INVALID_PLAYER_ID))
or
pawn Код:
if((killerid != playerid) && (killerid != INVALID_PLAYER_ID))
or with the removed ( and )
pawn Код:
if((killerid != playerid && killerid != INVALID_PLAYER_ID)
??
Re: *** Terrible Title Removed -
Faisal_khan - 25.10.2012
Quote:
Originally Posted by ******
It is MUCH simpler to write and read "if" checks with the "true" version first:
pawn Код:
if((killerid == playerid) || (killerid == INVALID_PLAYER_ID)) { pInfo[playerid][Suicides]++; } else { pInfo[killerid][Kills]++; pInfo[playerid][Deaths]++; }
|
Yeah I prefer this way. It's much easier, non-confusing and understandable.
Re: *** Terrible Title Removed -
Opah - 25.10.2012
still doesn't work
Re: *** Terrible Title Removed -
Faisal_khan - 25.10.2012
Try this:
pawn Код:
if((killerid == playerid))
{
pInfo[playerid][Suicides]++;
}
else
{
pInfo[killerid][Kills]++;
pInfo[playerid][Deaths]++;
}
Re: *** Terrible Title Removed -
Opah - 25.10.2012
same
Re: *** Terrible Title Removed -
Faisal_khan - 25.10.2012
So whats the problem? Is it just adding suicides or only kills and deaths?
Re: *** Terrible Title Removed -
Opah - 25.10.2012
the suicides