PHP код:
local GetTime,InviteUnit,tremove,tinsert,UnitInParty GetTime,InviteUnit,tremove,tinsert,UnitInParty

local frame
,tbl CreateFrame("frame"),{}

local lastinv 0
local 
function OnUpdate(self)
    if 
GetTime()-lastinv>3 then
        InviteUnit
(tremove(tbl,1))
        
lastinv GetTime()
        if 
#tbl==0 then
            
self:SetScript("OnUpdate",nil)
        
end
    end
end

frame
:SetScript("OnEvent",function(self,_,_,name)
    if 
UnitInParty(namethen return end
    tinsert
(tbl,name)
    if 
#tbl==1 then
        
self:SetScript("OnUpdate",OnUpdate)
    
end
end
)

SlashCmdList["AUTOINVITE"] = function()
    if 
frame:IsEventRegistered("CHAT_MSG_WHISPER"then
        frame
:UnregisterEvent("CHAT_MSG_WHISPER")
    else
        
frame:RegisterEvent("CHAT_MSG_WHISPER")
    
end
end
SLASH_AUTOINVITE1 
"/autoinv"