SetVehicleSirens: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
|||
(11 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
{{New feature/item| | {{New feature/item|3.0130|1.3.0|3968| | ||
This function changes the properties of a vehicles siren point. | This function changes the properties of a vehicles siren point. | ||
}} | }} | ||
{{Note|Although you may be able to add sirens to any vehice, this function may not work. This function fails on certain vehicle models (https://wiki.multitheftauto.com/wiki/Vehicle_IDs#Lua_table_of_vehicles_that_doesn.27t_support_siren_lights).}} | |||
==Syntax== | ==Syntax== | ||
Line 9: | Line 10: | ||
bool setVehicleSirens ( vehicle theVehicle, int sirenPoint, float posX, float posY, float posZ, float red, float green, float blue, [float alpha = 255, float minAlpha = 0.0] ) | bool setVehicleSirens ( vehicle theVehicle, int sirenPoint, float posX, float posY, float posZ, float red, float green, float blue, [float alpha = 255, float minAlpha = 0.0] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:setSirens||getVehicleSirens}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle:''' The vehicle to modify | *'''theVehicle:''' The vehicle to modify | ||
Line 29: | Line 30: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
This example adds a siren for the vehicle, then sets two custom sirens at the top of the vehicle. And then removes the siren when getting out the vehicle. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler( | addEventHandler('onPlayerVehicleEnter', root, function(vehicle, seat) | ||
if | if (seat == 0) then | ||
addVehicleSirens( | addVehicleSirens(vehicle, 2, 2) | ||
setVehicleSirens( | setVehicleSirens(vehicle, 1, -0.3, 0, 0.8, 0, 0, 255, 255, 255) | ||
setVehicleSirens(vehicle, 2, 0.3, 0, 0.8, 255, 0, 0, 255, 255) | |||
-- You can also make the sirens flash immediately with 'setVehicleSirensOn(vehicle, true)' | |||
end | end | ||
end) | end) | ||
addEventHandler( | |||
addEventHandler('onPlayerVehicleExit', root, function(vehicle, seat) | |||
removeVehicleSirens(vehicle) | |||
end) | end) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Vehicle_functions}} | {{Vehicle_functions}} |
Latest revision as of 17:03, 7 November 2024
This function changes the properties of a vehicles siren point.
Syntax
bool setVehicleSirens ( vehicle theVehicle, int sirenPoint, float posX, float posY, float posZ, float red, float green, float blue, [float alpha = 255, float minAlpha = 0.0] )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setSirens(...)
- Counterpart: getVehicleSirens
Required Arguments
- theVehicle: The vehicle to modify
- sirenPoint: The siren point to modify
- posX: The x position of this siren point from the center of the vehicle
- posY: The y position of this siren point from the center of the vehicle
- posZ: The z position of this siren point from the center of the vehicle
- red: The amount of red from 0 to 255
- green: The amount of green from 0 to 255
- blue: The amount of blue from 0 to 255
Optional Arguments
- alpha: The alpha of the siren from 0 to 255
- minAlpha: The minimum alpha of the light during day time
Returns
Returns true if the siren point was successfully changed on the vehicle, false otherwise.
Example
Click to collapse [-]
ServerThis example adds a siren for the vehicle, then sets two custom sirens at the top of the vehicle. And then removes the siren when getting out the vehicle.
addEventHandler('onPlayerVehicleEnter', root, function(vehicle, seat) if (seat == 0) then addVehicleSirens(vehicle, 2, 2) setVehicleSirens(vehicle, 1, -0.3, 0, 0.8, 0, 0, 255, 255, 255) setVehicleSirens(vehicle, 2, 0.3, 0, 0.8, 255, 0, 0, 255, 255) -- You can also make the sirens flash immediately with 'setVehicleSirensOn(vehicle, true)' end end) addEventHandler('onPlayerVehicleExit', root, function(vehicle, seat) removeVehicleSirens(vehicle) end)
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