Quantcast
WoWInterface - View Single Post - Flashy name for nearby guild mates
View Single Post
05-02-21, 05:23 AM   #9
Yukka
An Aku'mai Servant
 
Yukka's Avatar
Join Date: Feb 2020
Posts: 33
Originally Posted by Kanegasi View Post

Lua Code:
  1. local guildie={}
  2. local f=CreateFrame("frame")
  3. f:RegisterEvent("GUILD_ROSTER_UPDATE")
  4. f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  5. f:SetScript("OnEvent",function(self,event,unit)
  6.     if event=="GUILD_ROSTER_UPDATE" then
  7.         local total=GetNumGuildMembers()
  8.         wipe(guildie)
  9.         for i=1,total do
  10.             local guid=select(17,GetGuildRosterInfo(i))
  11.             if guid then
  12.                 guildie[guid]=true
  13.             end
  14.         end
  15.     elseif event=="NAME_PLATE_UNIT_ADDED" then
  16.  
  17.         if guildie[UnitGUID(unit))] then
  18.             -- here's where the check happens
  19.             -- you can either do something with the nameplate
  20.             -- using C_NamePlate.GetNamePlateForUnit(unit) to get the frame
  21.             -- or something simple like play a sound to announce the guildie
  22.         end
  23.  
  24.     end
  25. end)
So after if guildie[UnitGUID(unit))] then if I just write Playsound(888) will it work? Or do I have to write something else? I'm still a bit confused x)

if guildie[UnitGUID(unit))] then
Playsound(888)
end

end
end)
  Reply With Quote