DebugSleep

From Multi Theft Auto: Wiki
Revision as of 14:35, 27 January 2022 by Quiret (talk | contribs) (fixed the example, having to use a number as first argument to debugSleep)
Jump to navigation Jump to search

debugSleep freezes the client/server for the specified time. This means that all synchronization, rendering and script execution will stop except HTTP processing invoked by fetchRemote. This function only works, if development mode is enabled by setDevelopmentMode and can be utilised to build a debugger that communicates via HTTP requests with the editor/IDE.

Dialog-warning.png Warning: Only use this function if you know what you are doing!

Syntax

bool debugSleep ( int sleep )

Required Arguments

  • sleep : An integer value in milliseconds.

Returns

Returns true if the development mode is enabled and arguments are correct, false otherwise.

Requirements

This template will be deleted.

Example

Example 1: This example would add the command to set the client's freeze time.

Click to collapse [-]
Client
addCommandHandler ( "zzz",
    function ( command, sleep )
        if ( sleep ) then
            local ms = tonumber ( sleep )
            if ( ms ) then
                debugSleep ( ms )
            end
        end
    end
)

See Also