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

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.

Section: Vehicle

Categories: Server methods | Vehicle