Jump to content

Help AFK !!


E-mail

Recommended Posts

Hi all

i need to make this script work for BaseMode :mrgreen:

See Plase Help me !!

---ClientSide 
  
afkKeys = {"arrow_l", "arrow_u", "arrow_r", "arrow_d" } 
afkTimer = nil 
afkTime = 25000 -- 25 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 
  
function AfkKeys() 
  setElementData(getLocalPlayer(), "idletime", 0) 
  for key,keyNames in pairs(afkKeys) do 
     bindKey(keynames, "both", pushKey) 
  end 
end 
addEventHandler ( "onClientPlayerJoin", getRootElement(), AfkKeys) 
  
  

-- 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!", getRootElement()) 
        if afkTime > MaxAfkTime then  
             setElementData(client, "idletime", 0) 
             kickPed ( client, "Afk-Script", AfkKickReason ) 
        end 
    end 
end 
addEvent( "onAfkEvent", true ) 
addEventHandler( "onAfkEvent", getRootElement(), onAfkEvent) 
  
-- Coded by Timic 

Link to comment

Thx For Try 50P its not work i start debugscript 3 Nothing show :(

  
  
afkKeys = {"arrow_l", "arrow_u", "arrow_r", "arrow_d" } 
afkTimer = nil 
afkTime = 25000 -- 25 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 
  
function AfkKeys() 
  setElementData(getLocalPlayer(), "idletime", 0) 
  for key,keyNames in pairs(afkKeys) do 
     bindKey(keynames, "both", pushKey) 
  end 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(), AfkKeys) 
  
  

Link to comment

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