Blueman Posted February 19, 2012 Share Posted February 19, 2012 Well the console keeps claiming that this is a string then I make some changes to convert it from a string to a int and it says it is a Boolean. Ping.lua PingTable = { } function PingCheck(source) if (getPlayerPing(sourcer) > get("MaxPing")) then kickPlayer(ThePlayer, "High Ping") else outputConsle( ThePlayer.. "Has passed the ping check") end end function onPlayerJoinGame() table.insert(PingTable ,setTimer(PingCheck, tonumber(get("Delay")), 1 , source) ) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinGame) Meta.xml <Meta> <info author="Blueman" type="script" name="Ping Kicker" /> <script src="Ping.lua" type="server"/> <settings> <setting name="MaxPing" value="50"/> <setting name="Delay" value="10000"/> </settings> </Meta> Link to comment
JR10 Posted February 19, 2012 Share Posted February 19, 2012 PingTable = { } function PingCheck(source) if (getPlayerPing(sourcer) > tonumber(get("MaxPing"))) then kickPlayer(ThePlayer, "High Ping") else outputConsle( ThePlayer.. "Has passed the ping check") end end function onPlayerJoinGame() table.insert(PingTable ,setTimer(PingCheck, tonumber(get("Delay")), 1 , source) ) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinGame) Link to comment
myonlake Posted February 19, 2012 Share Posted February 19, 2012 (edited) JR10's script works just fine, this ones just a little bit organized. local PingTable = {} function PingCheck(source) if getPlayerPing(source) > tonumber(get("MaxPing")) then kickPlayer(source, "High Ping") else outputConsle(getPlayerName(source) .. " has passed the ping check.") end end addEventHandler("onPlayerJoin", getRootElement(), function() table.insert(PingTable, setTimer(PingCheck, tonumber(get("Delay")), 1, source) end ) Edited February 19, 2012 by Guest Link to comment
Evil-Cod3r Posted February 19, 2012 Share Posted February 19, 2012 outputConsle( ThePlayer.. "Has passed the ping check") there is no Player in the script dosnt it have to be outputConsle( source .. "Has passed the ping check") or outputConsle( localPlayer .. "Has passed the ping check") Link to comment
Kenix Posted February 19, 2012 Share Posted February 19, 2012 Server local PingTable = { } local default_time = 10000 addEventHandler( 'onPlayerJoin', root, function( ) PingTable [ source ] = setTimer( function( player ) if getPlayerPing( player ) > tonumber( get( 'MaxPing' ) ) then kickPlayer( player, "High Ping" ) else outputConsole( '*'..getPlayerName( player ).. ' Has passed the ping check' ) end end, tonumber( get( "Delay" ) or default_time ), 0 , source ) end ) addEventHandler( 'onPlayerQuit', root, function( ) if isTimer( PingTable [ source ] ) then killTimer( PingTable [ source ] ) end PingTable [ source ] = nil end ) Link to comment
arezu Posted February 19, 2012 Share Posted February 19, 2012 You should also disable kicking when players are downloading, because some people get like 5-10 times more ping when they do, even thought the download is may only be 2-5 seconds long. Would suck if 1/4 of the players each round got kicked. (If you had not thought about that yet) Link to comment
Evil-Cod3r Posted February 19, 2012 Share Posted February 19, 2012 yeah arezu is right Make it onPlayerSpawn event should work Link to comment
Blueman Posted February 19, 2012 Author Share Posted February 19, 2012 One problem you set the amount of times to repeat to 0 causing an infinite loop. local PingTable = { } local default_time = 10000 addEventHandler( 'onPlayerJoin', root, function( ) PingTable [ source ] = setTimer( function( player ) if getPlayerPing( player ) > tonumber( get( 'MaxPing' ) ) then kickPlayer( player, "High Ping" ) else outputDebugString( '*'..getPlayerName( player ).. ' Has passed the ping check' ) end end, tonumber( get( "Delay" ) or default_time ), 1 , source ) end ) addEventHandler( 'onPlayerQuit', root, function( ) if isTimer( PingTable [ source ] ) then killTimer( PingTable [ source ] ) end PingTable [ source ] = nil end ) Link to comment
Kenix Posted February 19, 2012 Share Posted February 19, 2012 Not understand you. One problem you set the amount of times to repeat to 0 causing an infinite loop. You need just check if player download? And ping < limit LOL. 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