View Single Post
02-27-15, 11:15 PM   #117
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Originally Posted by Phanx View Post
You can use UnitIsAFK to see if the event was triggered by AFK, though you do have to keep track of the previous state outside of the event handler.
ok you're right... *cough* I must have been drunk the night when I programmed this...
hazukashi desu ^^

Code:
if event == "PLAYER_FLAGS_CHANGED" then
	local isAFK = UnitIsAFK("player")
	if not prevAFKState and isAFK then
		prevAFKState = true
		SetAwayMode(true)
	elseif prevAFKState and not isAFK then
		prevAFKState = false
		SetAwayMode(false)
	end
end
__________________

Last edited by syncrow : 02-27-15 at 11:21 PM.
  Reply With Quote