GetVehicleName
From Liberty Unleashed Wiki
This function returns the name of the vehicle. The function can be used to retrieve the name of a specific vehicle or return the name of a model ID.
Syntax
GetVehicleName can take different lists of parameters:
string GetVehicleName( int model )
string GetVehicleName( Vehicle veh )
Arguments
- model - The model you wish to return the name for
- veh - A Vehicle instance you wish to return the name for
Example
These two example commands return the name of the vehicle from model ID or the name of the vehicle the player is currently occupying.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "vehname" ) { local iID = szText ? szText.tointeger() : VEH_LANDSTALKER; local szName = GetVehicleName( iID ); MessagePlayer( "Vehicle model id - " + iID + ", name - " + szName, pPlayer ); } else if ( szCommand == "vehname2" ) { local pVehicle = pPlayer.Vehicle; if ( pVehicle ) { local szName = GetVehicleName( pVehicle ) MessagePlayer( "Vehicle model id - " + pVehicle.Model + ", name " + szName, pPlayer ); } } return 1; }
Notes
The functions MessagePlayer, Player.Vehicle and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
Related Functions
- CreateVehicle
- FindVehicle
- GetClosestVehicle
- GetVehicleCount
- GetVehicleHandlingData
- GetVehicleIDFromName
- GetVehicleName
- SetVehicleHandlingData
- Vehicle.Alpha
- Vehicle.Angle
- Vehicle.Colour1
- Vehicle.Colour2
- Vehicle.Driver
- Vehicle.EngineDamage
- Vehicle.Explode
- Vehicle.Fix
- Vehicle.GetAddon
- Vehicle.GetPassenger
- Vehicle.GetHandlingData
- Vehicle.GetWheelStatus
- Vehicle.Health
- Vehicle.ID
- Vehicle.IdleRespawnTime
- Vehicle.IdleTime
- Vehicle.LightState
- Vehicle.Locked
- Vehicle.Model
- Vehicle.Marker
- Vehicle.OneTime
- Vehicle.PassengerCount
- Vehicle.Pos
- Vehicle.Remove
- Vehicle.Respawn
- Vehicle.RespawnTime
- Vehicle.RGBColour1
- Vehicle.RGBColour2
- Vehicle.SetHandlingData
- Vehicle.SetWheelStatus
- Vehicle.SpawnAngle
- Vehicle.SpawnPos
- Vehicle.SetAddon
- Vehicle.SetEngineState
- Vehicle.SetRadio
- Vehicle.Siren
- Vehicle.SirenLight
- Vehicle.TaxiLight
- Vehicle.Velocity
- Vehicle.VirtualWorld
- Vehicle.Wrecked