DebugSleep: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Remove obsolete Requirements section)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
_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.
[[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.


{{Warning|Only use this function if you know what you are doing!|true}}
{{Warning|Only use this function if you know what you are doing!|true}}
Line 15: Line 15:
===Returns===
===Returns===
Returns ''true'' if the development mode is enabled and arguments are correct, ''false'' otherwise.
Returns ''true'' if the development mode is enabled and arguments are correct, ''false'' otherwise.
==Requirements==
{{Requirements|1.5.4-9.11306|1.5.4-9.11306|}}


==Example==  
==Example==  
Line 25: Line 22:
addCommandHandler ( "zzz",
addCommandHandler ( "zzz",
     function ( command, sleep )
     function ( command, sleep )
         debugSleep ( sleep )
         if ( sleep ) then
            local ms = tonumber ( sleep )
            if ( ms ) then
                debugSleep ( ms )
            end
        end
     end
     end
)
)

Latest revision as of 17:14, 7 November 2024

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.

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