Scripting/Squirrel/Functions/Vehicles/Fix

From VC-MP Wiki

Jump to: navigation, search

NOTE: This function has been added in VC:MP 0.3z r2. It will not work in previous versions.


This function will fix the visual damage of the vehicle and restore the vehicle health.

Syntax

bool vehicle.Fix()

Arguments

  • none

Example

This command will fix your vehicle when you do "/c fix"

function onPlayerCommand( player, cmd, text )
	if ( cmd == "fix" )
	{
		local veh = player.Vehicle;
		 
                if ( veh ) {
 
                MessagePlayer( "Your vehicle has been fixed.", player );
                veh.Fix();
                }
 
                else MessagePlayer( "You must be in the vehicle you want to fix.", player );
	}
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
squirrel scripting