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.)
 
(8 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Server client function}}
__NOTOC__
__NOTOC__
==Description==
This function gets the current game speed value.
This function get 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==
<syntaxhighlight lang="lua">addCommandHandler ( "gamespeed", "gamespeedvalue" )
<section name="Server and Client" class="both" show="true">
function getgamespeedvalue ()
This example adds a 'gamespeed' console command that prints the game speed to the chatbox.
local speed = getGameSpeed ()
<syntaxhighlight lang="lua">
outputChatbox ( "Gamespeed is currently set to " ..speed.. "" )
function gameSpeedValue( )
end</syntaxhighlight>
    local speed = getGameSpeed( )
    outputChatBox( "Game speed is currently set to " .. speed .. "." )
end
addCommandHandler( "gamespeed", gameSpeedValue )
</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