Scripting/Server/Classes/Vehicle/SetComponentStatus

(v0.3.3-r2+) Set / read the damage state of one body part, synced to every player. type: COMPONENT_PANEL (index PANEL_FRONT_LEFT 0, FRONT_RIGHT 1, REAR_LEFT 2, REAR_RIGHT 3, WINDSCREEN 4, BUMPER_FRONT 5, BUMPER_REAR 6), COMPONENT_DOOR (DOOR_BONNET 0, BOOT 1, FRONT_LEFT 2, FRONT_RIGHT 3, REAR_LEFT 4, REAR_RIGHT 5), COMPONENT_LIGHT (LIGHT_FRONT_LEFT 0, FRONT_RIGHT 1, REAR_LEFT 2, REAR_RIGHT 3), COMPONENT_WHEEL (index = WHEEL_*, same as SetWheelStatus), COMPONENT_ENGINE (index 0, status 0-255: 100 steam, 200 smoke, 225 on fire). status: COMPSTATUS_OK 0, COMPSTATUS_DAMAGED 1 (the dented model), COMPSTATUS_SWINGING 2 (door hanging on its hinge), COMPSTATUS_MISSING 3 (torn off); lights: 0 ok, 1 broken. GetComponentStatus reports what the car that syncs the vehicle last reported (0 until a client has synced it). vehicle.Fix() repairs everything. Plain cars only.

Syntax

vehicle.SetComponentStatus(type, index, status)
vehicle.GetComponentStatus(type, index)

Arguments

Example

function onPlayerCommand( player, cmd, params )
{
	if ( cmd == "setcomponentstatus" )
	{
		local veh = player.Vehicle;
		if ( !veh ) return MessagePlayer( "Sit in a vehicle first.", player );
		veh.SetComponentStatus( 0, 0, 0 );
	}
}

This sample was generated from the signature – adapt the values to your gamemode.

Section: Vehicle

Categories: Server methods | Vehicle