StreetSaintz Posted June 22, 2012 Share Posted June 22, 2012 Hello guys i need help, i got this script but i want that i dont need to typ /ping but it checks it automaticly and when it gets over the maximum ping you get kicked Serverping.lua function checkPing() local ping = getPlayerPing(source) -- get the ping from the source element (the player who joined) if (ping > 100) then -- if it's higher than 100... outputChatBox("Your ping is pretty high! Please try to lower it if possible.", source) -- output a message to the player end end addEventHandler("onPlayerJoin", getRootElement(), checkPing) -- add the event handler clientping.lua function checkPing() local ping = getPlayerPing(getLocalPlayer()) -- get the ping from the source element (the player who joined) if (ping > 100) then -- if it's higher than 100... outputChatBox("Your ping is pretty high! Please try to lower it if possible.") -- output a message to the player end end addCommandHandler("ping", checkPing) Ihope u guys can help me Link to comment
Guest Guest4401 Posted June 22, 2012 Share Posted June 22, 2012 local maxPing = 100 setTimer( function() for i,v in ipairs(getElementsByType'player') do -- loop through all players if getPlayerPing(v) >= maxPing then -- if a player's ping is too high kickPlayer(v,"You got kicked for having a high ping") -- kick him end end end, 1000, 0 -- repeat the check every 1 second ) Link to comment
StreetSaintz Posted June 22, 2012 Author Share Posted June 22, 2012 is this correct ? Serverping.lua function checkPing() local maxPing = 100 setTimer( function() for i,v in ipairs(getElementsByType'player') do -- loop through all players if getPlayerPing(v) >= maxPing then -- if a player's ping is too high kickPlayer(v,"You got kicked for having a high ping") -- kick him end end end, 1000, 0 -- repeat the check every 1 second ) Link to comment
Castillo Posted June 22, 2012 Share Posted June 22, 2012 local maxPing = 100 setTimer ( function ( ) for i, v in ipairs ( getElementsByType'player' ) do -- loop through all players if ( getPlayerPing ( v ) >= maxPing ) then -- if a player's ping is too high kickPlayer ( v, "You got kicked for having a high ping" ) -- kick him end end end ,1000, 0 -- repeat the check every 1 second ) "checkPing" function was useless. Link to comment
BinSlayer1 Posted June 22, 2012 Share Posted June 22, 2012 May I point out that a good anti-highping script will first WARN the player and then give him enough time to fix the problem before kicking him. Also, a good anti-highping script will take notice of people whether or not they are downloading at the time of the ping check. It doesn't make sense kicking someone who's downloading your server resources because he has 1000 ping. Try to create these features if you want to be thorough. Link to comment
StreetSaintz Posted June 22, 2012 Author Share Posted June 22, 2012 i got now this: Meta.xml <meta> <info author="StreetSaintz" version="1.0" /> <script src="clientping.lua" type="client" /> </meta> clientping.lua local maxPing = 20 setTimer ( function ( ) for i, v in ipairs ( getElementsByType'player' ) do -- loop through all players if ( getPlayerPing ( v ) >= maxPing ) then -- if a player's ping is too high kickPlayer ( v, "You got kicked for having a high ping" ) -- kick him end end end ,1000, 0 -- repeat the check every 1 second ) What im doing wrong ? Link to comment
Guest Guest4401 Posted June 22, 2012 Share Posted June 22, 2012 It should be serversided. Link to comment
StreetSaintz Posted June 22, 2012 Author Share Posted June 22, 2012 do i need to change this to ? Link to comment
Kenix Posted June 22, 2012 Share Posted June 22, 2012 Better check ping on client and trigger to server ( when ping > limits ) and kick player. It's more better in optimisation. Link to comment
StreetSaintz Posted June 22, 2012 Author Share Posted June 22, 2012 i was watching at the server it says Acces denied @ Kickplayer ? i did everything like u guys told me Link to comment
Guest Guest4401 Posted June 22, 2012 Share Posted June 22, 2012 You must add resource.resourceName in the acl group: Admin. Link to comment
StreetSaintz Posted June 22, 2012 Author Share Posted June 22, 2012 You must add resource.resourceName in the acl group: Admin. Thanks all guys , it works 100 % Link to comment
BinSlayer1 Posted June 23, 2012 Share Posted June 23, 2012 You must add resource.resourceName in the acl group: Admin. Thanks all guys , it works 100 % so you'll just kick players as soon as their ping gets over the limit? What if they have a lagspike? Link to comment
StreetSaintz Posted June 24, 2012 Author Share Posted June 24, 2012 You must add resource.resourceName in the acl group: Admin. Thanks all guys , it works 100 % so you'll just kick players as soon as their ping gets over the limit? What if they have a lagspike? No, i got a other script that gives the player a warning when he gets over 250 ping and when he gets 300 ping = kick 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