GetVehicleSirenParams: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(→‎Returns: Hopefully cleared up the return table for this function)
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
{{New feature/item|4.0140|1.4|3966|
{{New feature/item|4.0140|1.3.1|3968|
This function get the parameters of a vehicles siren.
This function get the parameters of a vehicles siren.
}}
}}
Line 52: Line 52:


==Requirements==
==Requirements==
{{Requirements|1.4-3966|1.4-3966|}}
{{Requirements|1.3.0-9.03968|1.3.0-9.03968|}}


==See Also==
==See Also==
{{Vehicle_functions}}
{{Vehicle_functions}}

Revision as of 08:04, 9 May 2012

ADDED/UPDATED IN VERSION 1.3.1 r3968:

This function get the parameters of a vehicles siren.

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.

[int]   SirenParams.SirenCount
[int]   SirenParams.SirenType
[table] SirenParams.Flags
 [bool] SirenParams.Flags["360"]
 [bool] SirenParams.Flags.DoLOSCheck
 [bool] SirenParams.Flags.UseRandomiser
 [bool] SirenParams.Flags.Silent

Example

Click to collapse [-]
Server

This example returns the vehicle parameters when the players presses g.

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.SirenCount)..", Type of Siren: "..tostring(sirenParams.SirenType)..".",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