How to make maxium wanted level
#1

Well when people commit crimes, their wanted level goes up of course, but the problem is, I don't want their wanted level to be 12, 17, 25, 43 etc... I want it to stop at Wanted Level 10 as the maximum. How would I do it?

Say I was wanted level 9, stole a cop car which is worth 4 stars (wanted level 4). This would give me wanted level 13, BUT, I want it to stop at wanted level 10 and say Wanted Level 10 - Most Wanted, not Wanted Level 13 blabla...

Any ideas?
Reply
#2

something like this
pawn Код:
stock SetPlayerWanted(playerid,level) {
    if!IsPlayerConnected(playerid)) return;
    new stars = GetPlayerWantedLevel(playerid);
    if(stars >= level) return;
    if(level >= 6)  level = 6;
    if(level <= 0)  level = 0;
    SetPlayerWantedLevel(playerid,level);
    PlayerInfo[playerid][Wanted] = level;
}
Reply
#3

how can we set a jail time for the players if a cop /arrest them and jail them for a period of time.only if they have 4-6 stars.
Reply
#4

SetTimerEx();...?
Reply
#5

yes plz.but coding?
Reply
#6

pawn Код:
CMD:jail(playerid, params[])
{
        new id, mins, str[128];
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xffffffff, "You're not Admin!");
         if(sscanf(params, "ud", id, mins)) return SendClientMessage(playerid, 0xffffffff, "[Usage]: /jail <id> <minutes>");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xffffffff, "Invalid player id.");
        SetPlayerPos(id, x, y, z);        //Jail Pos
        JailTimer[id] = SetTimerEx("Unjail", mins*60*1000, 0, "d", id);
        format(str, sizeof(str), "You jailed %s for %d mins.", GetName(id), mins);
        SendClientMessage(playerid, 0xffffffff, str);
        format(str, sizeof(str), "%s jailed you for %d mins.", GetName(playerid), mins);
        SendClientMessage(id, 0xffffffff, str);
        return 1;
}
There but im trying not to post cde as im trying to answer ll posts on forums with only me replying ive seen so far
Reply
#7

can u plz show me how to use in strcmp cmds.
Reply
#8

I personally do it a different way. Assuming your wanted levels correspond to the stars like so;
Код:
*     *     *     *     *     *
1 2   3 4   5     6 7   8 9   10
we would write something like this:

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;
}
@jot16: go make your own damn thread.
Reply
#9

EDIT: Blacklite has done i a better way
Reply
#10

Thanks for the help guys, but I figured out my own way

pawn Код:
new plwl = GetPlayerWantedLevel(playerid);

if(plwl >= 10)
{
     SendClientMessage(playerid,COLOR_ORANGE,"(CRIME COMMITTED)  -  crime here  -  Wanted Level 10  -  Warrant");
     return SetPlayerWantedLevel(playerid,10);
}
It works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)