Wanted Level When Killing someone - 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: Wanted Level When Killing someone (
/showthread.php?tid=330294)
Wanted Level When Killing someone -
TheMightyEddy - 01.04.2012
How can I make something where when a player kills another player for any reason, they get 4 stars (wanted) level automatically? And how can I also make a timer that tells when the wanted level can go down.
Re: Wanted Level When Killing someone -
Dr - 01.04.2012
pawn Код:
new KillerTime[MAX_PLAYERS];
new KillerLevel[MAX_PLAYERS];
forward KillerTimer(playerid);
public OnPlayerDeath(playerid, killerid, reason)
{
KillerLevel[killerid] += 4;
SetPlayerWantedLevel(killerid, KillerLevel[killerid]);
KillerTime[killerid] = SetTimerEx("KillerTimer", 300000, true, "u", killerid);
SendClientMessage(COLOR_WHITE, killerid, "You are now wanted for murder, you will lose a star every 5 minutes");
return 1;
}
public KillerTimer(playerid)
{
if(KillerLevel[playerid] > 0)
{
KillerLevel[playerid]--;
SetPlayerWantedLevel(playerid, KillerLevel[playerid]);
}
else
{
KillerLevel[playerid] = 0;
SendClientMessage(COLOR_WHITE, playerid, "You are now free, and not wanted anymore");
SetPlayerWantedLevel(playerid, 0);
KillTimer(KillerTime[playerid]);
}
return 1;
}
Re: Wanted Level When Killing someone -
TheMightyEddy - 01.04.2012
Quote:
Originally Posted by Dr
pawn Код:
new KillerTime[MAX_PLAYERS]; new KillerLevel[MAX_PLAYERS]; forward KillerTimer(playerid); public OnPlayerDeath(playerid, killerid, reason) { KillerLevel[killerid] += 4; SetPlayerWantedLevel(killerid, KillerLevel[killerid]); KillerTime[killerid] = SetTimerEx("KillerTimer", 300000, true, "u", killerid); SendClientMessage(COLOR_WHITE, killerid, "You are now wanted for murder, you will lose a star every 5 minutes"); return 1; }
public KillerTimer(playerid) { if(KillerLevel[playerid] > 0) { KillerLevel[playerid]--; SetPlayerWantedLevel(playerid, KillerLevel[playerid]); } else { KillerLevel[playerid] = 0; SendClientMessage(COLOR_WHITE, playerid, "You are now free, and not wanted anymore"); SetPlayerWantedLevel(playerid, 0); KillTimer(KillerTime[playerid]); } return 1; }
|
May I just say you are the best coder I've ever met!
Thanks so much! +rep!