OnClientPlayerNetworkStatus: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
{{New items|3.0142|1.4.1-7295| | {{New items|3.0142|1.4.1-7295| | ||
__NOTOC__ | __NOTOC__ | ||
This event is triggered when the network connection is interrupted. | This event is triggered when the server network connection to a player is interrupted. See [[onPlayerNetworkStatus]] for detecting player to server interruptions. | ||
}} | }} | ||
==Parameters== | ==Parameters== |
Latest revision as of 00:01, 28 January 2016
This event is triggered when the server network connection to a player is interrupted. See onPlayerNetworkStatus for detecting player to server interruptions.
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