Small probl
#1

Hello,i've this code to set the wanted stars at the every teams steals a police vehicle,except TEAM_COP.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && gTeam[playerid] != TEAM_COP)
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 497, 447, 523, 416, 433, 427, 490, 528, 407, 544, 596, 597, 598, 599, 432, 601, 470, 472, 430, 428:
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
                new string[64];
                format(string, sizeof(string), "- CRIME - Law Enforcement Vehicle Theft - Wanted Level %d ", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, red, string);
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                if(!IsPlayerConnected(i))continue;
                new current_zone;
                current_zone = player_zone[i];
                if(gTeam[i] == TEAM_COP)
                {
                new copmsg[170];
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                format(copmsg, sizeof(copmsg), "- WARNING ALL COPS: Law Enforcement Vehicle Theft By %s (%d) - Location: %s",name,playerid,zones[current_zone][zone_name]);
                SendClientMessage(i, COLOR_BLUE, copmsg);
                }
                }
            }
        }
    }
    return 1;
}
The problem is: The code works good,but i want add a Wanted Level stars for the rest of vehicle ids,how to?
Reply
#2

you mean for any car?

or just ones with certain ID's?
Reply
#3

Any car except this id's:

" case 497, 447, 523, 416, 433, 427, 490, 528, 407, 544, 596, 597, 598, 599, 432, 601, 470, 472, 430, 428:"

For this id's i've the +4 wanted stars,for other ids i just need +1 wanted stars.
Reply
#4

pawn Код:
case ......: // replace ...... line with other id's
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
            }
Reply
#5

Already know that method,but there are too much id's to write,any ways to evade it?
Reply
#6

Case : 400 .. 450



This will add 400 to 450


Sorry hard to type on my iphone
Reply
#7

Yo!

As they said, do it shortly like this:

pawn Код:
case 400 .. 450:
{
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4); //4 is right?
}
Reply
#8

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && gTeam[playerid] != TEAM_COP)
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 497, 447, 523, 416, 433, 427, 490, 528, 407, 544, 596, 597, 598, 599, 432, 601, 470, 472, 430, 428:
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
                new string[64];
                format(string, sizeof(string), "- CRIME - Law Enforcement Vehicle Theft - Wanted Level %d ", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, red, string);
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                if(!IsPlayerConnected(i))continue;
                new current_zone;
                current_zone = player_zone[i];
                if(gTeam[i] == TEAM_COP)
                {
                new copmsg[170];
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                format(copmsg, sizeof(copmsg), "- WARNING ALL COPS: Law Enforcement Vehicle Theft By %s (%d) - Location: %s",name,playerid,zones[current_zone][zone_name]);
                SendClientMessage(i, COLOR_BLUE, copmsg);
                }
                }
            }
            default:
            {
                //For "All" other cars that are not on the above case ^:
            }
        }
    }
    return 1;
}
You might wanna use "default:" statement.
Reply
#9

Thanks all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)