SetFogDistance: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
{{Server client function}}
{{Server client function}}


{{Server client function}}
This function changes the distance at which fog appears. Keep in mind that this function doesn't change the distance of render.
__NOTOC__
This function changes the visible distance of fog.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setFogDistance ( float distance )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setFogDistance ( float distance )</syntaxhighlight>
===Arguments===
*'''distance:''' distance in GTA units at which fog will appear. Very short or negative distances will cause graphical bugs to the players.


===Returns===
===Returns===
Returns a ''bool''.
Returns ''true'' if the distance changed successfully, ''false'' if bad arguments were passed.


==Example==
==Example==
<section name="Server and Client" class="both" show="true">
<section name="Server" class="server" show="true">
This example makes any weather very clear when the resource that contains it starts.
 
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function fogdistance ( )
function makeWeatherClear()
     setFogDistance(1.0)
     setFogDistance(500) -- Set the fog distance to 500 units, so any weather will appear to be extremely clear
end
end
addCommandHandler ( "fog", fogdistance )
addEventHandler("onResourceStart", resourceRoot, makeWeatherClear)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Latest revision as of 10:16, 18 May 2014

This function changes the distance at which fog appears. Keep in mind that this function doesn't change the distance of render.

Syntax

bool setFogDistance ( float distance )

Arguments

  • distance: distance in GTA units at which fog will appear. Very short or negative distances will cause graphical bugs to the players.

Returns

Returns true if the distance changed successfully, false if bad arguments were passed.

Example

Click to collapse [-]
Server

This example makes any weather very clear when the resource that contains it starts.

function makeWeatherClear()
    setFogDistance(500) -- Set the fog distance to 500 units, so any weather will appear to be extremely clear
end
addEventHandler("onResourceStart", resourceRoot, makeWeatherClear)

See Also