Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. --local addonname, namespace = ...
  2. local frame = CreateFrame("FRAME")
  3. frame:RegisterEvent("FRIENDLIST_UPDATE")
  4. frame:SetScript("OnEvent", function(self,event,...)
  5. local NumCurrentFriends = GetNumFriends()
  6. local CurrentFriends = {}
  7. for i = 1, NumCurrentFriends do
  8. local name = GetFriendInfo(i)
  9. if (name) then
  10. CurrentFriends[i] = name
  11. end
  12. end
  13. --print("fired")
  14. if tablenames then
  15. local allfound=true, itsfound,
  16.  
  17. for j = 1, #tablenames do --getn counts all entrys ~= nil in a table
  18. itsfound = 0
  19. for i = 1, NumCurrentFriends do
  20. if (CurrentFriends[i] == tablenames[j]) then
  21. itsfound = 1
  22. end
  23. end
  24.  
  25. if (itsfound == 0) then
  26. DEFAULT_CHAT_FRAME:AddMessage("|cFFFF0000Your friend "..tablenames[j].." is no longer on your friendlist.")
  27. allfound = false
  28. end
  29. end
  30. if allfound then
  31. DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00All your friends still exist")
  32. else
  33. DEFAULT_CHAT_FRAME:AddMessage("|cFFFF0000Some friends have been removed")
  34. end
  35. end
  36.  
  37. --print(tablenames)
  38. tablenames = CurrentFriends
  39. tablenames.oldfriendsnum = NumCurrentFriends
  40.  
  41. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement