PDA

View Full Version : Wanted level


sscarface
14/06/2015, 11:14 PM
Well, I'm using this function. But it still show me wanted level 8 and 12 , 14, blah , blah. I wanted if player has 6 stars wanted level and he robbed a player "(if you rob a player in my script you get 2 stars)". it should show to player
"Wanted level 6"

aS YOU CAN SEE IN PICTURE IT SHOWS ME Wanted Level 8 and it goes up if you rob something else. I want to make it stop at 6. Even if player has 6 stars already it should still show 6.

http://puu.sh/ip5Wq/7fd6753c19.png


new WantedLevelStars[] = {
0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6
};

stock CommitCrime(playerid, level, crimedesc[]) {
new string[128];
PlayerInfo[playerid][Wanted] = SetPlayerWanted(playerid, PlayerInfo[playerid][Wanted] + level);
format(string, sizeof(string), "Committed a crime: %s (Wanted Level %d)", crimedesc);
SendClientMessage(playerid, WHITE, string);
}

stock SetPlayerWanted(playerid, level) {
if (level > sizeof(WantedLevelStars)) level = sizeof(WantedLevelStars);
if (level < 0) level = 0;
PlayerInfo[playerid][Wanted] = level;
SetPlayerWantedLevel(playerid, WantedLevelStars[level]);
return level;
}