GetRainLevel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
TechialWiki (talk | contribs) |
||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
getRainLevel | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() | |||
setRainLevel(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) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Server" class="server" show="true"> | |||
getRainLevel | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() | |||
setRainLevel(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) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 12:04, 18 April 2013
Script Example Missing Function GetRainLevel needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
This function is used to get the current rain level.
Note: The server can only return the rain level if it has actually been set by script, otherwise it will return false.
Syntax
float getRainLevel( )
Returns
Returns the rain level as a number.
Example
Click to collapse [-]
ClientgetRainLevel
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() setRainLevel(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 [-]
ServergetRainLevel
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() setRainLevel(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