[HELP] Playerid and killerid
#1

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;
}
Reply
#2

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

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.
Reply
#4

For easiest use:

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)