Problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem (
/showthread.php?tid=164056)
Problem -
TheNuttyScientist - 29.07.2010
Whenever a death occurs in my gamemode, it sends the death message to the right twice instead of once.
Re: Problem -
mastasquizy - 29.07.2010
Lets see the OnPlayerDeath code
Re: Problem -
WillyP - 29.07.2010
um, is this code here the same as urs?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
return 1;
}
to other dude: nou
Re: Problem -
mastasquizy - 29.07.2010
The only reason it would "SendDeathMessage" twice is if your scripting it twice....
Re: Problem -
TheNuttyScientist - 29.07.2010
Here it is:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new playercash;
if(killerid == INVALID_PLAYER_ID) {
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
ResetPlayerMoney(playerid);
} else {
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
playercash = GetPlayerMoney(playerid);
if (playercash > 0) {
GivePlayerMoney(killerid, playercash);
ResetPlayerMoney(playerid);
}
else
{
}
}
return 1;
}
Re: Problem -
mastasquizy - 29.07.2010
You don't have to SendDeathMessage for an invalid killer. Just get rid of all your 'SendDeathMessage's and just put only one above the return 1.
pawn Код:
SendDeathMessage(killerid,playerid,reason);//if killerid is invalid, it will take care of it for you.
return 1;
}