Author Topic: Scoreboard Admin  (Read 3376 times)

0 Members and 1 Guest are viewing this topic.

Offline cynel

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Scoreboard Admin
« on: October 22, 2013, 01:09:35 PM »
Hi, I am currently trying to add some commands to my scoreboard just for ease of use really..

However I'm having a little trouble trying to add the final touches. I have an Admin sub menu, within this sub menu I want to have another sub menu, however I have no idea how I would go about adding this sub menu.

Code: [Select]
local ply = self.Player

if ply:IsValid() then
surface.PlaySound("buttons/button9.wav")
local options = DermaMenu()
options:AddOption("Copy Name", function() SetClipboardText(ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/user_edit.png")
options:AddOption("Copy SteamID", function() SetClipboardText(ply:SteamID()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/tag_blue.png")
options:AddOption("Open Profile", function() ply:ShowProfile() surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/world.png")
options:AddSpacer()
local adminop,subimg = options:AddSubMenu("Admin") subimg:SetImage("icon16/lorry.png")
-- Another SubMenu "Teleport"
adminop:AddOption("Bring", function() RunConsoleCommand("ulx","bring",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Go To", function() RunConsoleCommand("ulx","goto",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("TP", function() RunConsoleCommand("ulx","teleport",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Force Spectator"
adminop:AddOption("Enable", function() RunConsoleCommand("ulx","fspec",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Disable", function() RunConsoleCommand("ulx","unspec",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Slay Queue"
adminop:AddOption("Remove Slay Next Round", function() RunConsoleCommand("ulx","slaynr",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("RDM", function() RunConsoleCommand("ulx","slaynr",ply:Nick(), "RDM") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","slaynr",ply:Nick(), "Attempted RDM") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("False KOS", function() RunConsoleCommand("ulx","slaynr",ply:Nick(), "False KOS") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","slaynr",ply:Nick(), "Traitor Baiting") surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Slay"
adminop:AddOption("Slay", function() RunConsoleCommand("ulx","slay",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("RDM", function() RunConsoleCommand("ulx","slay",ply:Nick(), "RDM") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","slay",ply:Nick(), "Attempted RDM") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("False KOS", function() RunConsoleCommand("ulx","slay",ply:Nick(), "False KOS") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","slay",ply:Nick(), "Traitor Baiting") surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Gag"
adminop:AddOption("Enable", function() RunConsoleCommand("ulx","gag",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Disable", function() RunConsoleCommand("ulx","gag",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Mute"
adminop:AddOption("Enable", function() RunConsoleCommand("ulx","mute",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Disable", function() RunConsoleCommand("ulx","unmute",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Gimp"
adminop:AddOption("Enable", function() RunConsoleCommand("ulx","gimp",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Disable", function() RunConsoleCommand("ulx","ungimp",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
-- Another SubMenu "Ban"
adminop:AddOption("FBan", function() RunConsoleCommand("xgui","fban",ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/delete.png")
adminop:AddOption("XBan", function() RunConsoleCommand("xgui","xban",ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/delete.png")
-- Another SubMenu "Kick"
adminop:AddOption("RDM", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for RDM.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for Attempted RDM.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("False KOS", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for False KOS.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for Traitor Baiting.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Being a pain", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for being a pain.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Spawn", function() RunConsoleCommand("ulx","spawn",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Karma", function() RunConsoleCommand("ulx","karma", ply:Nick(), "1000", "Has had their Karma reset to 1000") surface.PlaySound("buttons/button9.wav") end)
options:Open()
end

end

As you can see the places where I have inserted a comment is where I propose to have another sub menu. Any help would be appreciated! Thanks

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Scoreboard Admin
« Reply #1 on: October 22, 2013, 01:56:05 PM »
This example from Garry's code shows the key parts needed to do a submenu. In fact, your code already has one submenu in it, all you need to do is create different submenus and be sure to give them unique names.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline cynel

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Scoreboard Admin
« Reply #2 on: October 22, 2013, 04:54:07 PM »
This example from Garry's code shows the key parts needed to do a submenu. In fact, your code already has one submenu in it, all you need to do is create different submenus and be sure to give them unique names.

Hi, thanks for your advice! I understand how to add a new sub menu, but what I want to do is add the Teleport, Slay Queue, Slay, Gag, Mute, Force sub menus within my admin menu. Do you have any idea how that could be accomplished? Thanks again. (Provided an updated version of the code)

Code: [Select]
local ply = self.Player

if ply:IsValid() then
surface.PlaySound("buttons/button9.wav")
local options = DermaMenu()
options:AddOption("Copy Name", function() SetClipboardText(ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/user_edit.png")
options:AddOption("Copy SteamID", function() SetClipboardText(ply:SteamID()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/tag_blue.png")
options:AddOption("Open Profile", function() ply:ShowProfile() surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/world.png")
options:AddSpacer()
local adminop,subimg = options:AddSubMenu("Admin") subimg:SetImage("icon16/lorry.png")
local teleport,subimg = options:AddSubMenu("Teleport")
teleport:AddOption("Bring", function() RunConsoleCommand("ulx","bring",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
teleport:AddOption("Go To", function() RunConsoleCommand("ulx","goto",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
teleport:AddOption("TP", function() RunConsoleCommand("ulx","teleport",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
local force,subimg = options:AddSubMenu("Force")
force:AddOption("Enable", function() RunConsoleCommand("ulx","fspec",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
force:AddOption("Disable", function() RunConsoleCommand("ulx","unspec",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
local slayq,subimg = options:AddSubMenu("SlayQueue")
slayq:AddOption("Remove Slay Next Round", function() RunConsoleCommand("ulx","slaynr", "1",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
slayq:AddOption("RDM", function() RunConsoleCommand("ulx","slaynr", "1", ply:Nick(), "RDM") surface.PlaySound("buttons/button9.wav") end)
slayq:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","slaynr", "1", ply:Nick(), "Attempted RDM") surface.PlaySound("buttons/button9.wav") end)
slayq:AddOption("False KOS", function() RunConsoleCommand("ulx","slaynr", "1", ply:Nick(), "False KOS") surface.PlaySound("buttons/button9.wav") end)
slayq:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","slaynr", "1", ply:Nick(), "Traitor Baiting") surface.PlaySound("buttons/button9.wav") end)
local slay,subimg = options:AddSubMenu("Slay")
slay:AddOption("Slay", function() RunConsoleCommand("ulx","slay",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
slay:AddOption("RDM", function() RunConsoleCommand("ulx","slay",ply:Nick(), "RDM") surface.PlaySound("buttons/button9.wav") end)
slay:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","slay",ply:Nick(), "Attempted RDM") surface.PlaySound("buttons/button9.wav") end)
slay:AddOption("False KOS", function() RunConsoleCommand("ulx","slay",ply:Nick(), "False KOS") surface.PlaySound("buttons/button9.wav") end)
slay:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","slay",ply:Nick(), "Traitor Baiting") surface.PlaySound("buttons/button9.wav") end)
local gag,subimg = options:AddSubMenu("Gag")
gag:AddOption("Enable", function() RunConsoleCommand("ulx","gag",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
gag:AddOption("Disable", function() RunConsoleCommand("ulx","gag",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
local mute,subimg = options:AddSubMenu("Mute")
mute:AddOption("Enable", function() RunConsoleCommand("ulx","mute",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
mute:AddOption("Disable", function() RunConsoleCommand("ulx","unmute",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
local gimp,subimg = options:AddSubMenu("Gimp")
gimp:AddOption("Enable", function() RunConsoleCommand("ulx","gimp",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
gimp:AddOption("Disable", function() RunConsoleCommand("ulx","ungimp",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
local ban,subimg = options:AddSubMenu("Ban")
ban:AddOption("FBan", function() RunConsoleCommand("xgui","fban",ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/delete.png")
ban:AddOption("XBan", function() RunConsoleCommand("xgui","xban",ply:Nick()) surface.PlaySound("buttons/button9.wav") end):SetImage("icon16/delete.png")
local kick,subimg = options:AddSubMenu("Kick")
kick:AddOption("RDM", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for RDM.") surface.PlaySound("buttons/button9.wav") end)
kick:AddOption("Attempted RDM", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for Attempted RDM.") surface.PlaySound("buttons/button9.wav") end)
kick:AddOption("False KOS", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for False KOS.") surface.PlaySound("buttons/button9.wav") end)
kick:AddOption("Traitor Baiting", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for Traitor Baiting.") surface.PlaySound("buttons/button9.wav") end)
kick:AddOption("Being a pain", function() RunConsoleCommand("ulx","kick",ply:Nick(),"You've have been kicked for being a pain.") surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Spawn", function() RunConsoleCommand("ulx","spawn",ply:Nick()) surface.PlaySound("buttons/button9.wav") end)
adminop:AddOption("Karma", function() RunConsoleCommand("ulx","karma", ply:Nick(), "1000", "Has had their Karma reset to 1000") surface.PlaySound("buttons/button9.wav") end)
options:Open()
end

end

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Scoreboard Admin
« Reply #3 on: October 23, 2013, 01:32:32 PM »
You're very close- Just replace "options:AddSubMenu" with "adminop:AddSubMenu", and I *think* that should do the trick. It's been a while lol :P
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline cynel

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Scoreboard Admin
« Reply #4 on: October 23, 2013, 05:38:40 PM »
You're very close- Just replace "options:AddSubMenu" with "adminop:AddSubMenu", and I *think* that should do the trick. It's been a while lol :P

Thank you! I really appreciate it that you took a moment to help me out with this issue.