Scripting/Server/Classes/Vehicle/SetComponentAngle
(v0.5.3+) Opens or closes the bonnet, the boot or a door: part VPART_BONNET, VPART_BOOT, VPART_DOOR_FRONT_LEFT / FRONT_RIGHT / REAR_LEFT / REAR_RIGHT; angle 0.0 = closed to 1.0 = fully open (the share of that door's own swing, so 0.5 is half open on every car). Every player sees it, also players who join or drive up later; the open / close sound plays. Pass null or a negative angle to give the door back to the game (it stays where it is until a ped uses it). A torn-off door is skipped. Other parts throw an error. Plain cars only.
Syntax
vehicle.SetComponentAngle(part, angle)vehicle.GetComponentAngle(part)Arguments
- int part – (v0.5.3+) Opens or closes the bonnet, the boot or a door:
partVPART_BONNET, VPART_BOOT, VPART_DOOR_FRONT_LEFT / FRONT_RIGHT / REAR_LEFT / REAR_RIGHT;angle0.0 = closed to 1.0 = fully open (the share of that door's own swing, so 0.5 is half open on every car). - float angle – (v0.5.3+) Opens or closes the bonnet, the boot or a door:
partVPART_BONNET, VPART_BOOT, VPART_DOOR_FRONT_LEFT / FRONT_RIGHT / REAR_LEFT / REAR_RIGHT;angle0.0 = closed to 1.0 = fully open (the share of that door's own swing, so 0.5 is half open on every car).
Returns
angle (Get)
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "setcomponentangle" )
{
local veh = player.Vehicle;
if ( !veh ) return MessagePlayer( "Sit in a vehicle first.", player );
local result = veh.SetComponentAngle( 0, player.Angle );
MessagePlayer( "vehicle.SetComponentAngle returned: " + result, player );
}
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
- vehicle.Remove
- vehicle.Respawn
- vehicle.Fix
- vehicle.Explode
- vehicle.SetBurstableTyres
- player.AttachTo
- object.AttachTo
- object.AttachToBone
- vehicle.SetComponentStatus
- vehicle.SetComponentStatus
- vehicle.SetComponentColour
- vehicle.TurretRotation
Section: Vehicle
Categories: Server methods | Vehicle