SA-MP Forums Archive
[HELP]Get Score When Player Kill Another Player - 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]Get Score When Player Kill Another Player (/showthread.php?tid=351883)



[HELP]Get Score When Player Kill Another Player - Avi57 - 17.06.2012

Hello,
I Need a system in which when i kill any Player i should get 1 score and some random money like $20000 to $30000 !
Here's my GM : Here It Is !

Hope You Will Help Me,
Thanks


Re: [HELP]Get Score When Player Kill Another Player - Kindred - 17.06.2012

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //If not invalid killerid (not a vehicle, etcetra), gets current score and adds one to the killer.
    GivePlayerMoney(playerid, random(30000 - 10000) + 10000);//Randomizes the amount of cash the person gets, 20000 - 30000
    return 1;
}
Untested, I rarely use randoms, and when I do, I look at examples. Found an example on the forums and edited it to your liking.

Explanation of the code is shown in the code.


Re: [HELP]Get Score When Player Kill Another Player - Avi57 - 17.06.2012

Thx Worked
Reped +1


Re: [HELP]Get Score When Player Kill Another Player - Avi57 - 18.06.2012

Hey when a Player do /kill, it gives money to them too and scores toooo


Re: [HELP]Get Score When Player Kill Another Player - [MM]RoXoR[FS] - 18.06.2012

Quote:
Originally Posted by Avi57
Посмотреть сообщение
Hey when a Player do /kill, it gives money to them too and scores toooo
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID){ SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //If not invalid killerid (not a vehicle, etcetra), gets current score and adds one to the killer.
    GivePlayerMoney(playerid, random(30000 - 10000) + 10000);}//Randomizes the amount of cash the person gets, 20000 - 30000
    return 1;
}



Re: [HELP]Get Score When Player Kill Another Player - HuSs3n - 18.06.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID){ SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //If not invalid killerid (not a vehicle, etcetra), gets current score and adds one to the killer.
    GivePlayerMoney(playerid, random(30000 - 10000) + 10000);}//Randomizes the amount of cash the person gets, 20000 - 30000
    return 1;
}
GivePlayerMoney(playerid,....
GivePlayerMoney(killerid,....

shouldnt the killer get the money or what ^^ ?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID){ SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //If not invalid killerid (not a vehicle, etcetra), gets current score and adds one to the killer.
    GivePlayerMoney(killerid, random(30000 - 10000) + 10000);}//Randomizes the amount of cash the person gets, 20000 - 30000
    return 1;
}