OnPlayerNetworkStatus: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Server event}} {{New items|3.0142|1.4.1-7295| __NOTOC__ This event is triggered when a players network connection is interrupted. }} ==Parameters== <syntaxhighlight lang="lua"> int statu...")
 
mNo edit summary
Line 1: Line 1:
{{Server event}}
{{Server event}}
{{New items|3.0142|1.4.1-7295|
{{New items|3.0142|1.4.1|
__NOTOC__  
__NOTOC__  
This event is triggered when a players network connection is interrupted.
This event is triggered when a players network connection is interrupted.
}}
|7295}}
==Parameters==  
==Parameters==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 14:19, 11 July 2015

This event is triggered when a players 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 player element that has the network interruption.

Example

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

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

See Also

Other events