SetCloudsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (-.-)
(Replace to predefined variables.)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function will enable or disable clouds, This is useful for race maps that spawn high up as clouds can cause low FPS.
This function will enable or disable clouds. This is useful for race maps which are placed high up as clouds can cause low FPS.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setCloudsEnabled( bool Enabled )
bool setCloudsEnabled ( bool enabled )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''Enabled:''' a bool determining if clouds should be shown (''true'') to show clouds (''false'') to hide them
*'''enabled:''' A [[boolean]] value determining if clouds should be shown. Use ''true'' to show clouds and ''false'' to hide them.


===Returns===
===Returns===
Returns ''true'' if the clouds where shown or hidden succesfully, ''false'' if an invalid argument was specified.
Returns ''true'' if the cloud state was changed succesfully, ''false'' if an invalid argument was specified.


==Example==  
==Example==  
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
This example Disables clouds for all players
This example disables clouds for all players when resource starts.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function disableClouds ()
function onResourceStart()
     setCloudsEnabled( false )   -- Hide the clouds for all players when the resource starts
     setCloudsEnabled(false)
end
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), disableClouds )
addEventHandler("onResourceStart", resourceRoot, onResourceStart)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
==See Also==
{{World functions}}
[[ru:setCloudsEnabled]]

Latest revision as of 23:16, 11 January 2023

This function will enable or disable clouds. This is useful for race maps which are placed high up as clouds can cause low FPS.

Syntax

bool setCloudsEnabled ( bool enabled )

Required Arguments

  • enabled: A boolean value determining if clouds should be shown. Use true to show clouds and false to hide them.

Returns

Returns true if the cloud state was changed succesfully, false if an invalid argument was specified.

Example

Click to collapse [-]
Server

This example disables clouds for all players when resource starts.

function onResourceStart()
    setCloudsEnabled(false)
end
addEventHandler("onResourceStart", resourceRoot, onResourceStart)

See Also