Scripting/Server/Functions/CreateVehicle

Creates a vehicle everyone sees. pos is a Vector; you can also pass x, y, z separately: CreateVehicle(model, x, y, z, angle, col1, col2). angle in degrees. Colours are indices into carcols.dat; pass -1, -1 for a server-chosen random pair that is the same for every player. Models are VEH_* constants (90-150) or a custom vehicle id (4000-5499).

Syntax

CreateVehicle(model, pos, angle, colour1, colour2)

Arguments

Returns

Vehicle, or null when the vehicle limit (2500) is reached.

Example

function onPlayerCommand( player, cmd, params )
{
	if ( cmd == "infernus" )
	{
		local veh = CreateVehicle( 101, player.Pos, player.Angle );   // model, position, angle
		if ( veh ) player.Vehicle = veh;
	}
}

Section: Creating world entities

Categories: Server functions | Creating world entities