SA-MP Forums Archive
Score OnPlayerDeath - 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: Score OnPlayerDeath (/showthread.php?tid=413130)



Score OnPlayerDeath - $mooth - 04.02.2013

Got a question, can someone show me how to do so a player gets score OnPlayerDeath?
(Just when a player dies, the player gets an diff. amount of score depending on the time)
"Die by himself, not getting killed by another player"

It's an race mode. So when i player dies e.tc. falling of the track/explodes, it will go to spec mode on other players.


Re: Score OnPlayerDeath - denNorske - 04.02.2013

pawn Код:
if(reason == 53 || reason == 54 || reason == 49 && /*IfPlayerIsInRaceVariableHERE*/)//reasons for death. Place under OnPlayerDeath - and replace the variable for if he is in a race
{
    //Spectate  here and Give the player score with "SetPlayerScore(GetPlayerScore(playerid) + 1);" --> Will add 1 score to the dead person.
}
Hope this helped


Re: Score OnPlayerDeath - Gamer_007 - 04.02.2013

umm try SetPVarInt and GetPVarInt.Easiest way for this


Re: Score OnPlayerDeath - $mooth - 04.02.2013

Well didnt work as i got an error code.

This is how i have it

OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid,killerid,reason)

{

    SetPlayerScore(killerid,(GetPlayerScore(killerid))+29);
    GivePlayerMoney(killerid, 200);
    GivePlayerMoney(playerid, 200);
    SendDeathMessage(playerid,killerid,reason);
    RemovePlayerFromRace(playerid);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectatePlayer(playerid, killerid);
   

    return 1;
}
SetPlayerScore(killerid,(GetPlayerScore(killerid)) +29);
GivePlayerMoney(killerid, 200);
GivePlayerMoney(playerid, 200);


Dont work as it serches for a killerid. But i cant implement
pawn Код:
if(reason == 53 || reason == 54 || reason == 49 && /*IfPlayerIsInRaceVariableHERE*/)//reasons for death. Place under OnPlayerDeath - and replace the variable for if he is in a race
{
    //Spectate  here and Give the player score with "SetPlayerScore(GetPlayerScore(playerid) + 1);" --> Will add 1 score to the dead person.
}
(PlayersInRace)


Re: Score OnPlayerDeath - bensmart469 - 04.02.2013

This?
PHP код:
            if(killerid != INVALID_PLAYER_ID)
            {
                         
//code here