View Single Post
02-29-16, 03:22 AM   #1
sdsadasdsa
A Defias Bandit
Join Date: Feb 2015
Posts: 3
need help on lua code~~

Now I can realize these functions through the following lua code(provide by @Phanx,thanks to him)

1.hide and replace player name to "newplayername"
2.hide and replace pet name to "newpetname"
3.hide and replace target of target name
4.hide and replace target of focus name
5.replace friend and enemy player name to their classic name

the following lua code:
Code:
 local CUSTOM_PLAYER_TEXT = "newplayername"
 local CUSTOM_PET_TEXT = "newpetname"
 
local function SetCustomName(unit, fontString)
 if UnitIsUnit(unit, "player") then
 fontString:SetText(CUSTOM_PLAYER_TEXT)
 elseif UnitIsPlayer(unit) then
 fontString:SetText(strupper(UnitClass(unit)))
 else
 fontString:SetText(CUSTOM_PET_TEXT)
 end
 end
 
hooksecurefunc("UnitFrame_Update", function(frame, isParty)
 if frame.name then
 SetCustomName(frame.overrideName or frame.unit, frame.name)
 end
 end)
 
hooksecurefunc("CompactUnitFrame_UpdateName", function(frame)
 SetCustomName(frame.unit, frame.name)
 end)

but can i ask two questions more,how can i :

1.how to hide and replace my name on scoreboard in arean/BG/RBG?also replace friend and enemy player name to their classic name

2.how to hide and replace my name on addon"recount/skada"?also replace friend and enemy player name to their classic name

tyyyyyyyyyyyyyyyyyyvm!

Last edited by sdsadasdsa : 02-29-16 at 03:30 AM.
  Reply With Quote