When A player kills sombody eles they get a score. - 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: When A player kills sombody eles they get a score. (
/showthread.php?tid=185804)
When A player kills sombody eles they get a score. -
Haydz - 26.10.2010
I can do this perfectly fine when they die they loose a point, but how can i make them gain a point when they killl sombody.
code:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + -1);
KillingSpree[killerid] ++;
KillingSpree[playerid] = 0;
if(KillingSpree[killerid] == 3)
{
new pname[24];
new string[256];
GetPlayerName(killerid,pname,24);
format(string,sizeof(string), "Watch Out For %s, Hes On A 3 Man Kill Streak.",pname);
SendClientMessageToAll(COLOR_YELLOW,string);
}
Re: When A player kills sombody eles they get a score. -
SampStunta - 26.10.2010
pawn Код:
SetPlayerScore(playerid, +1); //Or whatever score you gain
Have never really wanted to try :S
Re: When A player kills sombody eles they get a score. -
mrmuffins - 26.10.2010
Quote:
Originally Posted by SampStunta
pawn Код:
SetPlayerScore(playerid, +1); //Or whatever score you gain
Have never really wanted to try :S
|
Errors, errors and more errors.
This will not work for obvious reasons.
@Hayden_Bruin you have it right, just get rid of the negative sign you have.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1); //this or
SetPlayerScore(playerid, GetPlayerScore(playerid) - 1); //this or
//SetPlayerScore(thisplayertogan, GetPlayerScore(thescoreoftheplayer) + 1);
KillingSpree[killerid]++;
KillingSpree[playerid] = 0;
if(KillingSpree[killerid] == 3) {
new pname[24];
new string[256];
GetPlayerName(killerid,pname,24);
format(string,sizeof(string), "Watch Out For %s, Hes On A 3 Man Kill Streak.",pname);
SendClientMessageToAll(COLOR_YELLOW,string);
}
return 1;
}
Add a point/score to the Killer (killerid) and subtract a score/point from the Killed (playerid)
Re: When A player kills sombody eles they get a score. -
SkizzoTrick - 26.10.2010
SetPlayerScore(killerid, GetPlayerScore(playerid)+1);
Re: When A player kills sombody eles they get a score. -
SampStunta - 26.10.2010
Oh yeah, sorry I forgot the GetPlayerScore part, was on my phone so was in a hurry :S
Re: When A player kills sombody eles they get a score. -
Celson - 26.10.2010
Quote:
Originally Posted by SkizzoTrick
SetPlayerScore(killerid, GetPlayerScore(playerid)+1);
|
WARNING! WARNING! DOES NOT COMPUTE WILL ROBINSON!
But yeah what you really need is SetPlayerScore(killerid, GetPlayerScore(killerid)+1);