if kills > 15 bla bla - 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: if kills > 15 bla bla (
/showthread.php?tid=201120)
if kills > 15 bla bla -
Face9000 - 20.12.2010
Hi all,i need to detect if player has more 15 kills.
Like:
if kills > 15
free armour/health bla bla.
Thanks.
Re: if kills > 15 bla bla -
blackwave - 20.12.2010
pawn Код:
new kill[MAX_PLAYERS]; // top
public OnPlayerDeath(playerid, reason)
{
kill[killerid]++;
}
public OnPlayerStateChange(playerid, oldstate, newstate)
{
if(kill[playerid] > 15)
{
// ... functions here
}
return 1;
}
Re: if kills > 15 bla bla -
Face9000 - 20.12.2010
Thanks,i've a question.
I use custom made registration system and OnPlayerDeath i've this:
pawn Код:
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
(This will add +1 at every kill of the player).
If i add your code,this will affect the code above or not?
Re: if kills > 15 bla bla -
blackwave - 20.12.2010
Quote:
Originally Posted by Logitech90
Thanks,i've a question.
I use custom made registration system and OnPlayerDeath i've this:
pawn Код:
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
(This will add +1 at every kill of the player).
If i add your code,this will affect the code above or not?
|
Just put out from the keys: "{" "}"
Or above the code. If underneath, out from these keys:
pawn Код:
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
Re: if kills > 15 bla bla -
Face9000 - 20.12.2010
Ok,i've tried to paste the code where u say (adding fre armour),but it dont work.
Re: if kills > 15 bla bla -
blackwave - 20.12.2010
Quote:
Originally Posted by Logitech90
Ok,i've tried to paste the code where u say (adding fre armour),but it dont work.
|
Since you haven't over 15 kills, you can't receive this armour. If didn't work on StateChange (for me ever works things of this kind), then put a SetTimerEx,
Forwarding before
Re: if kills > 15 bla bla -
Face9000 - 20.12.2010
lol i lowered the kills to 3 just to test.
BTW i've fixed.
Re: if kills > 15 bla bla -
TheXIII - 20.12.2010
No need for timer, or OnPlayerUpdate etc. Easiest solutions are usually the best.
Have fun.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
// I would also add this, so the score is spree, not the total kills:
// SetPlayerScore(playerid, 0)
if( killerid != INVALID_PLAYER_ID )
{
SetPlayerScore(killerid,(GetPlayerScore(killerid))+1);
if( GetPlayerScore(killerid) == 15 )
//OR the following, to give armor to player for each kill, when 15 kills are reached
// if( GetPlayerScore(killerid) >= 15 )
{
SetPlayerArmour(killerid,GetPlayerArmour(killerid) + 10);
// OR!
SetPlayerArmour(killerid, 100);
}
}
return 1;
}