02.08.2011, 03:26
I personally do it a different way. Assuming your wanted levels correspond to the stars like so;
we would write something like this:
@jot16: go make your own damn thread.
Код:
* * * * * * 1 2 3 4 5 6 7 8 9 10
pawn Код:
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;
}