all vehicles off default help
#1

how do I make all my vehicles off when i enter a vehicle

here is my /engine code:

pawn Код:
cmd(engine, playerid, params[]) // Engine on/off
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(engine == VEHICLE_PARAMS_ON)
        {
            SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOR_CYAN, "[VEHICLE] You have turned off your vehicle");
            return 1;
        }
        SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
        SendClientMessage(playerid, COLOR_CYAN, "[VEHICLE] You have turned on your vehicle");
        return 1;
    }
    return SendClientMessage(playerid, COLOR_ERROR, "You must be in a vehicle to use this command.");
}
but when i enter vehicle it is already automatically on. i want it automatically off. how?
Reply
#2

something like this in OnGameModeInit()
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
   
for(new i=1;i!=MAX_VEHICLES;i++)
{
    GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(i, 0, lights, alarm, doors, bonnet, boot, objective);
}

edit sorry actually you should do

pawn Код:
public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
}
either will work but the second is better i think,
but will cause the lights to need a command also.
Reply
#3

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
something like this in OnGameModeInit()
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
   
for(new i=1;i!=MAX_VEHICLES;i++)
{
    GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(i, 0, lights, alarm, doors, bonnet, boot, objective);
}

edit sorry actually you should do

pawn Код:
public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
}
either will work but the second is better i think,
but will cause the lights to need a command also.
both work perfect! thx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)