Scripting/Squirrel/Functions/Vehicle.SetTyre

From Vice City Multiplayer
Jump to navigation Jump to search

This function will set vehicle's tyres state individually !

Syntax

vehicle.SetTyre( tyre, state )

Arguments

  • int tyre - The tyre/wheel you want to set
  • int state - The state you want to set

Configs

Tyres
0 - 2	front tyres
1 - 3	rear tyres

State
0 - good tyre
1 - exploded tyre
2 - lost tyre

Example

function onPlayerCommand(player, cmd, text)
{
	if(cmd == "noback")
	{ 
		if( !player.Vehicle ) return MessagePlayer( "You must be in a vehicle!", player );

		local veh = player.Vehicle;
		veh.SetTyre( 2, 2 );
		veh.SetTyre( 3, 2 );
		MessagePlayer( "Ooops! No rear wheels anymore ?!", player );
	}
	return 1;
}

Notes

  • Custom vehicles which follow SanAndreas's .dff way won't lose their wheels.
  • SA is using only one wheel to set up all 4 wheels, while VC needs a wheel for each spot even in the .dff.
  • (for pictures, check no.4 in this post: https://forum.vc-mp.org/?topic=6748.0 )

Function MessagePlayer was used in this example. More info about them in the corresponding page.

Related Functions