DirTyMaN Posted April 12, 2019 Share Posted April 12, 2019 Hi I need an anti-afk source Please give me one and tell me how to set up I have this source but did not work even with acl access in the admins section I am a beginner. Please explain well. Thank you for the quick answer. Link to comment
Overkillz Posted April 14, 2019 Share Posted April 14, 2019 There are already a lot of anti-afk resources around the community. Just take some time to search one of them. Otherwise, you can build your own one using bindKey setTimer Link to comment
Ab-47 Posted April 16, 2019 Share Posted April 16, 2019 Could you be more specific about what you want? I could walk you through setting it up or creating one yourself. Link to comment
DirTyMaN Posted April 18, 2019 Author Share Posted April 18, 2019 On 17/04/2019 at 02:15, Ab-47 said: Could you be more specific about what you want? I could walk you through setting it up or creating one yourself. Hi, I'm going to kick off a player who has been afk-free for more than 30 minutes without sleep, and the player who wanted to afk for more than 5 minutes has kicked off the chats for all the server's player, and the playerName Kicked By ParsMTA -Bot Reason: Afk 30min withou sleep, something like this or the like. I'm glad to explain the complete separation of the client file and the file server and the meta inside them what to write. Link to comment
Overkillz Posted April 18, 2019 Share Posted April 18, 2019 Im not partidary of doing the code for other people who don't even try to do it, but you are a lucky day. BTW: Not tested I bassed anti-afk keys assuming that the player is in vehicle due to I have never worked about the movement of player out the vehicle. local afkTime = 30 --In Minutes local antiAFKkeys = {"accelerate", "vehicle_left", "vehicle_right", "brake_reverse"} --Check out more keys at https://wiki.multitheftauto.com/wiki/Key_names kickerTimer = setTimer(function() triggerServerEvent("onkickPlayerFromServer",localPlayer) end,afkTime*1000*60,1) function afkReset() resetTimer(kickerTimer) end do for i,key in ipairs(antiAFKkeys) do bindKey ( key, "down", afkReset ) end end --##Server Side function kickPlayerFromServer() kickPlayer (source) outputChatBox(getPlayerName(source).." #ffffffhas been kicked by ANTI-AFK BOT",root,255,255,255,true) end addEvent("onkickPlayerFromServer",true) addEventHandler("onkickPlayerFromServer",getRootElement(),kickPlayerFromServer) Regards. Link to comment
DirTyMaN Posted April 18, 2019 Author Share Posted April 18, 2019 this is not bad. but i am beginner please : client server meta Explain Link to comment
Ayush Rathore Posted April 19, 2019 Share Posted April 19, 2019 (edited) On 18/04/2019 at 20:52, AlirezaPlus said: this is not bad. but i am beginner please : client server meta Explain Using @Overkillz script Make a folder in resource directory named antiafk make three files: afk_c.lua, afk_s.lua, meta.xml in afk_s.lua paste: function kickPlayerFromServer() kickPlayer (source) outputChatBox(getPlayerName(source).." #ffffffhas been kicked by ANTI-AFK BOT",root,255,255,255,true) end addEvent("onkickPlayerFromServer",true) addEventHandler("onkickPlayerFromServer",getRootElement(),kickPlayerFromServer) in afk_c.lua paste: local afkTime = 30 --In Minutes local antiAFKkeys = {"accelerate", "vehicle_left", "vehicle_right", "brake_reverse"} --Check out more keys at https://wiki.multitheftauto.com/wiki/Key_names kickerTimer = setTimer(function() triggerServerEvent("onkickPlayerFromServer",localPlayer) end,afkTime*1000*60,1) function afkReset() resetTimer(kickerTimer) end do for i,key in ipairs(antiAFKkeys) do bindKey ( key, "down", afkReset ) end end in meta.xml paste this: <meta> <info author="OVERKILLZ" type="script" name="ANTI-AFK" /> <script src="afk_c.lua" type="client" cache="false" /> <script src="afk_s.lua" type="server" /> </meta> Now go to your server window and type refresh or refreshall and then type start antiafk Edited April 19, 2019 by Ayush Rathore 1 1 Link to comment
DirTyMaN Posted April 22, 2019 Author Share Posted April 22, 2019 I like you Thanks. 1 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