Wanted when stealing a car
#1

The problem is that when you've stolen a law enforcement vehicle once, you can't steal any of them again.
Also, how would I make it possible to steal different police vehicles but in the same time, you dont get wanted for re-entering the one you stole last?


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{

    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) // Player left vehicle
    {
        if(gTeam[playerid] == TAXIDRIVER)
        {
        //
            GameTextForPlayer(playerid, "~g~Taxi Duty ~r~ Ended.", 5000, 5);
            SendClientMessageToAll(COLOR_RED,"Has quit his taxi-job, lazy welfare immigrant.");
            gTeam[playerid] = CIVILIAN;
        }
    }
    if(newstate == PLAYER_STATE_DRIVER && gTeam[playerid] != POLICE || gTeam[playerid] != ARMY || gTeam[playerid] != FIREMEN || gTeam[playerid] != MEDIC) //
    {
        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:
            {
                if (stolecopcar[playerid] == -1)
                {
                    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
                    SendClientMessage(playerid, yellow, "** - VEHICLE CMDS: /lock (Lock the vehicle) - /cw (Send a message to the passengers in your car) - /ej (Eject a player from your vehicle) - /ejall (Eject all passengers from your vehicle)**");
                    new string[64];
                    format(string, sizeof(string), "- CRIME - Law Enforcement Vehicle Theft - Wanted Level %d ", GetPlayerWantedLevel(playerid));
                    SendClientMessage(playerid, red, string);
                    stolecopcar[playerid] = SetTimer("stolecopcar", 1000, false); // Set a timer of 1000 miliseconds (1 second)
                    for(new i=0;i<MAX_PLAYERS;i++)
                    {
                        if(!IsPlayerConnected(i))continue;
                        if(gTeam[i] == POLICE && gTeam[i] == ARMY && gTeam[i] == FIREMEN && gTeam[i] == MEDIC)
                        {
                            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)",name,playerid);
                            SendClientMessage(i, COLOR_BLUE, copmsg);
                        }
                    }
                }
                else if (stolecopcar[playerid] == 1) //wat
                {

                }
            }
            default:
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
                SendClientMessage(playerid, yellow, "** - VEHICLE CMDS: /lock (Lock the vehicle) - /cw (Send a message to the passengers in your car) - /ej (Eject a player from your vehicle) - /ejall (Eject all passengers from your vehicle)**");
                new string[64];
                format(string, sizeof(string), "*CRIME* Vehicle Theft - Wanted Level %d", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, red, string);
                }
            }
        }

    if(newstate == 2)
    {
        if(LockVeh[playerid] == true)
        {
            GameTextForPlayer(playerid, "~g~Vehicle Unlocked. Use /lock to lock it.", 5000, 5);
            SendClientMessage(playerid,yellow,"Vehicle unlocked.Use /lock to lock it.");
            LockVeh[playerid] = false;
        }
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new newcar = GetPlayerVehicleID(playerid), string[16];
        format(string, sizeof(string), "%s", GetVehicleName(newcar));
        GameTextForPlayer(playerid, string, 5000, 1);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)