Ulysses

General => Developers Corner => Topic started by: Azzy :3 on June 29, 2015, 02:52:10 AM

Title: Scoreboard Button
Post by: Azzy :3 on June 29, 2015, 02:52:10 AM
EDIT: I'm sorry! I fixed it! You can delete this topic. ;-;

Hey, guys! Sorry in advance, I'm like seriously new to this and I need just a little help because I couldn't find an answer anywhere.

I run a murder server and I want to add a button on my scoreboard that admins can use to slay AND warn people at the same time.. So far, I've only managed to do two buttons to do that separately which is a bit of an inconvenience for my admins because RDMers always get warned and slain. Anyway, here's my code for all of the buttons on the menu and I really hope you can help me.


Code: [Select]
if IsValid(LocalPlayer()) && LocalPlayer():IsAdmin() then
actions:AddSpacer()

if ply:Team() == 2 then
local spectate = actions:AddOption( Translator:QuickVar(translate.adminMoveToSpectate, "spectate", team.GetName(1)) )
spectate:SetIcon( "icon16/status_busy.png" )
function spectate:DoClick()
RunConsoleCommand("mu_movetospectate", ply:EntIndex())
end

local punish = actions:AddOption( translate.NRSlay )
punish:SetIcon( "icon16/delete.png" )
function punish:DoClick()
RunConsoleCommand("ulx", "slaynr", ply:Nick())
end
local punish = actions:AddOption( translate.Warn )
punish:SetIcon( "icon16/delete.png" )
function punish:DoClick()
RunConsoleCommand("awarn_warn", ply:Nick(), "RDM")
end

local force = actions:AddOption( translate.adminMurdererForce )
force:SetIcon( "icon16/delete.png" )
function force:DoClick()
RunConsoleCommand("mu_forcenextmurderer", ply:EntIndex())
end
local profile = actions:AddOption( translate.Profile )
profile:SetIcon( "icon16/user_edit.png" )
function profile:DoClick()
RunConsoleCommand("ulx", "profile", ply:Nick())

end

local steamId = actions:AddOption( translate.SteamID )
steamId:SetIcon( "icon16/tag_blue.png" )
function steamId:DoClick()
SetClipboardText(ply:SteamID())

end

if ply:Alive() then
local specateThem = actions:AddOption( translate.adminSpectate )
specateThem:SetIcon( "icon16/status_online.png" )
function specateThem:DoClick()
RunConsoleCommand("mu_spectate", ply:EntIndex())
end
end
end
end

actions:Open()
end