I am looking for a bit of help understanding how to add buttons correctly to the right click dropdown menu of a targeted player.
Here is my current code to add the buttons;
local playerMenuList = {"PLAYER","RAID_PLAYER","PARTY","FRIEND"}
UnitPopupButtons["GREEN_BUTTON"] = {text = "GREEN"}
UnitPopupButtons["YELLOW_BUTTON"] = {text = "YELLOW"}
UnitPopupButtons["RED_BUTTON"] = {text = "RED"}
}
for k,v in pairs(playerMenuList) do
table.insert(UnitPopupMenus[v],"GREEN_BUTTON")
table.insert(UnitPopupMenus[v],"YELLOW_BUTTON")
table.insert(UnitPopupMenus[v],"RED_BUTTON")
end
local function testPlayerMenuButton(self)
if self.value == "GREEN_BUTTON" then
print("GREEN_BUTTON clicked")
elseif self.value == "YELLOW_BUTTON" then
print("YELLOW_BUTTON clicked")
elseif self.value == "RED_BUTTON" then
print("RED_BUTTON clicked")
end
end
hooksecurefunc("UnitPopup_OnClick",testPlayerMenuButton)
I would like to only display one of the buttons based on a condition such as;
if xzy=="Red" then RED_BUTTON:Hide() YELLOW_BUTTON:Hide() GREEN_BUTTON:Show() elseif xyz=="Yellow" then RED_BUTTON:Hide() GREEN_BUTTON:Hide() YELLOW_BUTTON:Show() else GREEN_BUTTON:Hide() YELLOW_BUTTON:Hide() RED_BUTTON:Show() end
Any help would would be great.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello all
I am looking for a bit of help understanding how to add buttons correctly to the right click dropdown menu of a targeted player.
Here is my current code to add the buttons;
I would like to only display one of the buttons based on a condition such as;
Any help would would be great.