SA-MP Forums Archive
Small probl - 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: Small probl (/showthread.php?tid=317839)



Small probl - Face9000 - 12.02.2012

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?


Re: Small probl - Madd Kat - 12.02.2012

you mean for any car?

or just ones with certain ID's?


Re: Small probl - Face9000 - 12.02.2012

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.


Re: Small probl - ArmyOps - 12.02.2012

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



Re: Small probl - Face9000 - 12.02.2012

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


Re: Small probl - Madd Kat - 12.02.2012

Case : 400 .. 450



This will add 400 to 450


Sorry hard to type on my iphone


Re: Small probl - Twisted_Insane - 12.02.2012

Yo!

As they said, do it shortly like this:

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



Re: Small probl - iPLEOMAX - 12.02.2012

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.


Re: Small probl - Face9000 - 12.02.2012

Thanks all.