GetVehiclePlateText: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
m (Shortened example var. 'localPlayerOccupiedVehicle' -> 'vehicle') |
||
Line 21: | Line 21: | ||
if isPedInVehicle(localPlayer) then --let's check if they're in a vehicle | if isPedInVehicle(localPlayer) then --let's check if they're in a vehicle | ||
-- if they are in a vehicle | -- if they are in a vehicle | ||
local | local vehicle = getPedOccupiedVehicle ( localPlayer ) --let's get the vehicle | ||
local plateText = getVehiclePlateText ( | local plateText = getVehiclePlateText ( vehicle ) --get the license plate text | ||
if plateText then -- if there was a license plate, | if plateText then -- if there was a license plate, | ||
outputChatBox ( "Your license plate is: " .. plateText )-- output it to the chatbox | outputChatBox ( "Your license plate is: " .. plateText )-- output it to the chatbox |
Revision as of 20:00, 20 October 2013
This function is used to retrieve the text on the number plate of a specified vehicle.
Syntax
string getVehiclePlateText ( vehicle theVehicle )
Required Arguments
- theVehicle: The vehicle that you wish to retrieve the plate text from.
Returns
Returns a string that corresponds to the plate on the text, false if a bad argument was passed or if the vehicle is not a car.
Example
Click to collapse [-]
ExampleThis example outputs the text on the license plate of the vehicle the player is driving to the chatbox.
function outputLicensePlate ( command ) if isPedInVehicle(localPlayer) then --let's check if they're in a vehicle -- if they are in a vehicle local vehicle = getPedOccupiedVehicle ( localPlayer ) --let's get the vehicle local plateText = getVehiclePlateText ( vehicle ) --get the license plate text if plateText then -- if there was a license plate, outputChatBox ( "Your license plate is: " .. plateText )-- output it to the chatbox else outputChatBox ( "Your vehicle has no license plate." ) end else outputChatBox ( "You're not in a vehicle." ) end end -- add our function as a handler to the "plate" command addCommandHandler( "plate", outputLicensePlate )
See 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