1LoL1 Posted April 24, 2014 Share Posted April 24, 2014 It does not work it does not kick at all .. :(or not write anything .. help anyone? function checkPing(thePlayer) ping = getPlayerPing(thePlayer) if ( ping > 200 ) then kickPlayer (thePlayer ,Too high Ping) outputChatBox (getPlayerName(thePlayer).."was kicked for hight ping!",255,255,0 ) end addEventHandler ("OnResourceStart") Link to comment
myonlake Posted April 24, 2014 Share Posted April 24, 2014 (edited) You forgot apostrophes around the kick reason. Also, your event handler is incorrectly written. It takes in three arguments (event name, event source and handler function). You also have to loop through all players in order to check pings like that. You also forgot the second argument from the outputChatBox function (the target element(s), which is root for now). function checkPing( ) for _,player in ipairs( getElementsByType( "player" ) ) do local ping = getPlayerPing( player ) if ( ping > 200 ) then kickPlayer( player, "High ping (" .. ping .. ">200)" ) outputChatBox( getPlayerName( player ) .. " was kicked for high ping (" .. ping .. ">200)", root, 255, 255, 0 ) end end end addEventHandler( "onResourceStart", resourceRoot, checkPing ) Edited April 24, 2014 by Guest Link to comment
Karuzo Posted April 24, 2014 Share Posted April 24, 2014 checking if the player has a ping higher than 200 on resourcestart isn't efficient. You should use a timer. Link to comment
1LoL1 Posted April 24, 2014 Author Share Posted April 24, 2014 checking if the player has a ping higher than 200 on resourcestart isn't efficient. You should use a timer. I was up there at the head confuses me .. that's the Kicks .. Link to comment
1LoL1 Posted April 26, 2014 Author Share Posted April 26, 2014 It does not work at all .. Link to comment
myonlake Posted April 26, 2014 Share Posted April 26, 2014 And why is that? Any errors? I don't see why it wouldn't work. Make sure you use the code server-side. 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