SetRainLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 13: Line 13:
===Returns===
===Returns===
Returns ''true'' if the rain level was set, ''false'' otherwise.
Returns ''true'' if the rain level was set, ''false'' otherwise.
==Example==
<section name="Client" class="client" show="true">
This example will make it rain when you enter a vehicle and stop it when you leave the vehicle.
<syntaxhighlight lang="lua">
function startRaining()
        setRainLevel(5)
end
addEventHandler("onClientVehicleEnter", getRootElement(), startRaining)
function stopRaining()
        resetRainLevel()
end
addEventHandler("onClientVehicleExit", getRootElement(), stopRaining)
</syntaxhighlight>
</section>

Revision as of 16:54, 24 December 2011

This function sets the rain level to any weather available in GTA. Use resetRainLevel to undo the changes.

Syntax

bool setRainLevel ( float level )

Required Arguments

  • level: A floating point number representing the rain level.

Returns

Returns true if the rain level was set, false otherwise.

Example

Click to collapse [-]
Client

This example will make it rain when you enter a vehicle and stop it when you leave the vehicle.

function startRaining()
         setRainLevel(5)
end
addEventHandler("onClientVehicleEnter", getRootElement(), startRaining)

function stopRaining()
         resetRainLevel()
end
addEventHandler("onClientVehicleExit", getRootElement(), stopRaining)