GetRainLevel: Difference between revisions
Jump to navigation
Jump to search
CrosRoad95 (talk | contribs) mNo edit summary |
(Replace to predefined variables.) |
||
Line 15: | Line 15: | ||
'''Example:''' Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.) | '''Example:''' Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.) | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler("onClientResourceStart", | addEventHandler("onClientResourceStart", resourceRoot, function() | ||
setRainLevel(math.random(5)) | setRainLevel(math.random(5)) | ||
end) | end) | ||
function returnRain() | function returnRain() | ||
local rain = getRainlevel() | local rain = getRainlevel() | ||
Line 33: | Line 34: | ||
'''Example:''' Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.) | '''Example:''' Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.) | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler("onResourceStart", | addEventHandler("onResourceStart", resourceRoot, function() | ||
setRainLevel(math.random(5)) | setRainLevel(math.random(5)) | ||
end) | end) |
Latest revision as of 23:12, 11 January 2023
This function is used to get the current rain level.
Syntax
float getRainLevel( )
Returns
Returns the rain level as a number.
Example
Click to collapse [-]
ClientExample: Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.)
addEventHandler("onClientResourceStart", resourceRoot, function() setRainLevel(math.random(5)) end) function returnRain() local rain = getRainlevel() if(rain >= 1) then outputChatBox("Looks like it's going to be a rainy day!",255,130,130,false) else outputChatBox("Surprisingly dry!",255,130,130,false) end end addCommandHandler("rain", returnRain)
Click to collapse [-]
ServerExample: Sets the rain (So it can detect it) before returning it. (In this case, when resource starts.)
addEventHandler("onResourceStart", resourceRoot, function() setRainLevel(math.random(5)) end) function returnRain(player) local rain = getRainlevel() if(rain >= 1) then outputChatBox("Looks like it's going to be a rainy day!",player,255,130,130,false) else outputChatBox("Surprisingly dry!",player,255,130,130,false) end end addCommandHandler("rain", returnRain)
See Also
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel