Jump to content

Help!


rafael15420

Recommended Posts

Server

max_lost_percent = 30 -- maximum allowed percent of lost packets 
  
function checkPacketLost() 
    for i,v in ipairs ( getElementsByType("player")) do 
        local lost = getNetworkStats(v).packetlossLastSecond 
        if lost > max_lost_percent then 
            kickPlayer ( v, "Big amount of lost packets" ) 
        end 
    end 
end 
  
addEvent("onDownloadFinish",true) 
addEventHandler("onDownloadFinish",root, 
    function () 
        setTimer(checkPacketLost,5000,0) 
    end) 

Client

addEventHandler ( "onClientFileDownloadComplete", getRootElement(), 
    function () 
        triggerServerEvent("onDownloadFinish",localPlayer) 
    end) 

Link to comment
Server
max_lost_percent = 30 -- maximum allowed percent of lost packets 
  
function checkPacketLost() 
    for i,v in ipairs ( getElementsByType("player")) do 
        local lost = getNetworkStats(v).packetlossLastSecond 
        if lost > max_lost_percent then 
            kickPlayer ( v, "Big amount of lost packets" ) 
        end 
    end 
end 
  
addEvent("onDownloadFinish",true) 
addEventHandler("onDownloadFinish",root, 
    function () 
        setTimer(checkPacketLost,5000,0) 
    end) 
  
  

Client

addEventHandler ( "onClientFileDownloadComplete", getRootElement(), 
    function () 
        triggerServerEvent("onDownloadFinish",localPlayer) 
    end) 

Don't forget to give admin rights on ACL.

Link to comment

Don't forget to give admin rights on ACL.

kickPlayer doesn't need admin rights. Always see wiki, I'm not offending you. :lol:

"responsiblePlayer: The player that is responsible for the event. Note: If left out as in the second syntax, responsible player for the kick will be "Console" (Maximum 30 characters if using a string)." Community.

In that case the responsible is Console, probably need ACL. I didn't test.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...