GetVehicleID: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(6 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{server client function}} | |||
{{Deprecated|getElementModel}} | |||
This function retrieves the ID of a vehicle as an integer value. | This function retrieves the ID of a vehicle as an integer value. | ||
Line 14: | Line 17: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function planeEnter ( theVehicle, seat, jacked ) --when someone enters a vehicle | |||
id = getVehicleID ( theVehicle ) -- get the ID of the vehicle | |||
function | if id == 519 or id == 577 then --if theVehicle is one of these two planes | ||
vehiclename = getVehicleName ( theVehicle ) -- define the vehicle name | |||
if id == 519 or id == 577 then --if | outputChatBox ( "Someone stole a " .. vehiclename .. "!" ) -- announce that someone stole the plane | ||
vehiclename = getVehicleName ( | |||
outputChatBox ( "Someone stole | |||
end | end | ||
end | end | ||
-- add the event to the event handler | |||
addEventHandler ( "onPlayerEnterVehicle", root, planeEnter ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 08:39, 4 November 2020
![]() |
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. |
Please use getElementModel instead. |
This function retrieves the ID of a vehicle as an integer value.
Syntax
int getVehicleID ( vehicle theVehicle )
Required Arguments
- theVehicle: The vehicle you want to get the ID of.
Returns
Returns an integer containing the requested vehicle's ID, or false if the vehicle passed to the function is invalid.
Example
function planeEnter ( theVehicle, seat, jacked ) --when someone enters a vehicle id = getVehicleID ( theVehicle ) -- get the ID of the vehicle if id == 519 or id == 577 then --if theVehicle is one of these two planes vehiclename = getVehicleName ( theVehicle ) -- define the vehicle name outputChatBox ( "Someone stole a " .. vehiclename .. "!" ) -- announce that someone stole the plane end end -- add the event to the event handler addEventHandler ( "onPlayerEnterVehicle", root, planeEnter )
See Also
GTASA IDs (vehicles, weapons, weathers, characters, colors): http://info.vces.net/ (Special thanks to Brophy and Ratt for making these lists)
- addVehicleSirens
- getModelHandling
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehiclesOfType
- removeVehicleSirens
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setVehicleIdleRespawnDelay
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- spawnVehicle
- toggleVehicleRespawn
Shared
- 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