ByeByeMTA Posted June 29, 2016 Share Posted June 29, 2016 Hi , i want if player connection interrupt , it is kicked also type in chat that the player was kicked because it's connection is interrupt Here the Server Side code : -- Server Side 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 ) Client Side code : -- Client Side 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) Link to comment
Captain Cody Posted June 29, 2016 Share Posted June 29, 2016 -- Server Side addEventHandler( "onPlayerNetworkStatus", root, function( status, ticks ) if status == 0 then kickPlayer(source,"Your network has frozen") end end ) You can remove client. Link to comment
ByeByeMTA Posted June 29, 2016 Author Share Posted June 29, 2016 -- Server Side addEventHandler( "onPlayerNetworkStatus", root, function( status, ticks ) if status == 0 then kickPlayer(source,"Your network has frozen") end end ) You can remove client. client side is useless ? , and why ? Link to comment
Captain Cody Posted June 29, 2016 Share Posted June 29, 2016 Well really client side was useless in the first place in my own opinion. All it does it tell the debugscript client side and freeze / unfreeze the player. All could be done server side. Link to comment
ByeByeMTA Posted June 29, 2016 Author Share Posted June 29, 2016 Well really client side was useless in the first place in my own opinion. All it does it tell the debugscript client side and freeze / unfreeze the player. All could be done server side. Thank you man. Link to comment
Captain Cody Posted June 29, 2016 Share Posted June 29, 2016 If you have any questions about this ask here. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now