GetWaterLevel: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool float getWaterLevel ( float posX, float posY, float posZ | bool/float getWaterLevel ( float posX, float posY, float posZ ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 12:13, 11 August 2007
This function allows you to retrieve the water level from a certain position.
Syntax
bool/float getWaterLevel ( float posX, float posY, float posZ )
Required Arguments
- x: The X axis position
- y: The Y axis position
- z: The Z axis position
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- checkWaves: An optional argument to choose if you want to return the height of the waves. ??
Returns
I'm not sure what it must return, all I got was false and 0. ??
Example
This example will tell you what's the water level where the specified player is located. NEEDS UPDATING!!!
function scriptGetLevel ( command, playername ) --when getlevel is called local thePlayer = getPlayerFromNick ( playername ) --get the player from nickname if ( thePlayer ~= false ) then --if there is a player from the nickname if ( isPlayerInVehicle(thePlayer) ) then local x, y, z = getElementPosition ( getPlayerOccupiedVehicle ( thePlayer ) ) else local x, y, z = getElementPosition ( player ) -- get his position end local level = getWaterLevel ( x, y, z ) if ( level ) then --outputChatBox ( tostring ( bool ) ) --outputChatBox ( level ) outputChatBox( "You are " .. level .. " meters away from the water!", source ) end else outputChatBox ( "Player does not exist" ) end end addCommandHandler( "getlevel", scriptGetLevel ) -- add a command "getloc" which
See Also
- areTrafficLightsLocked
- createSWATRope
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getBirdsEnabled
- getCloudsEnabled
- getCoronaReflectionsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGravity
- getGroundPosition
- getHeatHaze
- getInteriorFurnitureEnabled
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getNearClipDistance
- getOcclusionsEnabled
- getPedsLODDistance
- getPlayerBlurLevel
- getRainLevel
- getRoofPosition
- getScreenFromWorldPosition
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getWindVelocity
- getWorldFromScreenPosition
- getZoneName
- isAmbientSoundEnabled
- isGarageOpen
- isLineOfSightClear
- isWorldSoundEnabled
- isWorldSpecialPropertyEnabled
- processLineOfSight
- removeWorldModel
- resetAmbientSounds
- resetBlurLevel
- resetColorFilter
- resetCoronaReflectionsEnabled
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetNearClipDistance
- resetPedsLODDistance
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetVehiclesLODDistance
- resetWindVelocity
- resetWorldSounds
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setAmbientSoundEnabled
- setBirdsEnabled
- setCloudsEnabled
- setColorFilter
- setCoronaReflectionsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setJetpackMaxHeight
- setMinuteDuration
- setMoonSize
- setNearClipDistance
- setOcclusionsEnabled
- setPedsLODDistance
- setPlayerBlurLevel
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightsLocked
- setTrafficLightState
- setVehiclesLODDistance
- setWeather
- setWeatherBlended
- setWindVelocity
- setWorldSoundEnabled
- setWorldSpecialPropertyEnabled
- testLineAgainstWater