new bool: VehicleLightsOn[MAX_VEHICLES];
if (PRESSED(KEY_ACTION))
{
if(IsPlayerInAnyVehicle(playerid))
{
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == false)
{
new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
VehicleLightsOn[vid] = true;
}
else
{
new engine, lights, alarm, doors, bonnet, boot, objective, vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
VehicleLightsOn[vid] = false;
}
}
}
}
else
else if (VehicleLightsOn[GetPlayerVehicleID(playerid)] == true)
You need to declare the variable 'VehicleLightsOn' as global(out of the callback).
|
There is no problem in this part of code, maybe something is causing conflict or changing the EngineStatus value.
|
TogglePlayerControllable(playerid,0);