OnPlayerNetworkStatus: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 9: Line 9:
</syntaxhighlight>  
</syntaxhighlight>  


*'''status''': A number which is 0 if the interruption has begun, or 1 if the interruption is ending.
*'''status''': an [[int]] which is 0 if the interruption has begun, or 1 if the interruption is ending.
*'''ticks''': Number of ticks since the interruption started.
*'''ticks''': an [[int]] representing the ticks since the interruption started.


==Source==
==Source==
Line 29: Line 29:
</syntaxhighlight>
</syntaxhighlight>


==See Also==
{{See also/Server event|Player events}}
===Other events===
{{Player_events}}

Latest revision as of 03:01, 27 September 2018

This event is triggered when a players network connection to the server is interrupted. See onClientPlayerNetworkStatus for detecting server to player interruptions.

Parameters

int status, int ticks
  • status: an int which is 0 if the interruption has begun, or 1 if the interruption is ending.
  • ticks: an int representing the ticks since the interruption started.

Source

The source of this event is the player 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

Player events


Event functions

Shared