SetVehicleParamsEx

From SA-MP Wiki

Revision as of 05:01, 1 July 2011; view current revision
←Older revision | Newer revision→
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 params for all players.


Parameters:
(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective)
vehicleidThe ID of the vehicle to edit.
engineToggle the engine status on or off.
lightsToggle the lights on or off. (only works at night)
alarmToggle the vehicle alarm on or off.
doorsToggle the lock status of the doors.
bonnetToggle the bonnet to be opened or closed.
bootToggle the boot to be opened or closed.
objectiveToggle the objective status for the vehicle on or off.


ReturnsThis function doesn't return a specific value


new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective);
Image:32px-Ambox_warning_orange.png Note: The alarm will not reset itself when it's over, you'll need to reset it by yourself.
Image:32px-Ambox_warning_orange.png Note: There's been said that it only works at night. Wrong, it also works in daylight.


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.

GetVehicleParamsEx
UpdateVehicleDamageStatus

Personal tools