GetVehicleSirenParams: Difference between revisions
Jump to navigation
Jump to search
Line 22: | Line 22: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua"> | This example returns the vehicle parameters when the players presses g. (Returns nil for some reason) | ||
addEventHandler("onVehicleEnter",root,function(player,seat) | <syntaxhighlight lang="lua">addEventHandler("onVehicleEnter",root,function(player,seat) | ||
if(player)and(seat==0)then | if(player)and(seat==0)then | ||
addVehicleSirens(source,1,1) | |||
addVehicleSirens( | setVehicleSirens(source,1,0,0,0,100,0,100,255,122) | ||
setVehicleSirens( | bindKey(player,"g","up",getSiren,source) | ||
bindKey(player,"g","up",getSiren, | |||
end | end | ||
end) | end) | ||
Line 34: | Line 33: | ||
function getSiren(player,button,state,vehicle) | function getSiren(player,button,state,vehicle) | ||
local sirenParams = getVehicleSirenParams(vehicle) | local sirenParams = getVehicleSirenParams(vehicle) | ||
outputChatBox("Here's the parameters of your vehicle sirens: Siren Points: ".. | outputChatBox("Here's the parameters of your vehicle sirens: Siren Points: "..tostring(sirenParams[0])..", Type of Siren: "..tostring(sirenParams[1])..".",player) | ||
end | end | ||
addEventHandler("onVehicleExit",root,function(player,seat) | addEventHandler("onVehicleExit",root,function(player,seat) | ||
if(player)and(seat==0)then | if(player)and(seat==0)then | ||
removeVehicleSirens(source) | |||
removeVehicleSirens( | |||
unbindKey(player,"g","up",getSiren) | unbindKey(player,"g","up",getSiren) | ||
end | end |
Revision as of 17:30, 20 April 2012
Syntax
table getVehicleSirenParams ( vehicle theVehicle )
Required Arguments
- theVehicle: The vehicle to get the siren parameters of
Returns
Returns a table with the siren count, siren type and a sub table for the four flags. False otherwise.
sirenParams = { sirenCount, sirenType, { is360, doLOSCheck, useRandomiser, silent } }
Example
Click to collapse [-]
ServerThis example returns the vehicle parameters when the players presses g. (Returns nil for some reason)
addEventHandler("onVehicleEnter",root,function(player,seat) if(player)and(seat==0)then addVehicleSirens(source,1,1) setVehicleSirens(source,1,0,0,0,100,0,100,255,122) bindKey(player,"g","up",getSiren,source) end end) function getSiren(player,button,state,vehicle) local sirenParams = getVehicleSirenParams(vehicle) outputChatBox("Here's the parameters of your vehicle sirens: Siren Points: "..tostring(sirenParams[0])..", Type of Siren: "..tostring(sirenParams[1])..".",player) end addEventHandler("onVehicleExit",root,function(player,seat) if(player)and(seat==0)then removeVehicleSirens(source) unbindKey(player,"g","up",getSiren) end end)
Requirements
This template will be deleted.
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