Now I can realize these functions through the following lua code

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:
----------------------------------------------------------------
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!