GetGameSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Fixed function name; including the typo it had, this example code didn't even work: outputChatbox doesnt exist, outputChatBox does.)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Server client function}}
{{Server client function}}
__NOTOC__
__NOTOC__
==Description==
This function gets the current game speed value.
This function gets the current game speed value.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">getGameSpeed()</syntaxhighlight>
<syntaxhighlight lang="lua">float getGameSpeed ( )</syntaxhighlight>
 
===Returns===
Returns a ''float'' representing the speed of the game.


==Example==
==Example==
This example adds a 'gamespeed' console command that prints the game speed to the chat box.
<section name="Server and Client" class="both" show="true">
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>


==See Also==
==See Also==
{{World functions}}
{{World functions}}
[[ru:getGameSpeed]]

Latest revision as of 22:13, 10 January 2015

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