Jump to content

AFK kick


MasterTobi

Recommended Posts

Posted

hm hey i need a function or event, those examines whether client itself moved

or has anybody an afk-kicker ? :)

thx sry for my ***** english xD i understand english very good, but writing OMG

Posted

hm hey i need a function or event, those examines whether client itself moved

or has anybody an afk-kicker ? :)

thx sry for my ***** english xD i understand english very good, but writing OMG

Posted

You can bind all controls to a function which checks how long ago it has been since the last time the player has pushed a button. If this has been over a certain amount of time (for instance 5 minutes) then you could kick the guy. The detection is best done client-side because of accuracy, but you can also place the checks server-side. (although limited)

- Control names

- bindKey

- onClientRender

- getTickCount

You can check with onClientRender + getTickCount or setTimer how long it has been since the last control was pressed.

------------------

Alternatively, you could of course check if the player position has changed. Should basically require the same procedure, but a little different.

Posted

You can bind all controls to a function which checks how long ago it has been since the last time the player has pushed a button. If this has been over a certain amount of time (for instance 5 minutes) then you could kick the guy. The detection is best done client-side because of accuracy, but you can also place the checks server-side. (although limited)

- Control names

- bindKey

- onClientRender

- getTickCount

You can check with onClientRender + getTickCount or setTimer how long it has been since the last control was pressed.

------------------

Alternatively, you could of course check if the player position has changed. Should basically require the same procedure, but a little different.

Posted

spezial thx

my afk code is this :

function funcInput ( key, keyState )
 
afkTime =60000*15
 if ( keyState == "up" ) then
   setTimer(afkgo,afkTime,1)
 end
 
if ( keyState == "down" ) then
	afktimer = getTimers ( afkTime)
	for timerKey, timerafk in ipairs(afktimer) do
     killTimer ( timerafk )
  end
end
 
end
 
function afkgo()
afkTime =60000*15
	afktimer = getTimers ( afkTime)
	for timerKey, timerafk in ipairs(afktimer) do
     killTimer ( timerafk )
  end
outputChatBox ( "afk" )
end
 
 
function bindTheKeys ()
outputChatBox("jupp")
 bindKey ( "forwards", "down", funcInput )
 bindKey ( "forwards", "up", funcInput )
 bindKey ( "backwards ", "down", funcInput )
 bindKey ( "backwards ", "up", funcInput )
 bindKey ( "left", "down", funcInput )
 bindKey ( "left", "up", funcInput )
 bindKey ( "right", "down", funcInput )
 bindKey ( "right", "up", funcInput )
 
 
end
addEventHandler("onClientPlayerSpawn",getLocalPlayer(),bindTheKeys)

i hopp it is good :P

you were kicked after 15mins if you not move

edit: you have to write your kick command in the function afkgo() xD

Posted

spezial thx

my afk code is this :

function funcInput ( key, keyState ) afkTime =60000*15  if ( keyState == "up" ) then    setTimer(afkgo,afkTime,1)  end 	if ( keyState == "down" ) then		afktimer = getTimers ( afkTime)		for timerKey, timerafk in ipairs(afktimer) do      killTimer ( timerafk )	  end	end end function afkgo()afkTime =60000*15		afktimer = getTimers ( afkTime)		for timerKey, timerafk in ipairs(afktimer) do      killTimer ( timerafk )	  endoutputChatBox ( "afk" )end  function bindTheKeys ()outputChatBox("jupp")  bindKey ( "forwards", "down", funcInput )  bindKey ( "forwards", "up", funcInput )  bindKey ( "backwards ", "down", funcInput )  bindKey ( "backwards ", "up", funcInput )  bindKey ( "left", "down", funcInput )  bindKey ( "left", "up", funcInput )  bindKey ( "right", "down", funcInput )  bindKey ( "right", "up", funcInput )  endaddEventHandler("onClientPlayerSpawn",getLocalPlayer(),bindTheKeys)

i hopp it is good :P

you were kicked after 15mins if you not move

edit: you have to write your kick command in the function afkgo() xD

Posted

Indeed, I was saying that a player that uses a gamepad will be sending AnalogState's, not the usual digital inputs. Therefore this code will not see any input, and will kick an active player.

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...