GetGameSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Fixed function name; including the typo it had, this example code didn't even work: outputChatbox doesnt exist, outputChatBox does.)
 
Line 15: Line 15:
function gameSpeedValue( )
function gameSpeedValue( )
     local speed = getGameSpeed( )
     local speed = getGameSpeed( )
     outputChatbox( "Game speed is currently set to " .. speed .. "." )
     outputChatBox( "Game speed is currently set to " .. speed .. "." )
end
end
addCommandHandler( "gamespeed", gameSpeedValue )
addCommandHandler( "gamespeed", gameSpeedValue )

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