Gravestone Posted June 1, 2016 Posted June 1, 2016 (edited) This code sets the player's alpha to 100 who goes afk for more than 45 seconds. It should set his alpha back to 255 when he moves hi mouse, moves himself or clicks any button. Client side: function removeAFK (player) if getElementData(player, "AFK") == "true" then setElementAlpha(player, 255) end end addEventHandler("onClientMouseMove", root, removeAFK) The server side code does detect the movement but a bit late. And this client side scripts isn't detecting the movement. Thanks in advance. Edited June 1, 2016 by Guest Clan war system http://sh.st/7r4nI
Moderators IIYAMA Posted June 1, 2016 Moderators Posted June 1, 2016 if getElementData(player, "AFK") then Or if getElementData(player, "AFK") == true then Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Gravestone Posted June 1, 2016 Author Posted June 1, 2016 I tried it already. In both cases, it will return the value true. The problem is something else, which I can't figure out. Clan war system http://sh.st/7r4nI
ozulus Posted June 1, 2016 Posted June 1, 2016 Client side function removeAFK() --there isn't player arg. in onClientMouseMove event. check wiki for available arguments of event. if getElementData(localPlayer, "AFK") then setElementAlpha(localPlayer, 255) --note: in client-side, source(player) is localPlayer. end end addEventHandler("onClientMouseMove", root, removeAFK)
Gravestone Posted June 1, 2016 Author Posted June 1, 2016 Alright. Setting alpha back to normal when the mouse moves works. What about when the player moves? Clan war system http://sh.st/7r4nI
tosfera Posted June 1, 2016 Posted June 1, 2016 use onClientKey or onClientCharacter. They'll trigger once a player presses a button. Just add them to the function removeAFK. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Gravestone Posted June 1, 2016 Author Posted June 1, 2016 It's working now. Thanks for the help. Clan war system http://sh.st/7r4nI
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