OnClientPlayerNetworkStatus: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client event}} {{New items|3.0142|1.4.1-7295| __NOTOC__ This event is triggered when the network connection is interrupted. }} ==Parameters== <syntaxhighlight lang="lua"> int status, int...")
 
No edit summary
Line 16: Line 16:


==Example==  
==Example==  
This example plays a sound if it was downloaded successfully
This example shows a debug message when interruption starts and stops.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler( "onClientPlayerNetworkStatus", root,
addEventHandler( "onClientPlayerNetworkStatus", root,

Revision as of 22:38, 22 June 2015

This event is triggered when the network connection is interrupted.

Parameters

int status, int ticks
  • status: A number which is 0 if the interruption has begun, or 1 if the interruption is ending.
  • ticks: Number of ticks since the interruption started.

Source

The source of this event is the root element.

Example

This example shows a debug message when interruption starts and stops.

addEventHandler( "onClientPlayerNetworkStatus", root,
  function( status, ticks )
    if status == 0 then
      outputDebugString( "(packets from server) interruption began " .. ticks .. " ticks ago" )
    elseif status == 1 then
      outputDebugString( "(packets from server) interruption began " .. ticks .. " ticks ago and has just ended" )
    end
  end
)

See Also

Other client events