SetVehicleParamsEx

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:01, 1 July 2011
Kwarde (Talk | contribs)

← Previous diff
Revision as of 14:17, 25 September 2011
Code8976Man (Talk | contribs)

Next diff →
Line 9: Line 9:
{{Param|vehicleid|The ID of the vehicle to edit.}} {{Param|vehicleid|The ID of the vehicle to edit.}}
{{Param|engine|Toggle the engine status on or off.}} {{Param|engine|Toggle the engine status on or off.}}
-{{Param|lights|Toggle the lights on or off. (only works at night)}}+{{Param|lights|Toggle the lights on or off.}}
{{Param|alarm|Toggle the vehicle alarm on or off.}} {{Param|alarm|Toggle the vehicle alarm on or off.}}
{{Param|doors|Toggle the lock status of the doors.}} {{Param|doors|Toggle the lock status of the doors.}}
Line 26: Line 26:
{{note|The alarm will not reset itself when it's over, you'll need to reset it by yourself.}} {{note|The alarm will not reset itself when it's over, you'll need to reset it by yourself.}}
-{{note|There's been said that lights only works at night. Wrong, it also works in daylight.}}+{{note|Lights also operate during the day.}}
Example: Example:

Revision as of 14:17, 25 September 2011


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.
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: 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.

GetVehicleParamsEx
UpdateVehicleDamageStatus

Personal tools