Jump to content

I would like find a script : auto-kick AFK


Recommended Posts

Posted

well im not sure if it works but

local checkTime = 20 -- in seconds

local afk_timer = nil

local keyAlreadyHit = false

local function checkAFK()

afk_timer = nil

if not keyAlreadyHit then

triggerServerEvent("onPlayerAfk", getLocalPlayer())

else

afk_timer = setTimer(checkAFK, checkTime * 1000, 1)

end

keyAlreadyHit = false

end

addEvent("afkStartTimer", true)

addEventHandler("afkStartTimer",

getRootElement(),

function()

if afk_timer then

killTimer(afk_timer)

afk_timer = nil

end

afk_timer = setTimer(checkAFK, checkTime * 1000, 1)

keyAlreadyHit = false

end)

addEvent("afkStopTimer", true)

addEventHandler("afkStopTimer",

getRootElement(),

function()

if afk_timer then

killTimer(afk_timer)

afk_timer = nil

end

keyAlreadyHit = false

end)

local function keyHit()

keyAlreadyHit = true

end

for k, v in pairs{"backspace","tab","lshift","rshift","lctrl","rctrl","lalt","ralt","pause","capslock","enter","space","pgup","pgdn","end","home","arrow_l","arrow_u","arrow_r","arrow_d","insert","delete","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","num_0","num_1","num_2","num_3","num_4","num_5","num_6","num_7","num_8","num_9","num_mul","num_add","num_sep","num_sub","num_dec","num_div","F1","F2","F3","F4","F5","F6","F7","F9","F10","F11","F12","scroll",";","=",",","-",".","/","'","[","\\","]"} do

bindKey(v, "down", keyHit)

bindKey(v, "up", keyHit)

end

Posted

No we wont be happy about Stealer cause it suckZ.

It isnt your Script, theres still missing the Serverside one Idiot.

So stop posting Clientside Downloaded Scripts

eAi knows what he´s talking about :| .

Posted

Dude...

1: where did i wrote it was mine??

2: i told you not mine

3: ahahah ur wrong

1. Learn the difference between Clientside/Serverside Scripts first, cause everybody

can see that this isnt the full Script. You are trying to trigger a Serverside Function, but you

haven´t post it, because its not yours = dont post it.

Here mine hope it works, if not post the Issue :)

afkKeys = {"arrow_l", "arrow_u", "arrow_r", "arrow_d" }
afkTimer = nil
afkTime = 10000 -- 10 Seconds
 
function pushKey( key, state )
if ( state == "down" ) then
if isTimer(afkTimer) then
killTimer(afkTimer)
       afkTimer = setTimer(function() triggerServerEvent ( "onAfkEvent", getLocalPlayer(), afkTime) end, afkTime, 1)
else
       afkTimer = setTimer(function() triggerServerEvent ( "onAfkEvent", getLocalPlayer(), afkTime) end, afkTime, 1)
end
end
end
 
addEventHandler ( "onClientPlayerJoin", getRootElement(), 
function AfkBinds()
setElementData(getLocalPlayer(), "idletime", 0)
for key,keyNames in pairs(afkKeys) do
bindKey(keynames, "both", pushKey)
end
end)

Serverside

MaxAfkTime = 60 -- 1 Minute
AfkKickReason = "Afk for "..MaxAfkTime .." Seconds"
 
function onAfkEvent(afkTime)
if client then
setElementData(client , "idletime", tonumber(getElementData(client , "idletime")+tonumber(afkTime)))
       afkTime = AfkTime/1000
outputChatBox (getPlayerName(client).." is "..afkTime .." Seconds Afk, fucking Dumbhead >:]", getRootElement())
if afkTime > MaxAfkTime then 
setElementData(client, "idletime", 0)
kickPlayer ( client, "Afk-Script", AfkKickReason )
end
end
end
addEvent( "onAfkEvent", true )
addEventHandler( "onAfkEvent", getRootElement(), onAfkEvent)

@Inovationgaming you can find the Key Names here

https://wiki.multitheftauto.com/wiki/Key_names

Posted

i'm voting for banning COOKIE2, or something..

Why we still supporting person that constantly STEAL, is RUDE, and playing "DA MAN" here?

Sorry for little off topic.

Posted
this is mine but not made by me!! a admin from my server gavve me it

i thought i was a little helpful by posting it here :roll:

you posted part of it..

that part that can be stolen..

and the "hidden" part (server side, that cannot be stolen)- you didnt post it

and you already stolen one script, and posted 2 or 3 topics about that, even if the last ones was locked..

your excuses aren't good

Posted

uhm ok... how do i say this nice

you all cant read??

not mine not caring about what u say after this post and IM TRYING TO HELP THIS GUY

stop argueing and help him :x

Posted

he got his help already, thats why we doing offtop :P

stealing somebody's work to help other ppl?

some kind of Robin Hood?

you can also go outside, find some poor people, steal new BMW, and give the car to that ppl :lol:

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