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
- int model
- Vector pos –
posis aVector; you can also passx, y, zseparately:CreateVehicle(model, x, y, z, angle, col1, col2). - float angle –
anglein degrees. - int colour1
- int colour2
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;
}
}Related pages
- CreateObject
- CreatePickup
- CreateWeaponPickup
- CreateSphere
- CreateClientSphere
- CreateCheckpoint
- CreateClientCheckpoint
- FindCheckpoint
- GetCheckpointCount
- CreateBlip
- CreateClientBlip
- GangZoneCreate
Section: Creating world entities
Categories: Server functions | Creating world entities