Jump to content

[HELP] AFK Script and JoyPad


=KoG=Rouche

Recommended Posts

Posted

Hi all !

I use a AFK killer script and i've a big problem.

Some of my players play with a JoyPad ... and the afk script detect only keybord action.

So when they play, the AFK kill them for afk.

Is there a way to add JoyPad action to the script ?

Posted

Try using onClientRender to reset the timer.

getAnalogControlState 

Will help you with it. The code should look like this.

function renderReset() 
   local F = getAnalogControlState("accelerate") 
   local B = getAnalogControlState("brake_reverse") 
   local L = getAnalogControlState("vehicle_left") 
   local R = getAnalogControlState("vehicle_right") 
   if F > 0 or B > 0 or L > 0 or R > 0 then 
      resetTimer() -- Reset your AFK timer here 
   end 
end 
addEventHandler("onClientRender",getRootElement(),renderReset) 

Posted

Keep in mind; this is a dirty way of fixing it. There are other ways, like binding your buttons or restarting the timer whenever a button has been pressed / moved with the JoyPad.

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