OnClientPlayerNetworkStatus
Jump to navigation
Jump to search
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 and also prevents the local player moving during the interruption.
frozen = false -- This variable stores whether or not the script is going to freeze them. -- If they were already frozen then don't unfreeze them when the interruption ends to avoid conflicts with other scripts. function handleInterrupt( status, ticks ) if (status == 0) then outputDebugString( "(packets from server) interruption began " .. ticks .. " ticks ago" ) if (not isElementFrozen(localPlayer)) then setElementFrozen(localPlayer, true) -- Freeze them to prevent them abusing the network interruption frozen = true end elseif (status == 1) then outputDebugString( "(packets from server) interruption began " .. ticks .. " ticks ago and has just ended" ) if (frozen) then setElementFrozen(localPlayer, false) -- If we froze them, unfreeze them now. frozen = false end end end addEventHandler( "onClientPlayerNetworkStatus", root, handleInterrupt)
See Also
Other client events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound