local f=CreateFrame("frame"); local function eventhandler(self,event,...) local arg = ...; if((arg==SPELL_FAILED_NOT_MOUNTED or arg==ERR_TAXIPLAYERALREADYMOUNTED) and (GetCVarBool("autoDismountFlying")==1 or IsFlying()==nil)) then Dismount(); end end f:RegisterEvent("UI_ERROR_MESSAGE"); f:SetScript("OnEvent",eventhandler);