GetGameSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 4: Line 4:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">float getGameSpeed()</syntaxhighlight>
<syntaxhighlight lang="lua">float getGameSpeed ( )</syntaxhighlight>


===Returns===
===Returns===
Returns a ''float''.
Returns a ''float'' representing the speed of the game.


==Example==
==Example==
<section name="Server and Client" class="both" show="true">
<section name="Server and Client" class="both" show="true">
This example adds a 'gamespeed' console command that prints the game speed to the chat box.
This example adds a 'gamespeed' console command that prints the game speed to the chatbox.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function gamespeedvalue ( )
function gameSpeedValue( )
     local speed = getGameSpeed ( )
     local speed = getGameSpeed( )
     outputChatbox ( "Gamespeed is currently set to " .. speed .. "." )
     outputChatbox( "Game speed is currently set to " .. speed .. "." )
end
end
addCommandHandler ( "gamespeed", gamespeedvalue )
addCommandHandler( "gamespeed", gameSpeedValue )
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 23: Line 23:
==See Also==
==See Also==
{{World functions}}
{{World functions}}
[[ru:getGameSpeed]]
[[ru:getGameSpeed]]

Revision as of 13:22, 3 August 2014

This function gets the current game speed value.

Syntax

float getGameSpeed ( )

Returns

Returns a float representing the speed of the game.

Example

Click to collapse [-]
Server and Client

This example adds a 'gamespeed' console command that prints the game speed to the chatbox.

function gameSpeedValue( )
    local speed = getGameSpeed( )
    outputChatbox( "Game speed is currently set to " .. speed .. "." )
end
addCommandHandler( "gamespeed", gameSpeedValue )

See Also