04.12.2015, 12:25
When I am ingame my vehicle doesn't turn on the engine, as showed in the script. I tried digging into the problem, and I found where it's coming from.
Main Script:
Lines that don't work:
Somwhow the problem is that GetVehicleParamsEx doesn't save the engine status (0/1) to the 'engine' variable. I can't figure out why. Any suggestions? Thanks.
Main Script:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_SUBMISSION) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vehicle; vehicle = GetPlayerVehicleID(playerid); new lights, alarms, doors, bonnet, boot, objective; new engine; GetVehicleParamsEx(vehicle, engine, lights, alarms, doors, bonnet, boot, objective); if(engine == 0)//If the engine is off { SetVehicleParamsEx(vehicle, 1, lights, alarms, doors, bonnet, boot, objective); } if(engine == 1) { SetVehicleParamsEx(vehicle, 0, lights, alarms, doors, bonnet, boot, objective); } } } return 1; }
Lines that don't work:
Код:
new lights, alarms, doors, bonnet, boot, objective; new engine; GetVehicleParamsEx(vehicle, engine, lights, alarms, doors, bonnet, boot, objective); if(engine == 0)//If the engine is off { SetVehicleParamsEx(vehicle, 1, lights, alarms, doors, bonnet, boot, objective); }