GetVehiclePlateText: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Improved example, fixed sections, minor changes) |
||
Line 1: | Line 1: | ||
{{Needs Checking|This function doesn't work, mantis #2457 --[[User:Norby89|Norby89]] 13:47, 26 August 2007 (CDT)}} | {{Needs Checking|This function doesn't work, mantis #2457 --[[User:Norby89|Norby89]] 13:47, 26 August 2007 (CDT)}} | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function is used to retrieve the text on the number plate of a specified vehicle. | This function is used to retrieve the text on the number plate of a specified vehicle. | ||
==Syntax== | ==Syntax== | ||
<section name="Server and Client" class="both" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string getVehiclePlateText ( vehicle theVehicle ) | string getVehiclePlateText ( vehicle theVehicle ) | ||
Line 10: | Line 11: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle:''' | *'''theVehicle:''' The [[vehicle]] that you wish to retrieve the plate text from. | ||
===Returns=== | ===Returns=== | ||
Returns a ''string'' that | 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. | ||
</section> | |||
==Example== | ==Example== | ||
<section name=" | <section name="Example" class="client" show="true"> | ||
This example outputs the text on the license plate of the vehicle the player is driving to the chatbox. | This example outputs the text on the license plate of the vehicle the player is driving to the chatbox. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function outputLicensePlate ( command ) | ||
local | -- get the vehicle the local player is in | ||
local | local localPlayerOccupiedVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() ) | ||
-- if he is in a vehicle, | |||
if localPlayerOccupiedVehicle then | |||
-- get the license plate text | |||
local plateText = getVehiclePlateText ( localPlayerOccupiedVehicle ) | |||
-- if there was a license plate, | |||
if plateText then | |||
-- output it to the chatbox | |||
outputChatBox ( "Your license plate is: " .. plateText ) | |||
else | |||
outputChatBox ( "Your vehicle has no license plate." ) | |||
end | |||
else | |||
outputChatBox ( "You're not in a vehicle." ) | |||
end | end | ||
end | end | ||
addCommandHandler( "plate", | -- add our function as a handler to the "plate" command | ||
addCommandHandler( "plate", outputLicensePlate ) | |||
</syntaxhighlight> | |||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 20:19, 26 August 2007
This article needs checking. | |
Reason(s): This function doesn't work, mantis #2457 --Norby89 13:47, 26 August 2007 (CDT) |
This function is used to retrieve the text on the number plate of a specified vehicle.
Syntax
Click to collapse [-]
Server and Clientstring 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 ) -- get the vehicle the local player is in local localPlayerOccupiedVehicle = getPlayerOccupiedVehicle ( getLocalPlayer() ) -- if he is in a vehicle, if localPlayerOccupiedVehicle then -- get the license plate text local plateText = getVehiclePlateText ( localPlayerOccupiedVehicle ) -- if there was a license plate, if plateText then -- output it to the chatbox outputChatBox ( "Your license plate is: " .. plateText ) 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