General > Developers Corner

Integrating ULX into murder?

(1/1)

Jerpy:
Currently all I'm looking for is to give access to my usergroups in ulx to mu_adminpanel
If anyone has any knowledge on how to replace
--- Code: ---if !client:IsAdmin() then return end
--- End code ---
with the ulx version of this, I would be happy. I tried already with the whole ply:IsUserGroup("mod") however this did not work. I put them in order like this, although I'm slightly new to lua so I'm not positive if I edited it right. Where concommand.Add starts in cl_adminpanel.lua - this is where you edit the groups that have access to it. Here is something like I did.


--- Code: ---concommand.Add("mu_adminpanel", function (client)
     if ply:IsUserGroup("mod") then
     elseif ply:IsUserGroup("admin") then
     elseif ply:IsUserGroup("officer") then return end

--- End code ---

Of course with all the adminpanel code under what I've included is not necessary since we wont have to change that. I know I did this wrong because it did not work, but this is a possibility that its because I should've changed (client) to (ply) ? That's probably not it either, so I could use some input on this, especially from anyone that has done murder with ULX groups that are not just 'admin' or 'superadmin'

If you dont want to go find a whole portion of this part of the script online if you don't have one handy, feel free to find it right here:


--- Code: ---concommand.Add("mu_adminpanel", function (client)
if !client:IsAdmin() then return end
local canUse = GAMEMODE.RoundSettings.AdminPanelAllowed
if !canUse then return end

if IsValid(menu) then
menu:SetVisible(true)
else
menu = vgui.Create("DFrame")
menu:SetSize(ScrW() * 0.9, ScrH() * 0.9)
menu:Center()
menu:MakePopup()
menu:SetKeyboardInputEnabled(false)
menu:SetDeleteOnClose(false)
menu:SetDraggable(true)
menu:ShowCloseButton(true)
menu:SetTitle(translate.adminPanel)
function menu:PerformLayout()
if menu.Players then
menu.Players:SetWidth(self:GetWide() * 0.5)
end
end

local refresh = vgui.Create("DButton", menu)
refresh:Dock(TOP)
refresh:SetText(translate.scoreboardRefresh)
refresh:SetTextColor(color_white)
refresh:SetFont("Trebuchet18")
function refresh:DoClick()
net.Start("mu_adminpanel_details")
net.SendToServer()
end
function refresh:Paint(w, h)
surface.SetDrawColor(team.GetColor(2))
surface.DrawRect(0, 0, w, h)

surface.SetDrawColor(255,255,255,10)
surface.DrawRect(0, 0, w, h * 0.45 )

surface.SetDrawColor(color_black)
surface.DrawOutlinedRect(0, 0, w, h)

if self:IsDown() then
surface.SetDrawColor(50,50,50,120)
surface.DrawRect(1, 1, w - 2, h - 2)
elseif self:IsHovered() then
surface.SetDrawColor(255,255,255,30)
surface.DrawRect(1, 1, w - 2, h - 2)
end
end

function menu:Paint()
surface.SetDrawColor(Color(40,40,40,255))
surface.DrawRect(0, 0, menu:GetWide(), menu:GetTall())
end

menu.Players = makeTeamList(menu, 2)
menu.Players:Dock(FILL)

end
net.Start("mu_adminpanel_details")
net.SendToServer()
end)

--- End code ---

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given

[0] Board index

Go to full version