SetVehicleParamsEx

From SA-MP Wiki

Jump to: navigation, search
SetVehicleParamsEx was added in SA-MP 0.3x This Function was added in SA-MP 0.3c and will not work in earlier versions!


Sets a vehicle's parameters for all players.


Parameters:
(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective)
vehicleidThe ID of the vehicle to set the parameters of.
engineToggle the engine status on or off (0/1).
lightsToggle the lights on or off (0/1).
alarmToggle the vehicle alarm on or off (0/1).
doorsToggle the lock status of the doors (0/1).
bonnetToggle the bonnet to be open or closed (0/1).
bootToggle the boot to be open or closed (0/1).
objectiveToggle the objective status for the vehicle on or off (0/1).


ReturnsThis function doesn't return a specific value


// If setting a single parameter, you should obtain the current parameters so they aren't ALL changed
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective); // ONLY the engine param was changed (to 1)
Image:32px-Ambox_warning_orange.png Notes:
  • The alarm will not reset when finished, you'll need to reset it by yourself with this function.
  • Lights also operate during the day.


Example:

new Timer_VehAlarm[MAX_VEHICLES];
SetVehicleParamsEx_Fixed(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective)
{
	SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	if(alarm){
	KillTimer(Timer_VehAlarm[vehicleid]);
	Timer_VehAlarm[vehicleid] = SetTimerEx("DisableVehicleAlarm", 20000, false, "d", vehicleid);}
}
 
forward DisableVehicleAlarm(vehicleid);
public DisableVehicleAlarm(vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, false, doors, bonnet, boot, objective);
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools
In other languages