GetGaragePosition
From Multi Theft Auto: Wiki
This function outputs X, Y and Z position of given garage.
Syntax
float, float, float getGaragePosition ( int garageID )
Required Arguments
- garageID: The garage ID that represents the garage door that is being checked.
Returns
Returns three floats indicating the position of the garage, x, y and z respectively, false when garageID was invalid.
Example
Click to collapse [-]
ClientThis element has to create a blip at the nearest garage and removes it in 10 seconds.
function getNearestGarageFromElement (element)
nearestID = -1
nearestDistance = 999999999999
local ex,ey,ez = getElementPosition (element)
for i=0,49 do
local x,y,z = getGaragePosition (i)
if (getDistanceBetweenPoints3D (ex,ey,ez,x,y,z) < nearestDistance) then
nearestID = i
nearestDistance = getDistanceBetweenPoints3D (ex,ey,ez,x,y,z)
end
end
local _nearestID = nearestID
nearestID = nil
return _nearestID
end
addCommandHandler ("findgarage",
function(command)
local garageID = getNearestGarageFromElement (getLocalPlayer())
if (garageID ~= -1) then
local x,y,z = getGaragePosition (garageID)
local garageBlip = createBlip (x,y,z,41)
setTimer (
function (garageBlip)
destroyElement (garageBlip)
end
,10000,1,garageBlip)
end
end)
See Also
- areTrafficLightsLocked
- createSWATRope
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getBirdsEnabled
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGravity
- getGroundPosition
- getHeatHaze
- getInteriorFurnitureEnabled
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getNearClipDistance
- getOcclusionsEnabled
- getPedsLODDistance
- setPedsLODDistance
- resetPedsLODDistance
- getPlayerBlurLevel
- getRainLevel
- getScreenFromWorldPosition
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getWindVelocity
- getWorldFromScreenPosition
- getZoneName
- isAmbientSoundEnabled
- isGarageOpen
- isLineOfSightClear
- isWorldSoundEnabled
- isWorldSpecialPropertyEnabled
- processLineOfSight
- removeWorldModel
- resetAmbientSounds
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetVehiclesLODDistance
- resetWindVelocity
- resetWorldSounds
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setAmbientSoundEnabled
- setBirdsEnabled
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setJetpackMaxHeight
- setMinuteDuration
- setMoonSize
- setNearClipDistance
- setOcclusionsEnabled
- setPlayerBlurLevel
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setVehiclesLODDistance
- setWeather
- setWeatherBlended
- setWindVelocity
- setWorldSoundEnabled
- setWorldSpecialPropertyEnabled
- testLineAgainstWater