OnPlayerEnterVehicle bug
#1

If someone enters a vehicle and turn on the engine, whenever that player exit and enters the vehicle again the engine automaticlly stops but you still need to turn off the engine before you can turn it on again!?
How can I fix that??
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[128];
    new vehicle[24];
    GetVehicleName(vehicleid, vehicle, sizeof(vehicle));
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(Spectate[i] == playerid)
            {
                PlayerSpectateVehicle(i,vehicleid);
            }
        }
    }
    if(CarInfo[vehicleid][cLock] == 1)
    {
        new engine,lights,alarm,bonnet,boot,objective;
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
    }
    else if(CarInfo[vehicleid][cLock] == 0)
    {
        new engine,lights,alarm,bonnet,boot,objective;
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
    }
    if(IsAnOwnableCar(vehicleid))
    {
        format(string,sizeof(string),"You are entering to a %s (%d)  Private Vehicle, Owner: %s",vehicle, vehicleid, CarInfo[vehicleid][cOwner]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    else if(IsASalesVehicle(vehicleid))
    {
        format(string,sizeof(string),"You are entering to a %s (%d)  Sales Vehicle, Owner: Dealership",vehicle, vehicleid);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string,sizeof(string),"Type /v buy to buy this car for $%d",CarInfo[vehicleid][cPrice]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    else
    {
        if(IsAGangCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Ballas Gang",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar2(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Grove Street Family",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar3(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Yamaguchi Mafia",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar4(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d) Faction Vehicle, Owner: Corleone Mafia",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar5(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: The Mob",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar6(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Sons of Anarchy Gang",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGangCar7(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Hitmen Organization",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsACopCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Police",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAGovernmentCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Government",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAnFbiCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: FBI",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsNgCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: National Guard",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsASwatCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: S.W.A.T",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsATacticalCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Tactical Team",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsASpecialFCar(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: Special Forces",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAMS13Car(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: MS13 Gang",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else if(IsAnAmbulance(vehicleid))
        {
            format(string,sizeof(string),"You are entering to a %s (%d)  Faction Vehicle, Owner: LSMD",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
        else
        {
            format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Event Car",vehicle, vehicleid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        }
    }
    if(Gps[playerid] == 1)
    {
        TextDrawShowForPlayer(playerid, Textdraw53[playerid]);
    }
    if(gTeam[playerid] >= 1||gTeam[playerid] >= 3||gTeam[playerid] >= 4)
    {
        if (GetVehicleModel(vehicleid) == 520) // Hydra
        {
            if(IsACop(playerid) && PlayerInfo[playerid][pHydraR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
            else {  SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
        }
        if (GetVehicleModel(vehicleid) == 425) // Hunter
        {
            if(IsACop(playerid) && PlayerInfo[playerid][pHunterR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
            else {  SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
        }
        if (GetVehicleModel(vehicleid) == 432) // Rhino
        {
            if(IsACop(playerid) && PlayerInfo[playerid][pRhinoR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
            else {  SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
        }
        if (GetVehicleModel(vehicleid) == 430) // Predator
        {
            if(IsACop(playerid) && PlayerInfo[playerid][pPredR] >= 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1) { }
            else {  SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Only Special Force Units With Proper Training May use This!!"); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z); }
        }
    }
    engineOn[GetPlayerVehicleID(playerid)] = false;
    return 1;
}
Reply
#2

pawn Код:
engineOn[GetPlayerVehicleID(playerid)] = false;
try using
pawn Код:
engineOn[vehicleid] = false;
And if this doesn't work send us code from OnPlayerStateChange()
Reply
#3

It didn't work. Here is OnPlayerStateChange
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(Spectate[i] == playerid)
            {
                PlayerSpectatePlayer(i, playerid);
            }
        }
    }
    if (newstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, 0);
    }
    new string[128];
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    new vehicle = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
    {
        SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
        SetTimerEx("engine2", 2500, false, "i", playerid);
    }
    else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
    {
        SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
        SetTimerEx("engine2", 2500, false, "i", playerid);
    }
    if(newstate == PLAYER_STATE_DRIVER && (pveh == 420 || pveh == 438))
    {
        SetRealMoney(playerid, ScriptMoney[playerid]);
    }
    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
    {
        ScriptWeaponsUpdated[playerid] = 1;
        SetTimerEx("UpdateWeapons",500,false,"i",playerid);
    }
    if(newstate == PLAYER_STATE_ONFOOT)
    {
        TogglePlayerControllable(playerid, 1);
        if(PlayerInfo[playerid][pAdminDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Admin On Duty \n Do NOT Attack",0xFF000099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
        else if(PlayerInfo[playerid][pTesterDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Tester On Duty \n Do NOT Attack",0x00AA0099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
        if(TransportDuty[playerid] > 0)
        {
            if(TransportDuty[playerid] == 1)
            {
                TaxiDrivers -= 1;
            }
            else if(TransportDuty[playerid] == 2)
            {
                BusDrivers -= 1;
            }
            TransportDuty[playerid] = 0;
            format(string, sizeof(string), "* You are now Off Duty and earned $%d.", TransportMoney[playerid]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            SafeGivePlayerMoney(playerid, TransportMoney[playerid]);
            /*ConsumingMoney[playerid] = 1;*/
            TransportValue[playerid] = 0;
            TransportMoney[playerid] = 0;
            SetPlayerToTeamColor(playerid);
        }
        if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
        {
            if(IsPlayerConnected(TransportDriver[playerid]))
            {
                TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
                TransportTime[TransportDriver[playerid]] = 0;
                TransportCost[TransportDriver[playerid]] = 0;
                format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
                GameTextForPlayer(playerid, string, 5000, 1);
                format(string, sizeof(string), "~w~Passenger left the taxi~n~~g~Earned $%d",TransportCost[playerid]);
                GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
                SafeGivePlayerMoney(playerid, -TransportCost[playerid]);
                TransportCost[playerid] = 0;
                TransportTime[playerid] = 0;
                TransportDriver[playerid] = 999;
            }
        }
        TelePos[playerid][0] = 0.0;
        TelePos[playerid][1] = 0.0;
    }
    if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        new vehicleid = GetPlayerVehicleID(playerid);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
                {
                    if(GetPlayerMoney(playerid) < TransportValue[i])
                    {
                        format(string, sizeof(string), "* You need $%d to enter.", TransportValue[i]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        SafeRemovePlayerFromVehicle(playerid);
                    }
                    else
                    {
                        if(TransportDuty[i] == 1)
                        {
                            format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* Passenger %s has entered your Taxi.", name);
                            SendClientMessage(i, COLOR_WHITE, string);
                            TransportTime[i] = 1;
                            TransportTime[playerid] = 1;
                            TransportCost[playerid] = TransportValue[i];
                            TransportCost[i] = TransportValue[i];
                            TransportDriver[playerid] = i;
                        }
                        else if(TransportDuty[i] == 2)
                        {
                            format(string, sizeof(string), "* You paid $%d to the Bus Driver.", TransportValue[i]);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* Passenger %s has entered your Bus.", name);
                            SendClientMessage(i, COLOR_WHITE, string);
                        }
                        SafeGivePlayerMoney(playerid, - TransportValue[i]);
                        TransportMoney[i] += TransportValue[i];
                    }
                }
            }
        }
        if(PlayerInfo[playerid][pAdminDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Admin On Duty \n Do NOT Attack",0xFF000099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
        else if(PlayerInfo[playerid][pTesterDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Tester On Duty \n Do NOT Attack",0x00AA0099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {// 38 / 49 / 56 = SS
        new newcar = GetPlayerVehicleID(playerid);
        TelePos[playerid][0] = 0.0;
        TelePos[playerid][1] = 0.0;
        TextDrawShowForPlayer(playerid, Textdraw39[playerid]);
        TextDrawShowForPlayer(playerid, Textdraw40[playerid]);
        if(PlayerInfo[playerid][pAdminDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Admin On Duty \n Do NOT Attack",0xFF000099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
        else if(PlayerInfo[playerid][pTesterDuty] == 1)
        {
            Delete3DTextLabel(DutyLabel[playerid]);
            DutyLabel[playerid] = Create3DTextLabel("Tester On Duty \n Do NOT Attack",0x00AA0099,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        }
        if(IsASalesVehicle(newcar))
        {
            TogglePlayerControllable(playerid, 1);
            GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~Welcome, type ~b~/v buy ~w~to buy this car, or ~b~/exit~w~ if you don't wanna buy it!",10000,4);
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Sales Car");
        }
        else
        {
            if(PlayerInfo[playerid][pCarLic] < 0)
            {
                if(GetPlayerDrunkLevel(playerid) >= 6000)
                {
                    WantedPoints[playerid] += 1;
                    SetPlayerCriminal(playerid,255, "Drunk Driving");
                }

            }
            else if(GetPlayerDrunkLevel(playerid) >= 6000)
            {
                WantedPoints[playerid] += 1;
                SetPlayerCriminal(playerid,255, "Drunk Driving");
            }
        }
        if(IsModelABoat(newcar))
        {
            if(PlayerInfo[playerid][pBoatLic] < 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "* You don't know how to Sail yet, so you left the Boat !");
                SafeRemovePlayerFromVehicle(playerid);
                TogglePlayerControllable(playerid, 1);
            }
        }
        else if(IsModelAPlane(newcar) || IsModelAHeli(newcar))
        {
            if(PlayerInfo[playerid][pFlyLic] < 1)
            {
                if(TakingLesson[playerid] == 1) { }
                else {
                SendClientMessage(playerid, COLOR_GREY, "* You don't know how to Fly yet, so you left the Plane !");
                SafeRemovePlayerFromVehicle(playerid);
                TogglePlayerControllable(playerid, 1); }
            }
        }
        else
        {
            if(PlayerInfo[playerid][pCarLic] == 0)
            {
                if(TakingLesson[playerid] == 0)
                {

                    SendClientMessage(playerid, COLOR_YELLOW, "   You Don't have a Drivers License yet! so drive carefully or the cops will notice.");
                }
            }
        }
        if(IsAnOwnableCar(newcar))
        {
            if(PlayerInfo[playerid][pPcarkey] == newcar) { CanTurnEngine[playerid] = newcar; }
            else if(PlayerInfo[playerid][pPcarkey2] == newcar) { CanTurnEngine[playerid] = newcar; }
            else if(PlayerInfo[playerid][pPcarkey3] == newcar) { CanTurnEngine[playerid] = newcar; }
            else
            {
                if(PlayerInfo[playerid][pAdmin] >= 5 && PlayerInfo[playerid][pAdminDuty] == 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "  You can drive this car because you are admin on duty !");
                }
                else
                {
                    CanTurnEngine[playerid] = 9999;
                    TogglePlayerControllable(playerid, 1);
                }
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Ownable Car");
        }
        else if(IsAnAmbulance(newcar))
        {
            if(PlayerInfo[playerid][pMember]== 4 && JobDuty[playerid] == 1 || PlayerInfo[playerid][pLeader]== 4 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Ambulance");
        }
        else if(IsACopCar(newcar))
        {
            if(IsAFreecop(playerid) && PlayerInfo[playerid][pDuty] == 1 || PlayerInfo[playerid][pMember]== 1 && PlayerInfo[playerid][pDuty] == 1 || PlayerInfo[playerid][pLeader]== 1 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Cop Car");
        }
        else if(IsAMS13Car(newcar))
        {
            if(PlayerInfo[playerid][pMember]== 12 && JobDuty[playerid] == 1 || PlayerInfo[playerid][pLeader]== 12 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: MS13 Car");
        }
        else if(IsAnFbiCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]== 2 && PlayerInfo[playerid][pDuty] == 1 || PlayerInfo[playerid][pLeader]== 2 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: FBI Car");
        }
        else if(IsNgCar(newcar))
        {
            if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDuty] == 1 || PlayerInfo[playerid][pLeader]== 3 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6)
            {
                CanTurnEngine[playerid] = newcar;
            }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: NG Car");
        }
        else if(IsASwatCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]== 1 && PlayerInfo[playerid][pDuty] == 1 && PlayerInfo[playerid][pSwat]>= 1 || PlayerInfo[playerid][pLeader]== 1 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessage(playerid, COLOR_LIGHT_BLUE,"[DEBUG]: SWAT Car");
        }
        else if(IsATacticalCar(newcar))
        {
            if(PlayerInfo[playerid][pMember]== 2 && PlayerInfo[playerid][pDuty] == 1 && PlayerInfo[playerid][pTactical] >= 1 || PlayerInfo[playerid][pLeader]== 2 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Tactical Car");
        }
        else if(IsASpecialFCar(newcar))
        {
            if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDuty] == 1 && PlayerInfo[playerid][pSpecialF] >= 1 || PlayerInfo[playerid][pLeader]== 3 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: SpecialF Car");
        }
        else if(IsAGovernmentCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 7||PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Government Car");
        }
        else if(IsAGangCar(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 5||PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Surenos Car");
        }
        else if(IsAGangCar2(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 6||PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Signatra Car");
        }
        else if(IsAGangCar3(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 14||PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Yamaguchi Car");
        }
        else if(IsAGangCar4(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 15||PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Corleone car");
        }
        else if(IsAGangCar5(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 16||PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Vice Car");
        }
        else if(IsAGangCar6(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 13||PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Anarchy Car");
        }
        else if(IsAGangCar7(newcar))
        {
            if(PlayerInfo[playerid][pLeader] == 8 ||PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else
            {
                CanTurnEngine[playerid] = 9999;
                TogglePlayerControllable(playerid, 1);
                SafeRemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
            }
            if(cDebug == 1) SendClientMessageToAll(COLOR_LIGHT_BLUE,"[DEBUG]: Hitmen Car");
        }
        else if(IsAPizzabike(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
            else {
            CanTurnEngine[playerid] = 9999;
            SafeRemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this bike.");}
        }
        else if(IsABus(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 14 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6)
            {
                GameTextForPlayer(playerid, "~w~Use /starteast or /startwest to begin your bus route", 5000, 3);
                SendClientMessage(playerid, COLOR_YELLOW2, "You have entered a bus, type /exit to cancel route selection.");
                SendClientMessage(playerid, COLOR_YELLOW2, "To start doing the west route, use /startwest. To start doing the east route, use /starteast.");
                new routezonecheck = IsInBusrouteZone(playerid);
                if (routezonecheck == 0) SendClientMessage(playerid, COLOR_YELLOW, "Note: Your nearest route is east.");
                else if (routezonecheck == 1) SendClientMessage(playerid, COLOR_YELLOW, "Note: Your nearest route is west.");
                TogglePlayerControllable(playerid, 0);
                CanTurnEngine[playerid] = newcar;
            }
        }
        else if(IsATruck(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 16)
            {
                format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
                SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                SendClientMessage(playerid, COLOR_WHITE, "INFO: You can deliver Products to Businesses.");
                SendClientMessage(playerid, COLOR_WHITE, "INFO: Commands are /load /buyprods /sellprods");
            }
            CanTurnEngine[playerid] = newcar;
        }
        else if(IsASweeper(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 21)
            {
                if(PlayerIsSweeping[playerid] == 0)
                {
                    TogglePlayerControllable(playerid, 0);
                    GameTextForPlayer(playerid, "~g~/startsweep ~w~ to start sweeping~n~Type ~r~/exit ~w~to leave the sweeper", 5000, 3);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "You can stop sweeping by typing /stopsweep .");
                }
            }
            CanTurnEngine[playerid] = newcar;
        }
        else if(IsARentableVeh(newcar))
        {
            if (HireCar[playerid] != newcar)
            {
                format(string, sizeof(string), "~w~You can Rent this bike~n~Cost:~g~$%d~n~~w~To rent type ~g~/Rentveh~w~~n~to get out type ~r~/exit",SBizzInfo[0][sbEntranceCost]);
                TogglePlayerControllable(playerid, 0);
                GameTextForPlayer(playerid, string, 5000, 3);
                CanTurnEngine[playerid] = 9999;
            }
            else
            {
                CanTurnEngine[playerid] = newcar;
            }
        }
        else if(IsAHarvest(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 18)
            {
                if(FarmerVar[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_RED, "___________Farmer guide___________");
                    SendClientMessage(playerid, COLOR_WHITE, "** Farmer ** /startharvest, /stopharvest or /exit");
                    SendClientMessage(playerid, COLOR_RED, "__________________________________");
                    TogglePlayerControllable(playerid, 0);
                }
                else { }
            }
            CanTurnEngine[playerid] = newcar;
        }
        else if(IsADrugHarvest(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 19)
            {
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "____________Drug farmer guide____________");
                SendClientMessage(playerid, COLOR_WHITE, "** Drug farmer ** /startdrugharvest, /stopdrugharvest or /exit");
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "_________________________________________");
                TogglePlayerControllable(playerid, 0);
            }
            CanTurnEngine[playerid] = newcar;
        }
        else if(IsASmuggleCar(newcar))
        {
            if(PlayerInfo[playerid][pJob] == 20)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "HINT: You can smuggle drugs now !");
            }
            CanTurnEngine[playerid] = newcar;
        }
        else
        {
            CanTurnEngine[playerid] = newcar;
        }

        gLastCar[playerid] = newcar;
        gLastDriver[newcar] = playerid;
    }
    return 1;
}
Reply
#4

I just noticed that this happens everytime someone enters a vehicle. No matter if it's the driver or passenger
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)