Nice I added the code you gave above at line 23 and it works well and hide healthbars on guildies. But other people around that are not in my guild still have their healthbars under their name. Where else can I put
nameplate.UnitFrame.healthBar:Hide() to hide other people healthbars?
Lua Code:
local guildie={}
local f=CreateFrame("Frame")
f:RegisterEvent("GUILD_ROSTER_UPDATE")
f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
f:SetScript("OnEvent",function(self,event,unit)
if event=="GUILD_ROSTER_UPDATE" then
local total=GetNumGuildMembers()
wipe(guildie)
for i=1,total do
local guid=select(17,GetGuildRosterInfo(i))
local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid)
if guid then
guildie[guid]=true
end
end
elseif event=="NAME_PLATE_UNIT_ADDED" then
local guid = UnitGUID(unit)
local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid)
if guildie[guid] then
PlaySound(416)
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
nameplate.UnitFrame.name:SetTextColor(1,1,1,1)
nameplate.UnitFrame.healthBar:Hide()
print(name)
end
end
end)