GetVehicleModelFromName: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{server client function}} This function retrieves the model ID of a vehicle as an integer value from its name. ==Syntax== <syntaxhighlight lang="lua"> int getVehicleModelFromName ( stri...) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{server client function}} | {{server client function}} | ||
This function retrieves the model ID of a vehicle as an [[ | This function retrieves the model ID of a vehicle as an [[int]]eger value from its name. | ||
==Syntax== | ==Syntax== | ||
Line 7: | Line 7: | ||
int getVehicleModelFromName ( string name ) | int getVehicleModelFromName ( string name ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP|This function is a static function underneath the Vehicle class.|[[Vehicle]].getModelFromName}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''name:''' A [[string]] containing the name of the vehicle. | *'''name:''' A [[string]] containing the name of the vehicle. | ||
{{All Vehicle Types}} | |||
===Returns=== | ===Returns=== | ||
Line 16: | Line 17: | ||
==Example== | ==Example== | ||
<section class="server" name="Server"> | |||
This will allow the player to create a vehicle by name and it's model ID will be displayed in the chatbox when the vehicle is spawned. | This will allow the player to create a vehicle by name and it's model ID will be displayed in the chatbox when the vehicle is spawned. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 40: | Line 42: | ||
addCommandHandler ( "spawnvehicle", createVehicleCommand ) | addCommandHandler ( "spawnvehicle", createVehicleCommand ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 19:53, 26 May 2017
This function retrieves the model ID of a vehicle as an integer value from its name.
Syntax
int getVehicleModelFromName ( string name )
OOP Syntax Help! I don't understand this!
- Note: This function is a static function underneath the Vehicle class.
- Method: Vehicle.getModelFromName(...)
Required Arguments
- name: A string containing the name of the vehicle.
- at-400
- admiral
- alpha
- ambulance
- andromada
- bf injection
- bf-400
- bmx
- baggage
- baggage trailer (uncovered)
- baggage trailer (covered)
- bandito
- banshee
- barracks
- beagle
- benson
- berkley's rc van
- bike
- blade
- blista compact
- bloodring banger
- bobcat
- box freight
- boxville
- boxville mission
- bravura
- broadway
- buccaneer
- buffalo
- bullet
- burrito
- bus
- cabbie
- caddy
- cadrona
- camper
- cargobob
- cement truck
- cheetah
- clover
- club
- coach
- coastguard
- combine harvester
- comet
- cropduster
- dft-30
- dinghy
- dodo
- dozer
- dumper
- dune
- elegant
- elegy
- emperor
- enforcer
- esperanto
- euros
- fbi rancher
- fbi truck
- fcr-900
- faggio
- farm trailer
- feltzer
- fire truck
- fire truck ladder
- flash
- flatbed
- forklift
- fortune
- freeway
- freight
- freight train flatbed
- glendale
- glendale damaged
- greenwood
- hpv1000
- hermes
- hotdog
- hotknife
- hotring racer
- hotring racer 2
- hotring racer 3
- hunter
- huntley
- hustler
- hydra
- infernus
- intruder
- jester
- jetmax
- journey
- kart
- landstalker
- launch
- leviathan
- linerunner
- majestic
- manana
- marquis
- maverick
- merit
- mesa
- monster 1
- monster 2
- monster 3
- moonbeam
- mountain bike
- mower
- mr. whoopee
- mule
- nrg-500
- nebula
- nevada
- news chopper
- newsvan
- oceanic
- pcj-600
- packer
- patriot
- perennial
- phoenix
- picador
- pizzaboy
- police ls
- police lv
- police maverick
- police ranger
- police sf
- pony
- predator
- premier
- previon
- primo
- quadbike
- rc bandit
- rc baron
- rc cam
- rc goblin
- rc raider
- rc tiger
- raindance
- rancher
- rancher lure
- reefer
- regina
- remington
- rhino
- roadtrain
- romero
- rumpo
- rustler
- s.w.a.t.
- sabre
- sadler
- sadler damaged
- sanchez
- sandking
- savanna
- seasparrow
- securicar
- sentinel
- shamal
- skimmer
- slamvan
- solair
- sparrow
- speeder
- squalo
- stafford
- stallion
- stratum
- streak
- streak train trailer
- street clean trailer
- stretch
- stuntplane
- sultan
- sunrise
- super gt
- sweeper
- tahoma
- tampa
- tanker
- taxi
- tornado
- towtruck
- tractor
- trailer (stairs)
- trailer (tanker commando)
- trailer 1
- trailer 2
- trailer 3
- tram
- trashmaster
- tropic
- tug
- turismo
- uranus
- utility van
- vincent
- virgo
- voodoo
- vortex
- walton
- washington
- wayfarer
- willard
- windsor
- yankee
- yosemite
- zr-350
Returns
Returns an integer if the name exists, false otherwise. If you use this function on vehicles with shared names, such as "police", it will return the earliest occurrence of that vehicle's ID.
Example
Click to expand [+]
ServerSee Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates