SA-MP Forums Archive
[HELP] Playerid and killerid - 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: [HELP] Playerid and killerid (/showthread.php?tid=334688)



[HELP] Playerid and killerid - sidney123 - 15.04.2012

Hello,

I'm busy with my own DM script, but I'm stuck with something.
(I'm a quite noob but can't find it in the WIKI).

I want the following.

The killed player gets -1 score.
The player who killed a player gets +1 score.

My "killed player gets -1 score" works, but my "player who killed a player gets +1 score" don't work.
I need to make a thing that gets the playerid of the killerid, I think?

Everyone who helps me get /credits in my server and +REP.

My script is as follows:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ResetPlayerWeapons(playerid);
    SetPlayerScore(playerid,-1);
    //SetPlayerScore(killerid,+1);
    return 1;
}



Re: [HELP] Playerid and killerid - ViniBorn - 15.04.2012

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ResetPlayerWeapons(playerid);
    SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    return 1;
}



Re: [HELP] Playerid and killerid - sidney123 - 15.04.2012

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ResetPlayerWeapons(playerid);
    SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    return 1;
}
I tried that one before and it gave me errors, but this one works.
Thanks! /credit'ed and REP'ed.


Re: [HELP] Playerid and killerid - Kaczmi - 15.04.2012

For easiest use:

pawn Код:
#define GivePlayerScore(%0,%1) SetPlayerScore(%0,GetPlayerScore(%0)+%1)
Usage:

pawn Код:
if(playerid != killerid) GivePlayerScore(killerid,1),GivePlayerScore(playerid,-1);