• Print

Author Topic: Integrating ULX into murder?  (Read 4409 times)

0 Members and 1 Guest are viewing this topic.

Offline Jerpy

  • Newbie
  • *
  • Posts: 21
  • Karma: 2
Integrating ULX into murder?
« on: January 31, 2015, 01:30:10 pm »
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: [Select]
if !client:IsAdmin() then return end 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: [Select]
concommand.Add("mu_adminpanel", function (client)
     if ply:IsUserGroup("mod") then
     elseif ply:IsUserGroup("admin") then
     elseif ply:IsUserGroup("officer") then return end

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: [Select]
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)

Offline lamb201

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
Re: Integrating ULX into murder?
« Reply #1 on: January 31, 2015, 03:21:36 pm »
Hey :)
Try this:

Code: Lua
  1. concommand.Add("mu_adminpanel", function (client)
  2.  
  3.         usergroup = client:GetNWString( "usergroup" )
  4.         if usergroup ~= "mod" or usergroup ~= "admin" or usergroup ~= "officer" then return end;
  5.  
  6.         if IsValid(menu) then
  7.                 menu:SetVisible(true)
  8.         else
  9.                 menu = vgui.Create("DFrame")
  10.                 menu:SetSize(ScrW() * 0.9, ScrH() * 0.9)
  11.                 menu:Center()
  12.                 menu:MakePopup()
  13.                 menu:SetKeyboardInputEnabled(false)
  14.                 menu:SetDeleteOnClose(false)
  15.                 menu:SetDraggable(true)
  16.                 menu:ShowCloseButton(true)
  17.                 menu:SetTitle(translate.adminPanel)
  18.                 function menu:PerformLayout()
  19.                         if menu.Players then
  20.                                 menu.Players:SetWidth(self:GetWide() * 0.5)
  21.                         end
  22.                 end
  23.  
  24.                 local refresh = vgui.Create("DButton", menu)
  25.                 refresh:Dock(TOP)
  26.                 refresh:SetText(translate.scoreboardRefresh)
  27.                 refresh:SetTextColor(color_white)
  28.                 refresh:SetFont("Trebuchet18")
  29.                 function refresh:DoClick()
  30.                         net.Start("mu_adminpanel_details")
  31.                         net.SendToServer()
  32.                 end
  33.                 function refresh:Paint(w, h)
  34.                         surface.SetDrawColor(team.GetColor(2))
  35.                         surface.DrawRect(0, 0, w, h)
  36.  
  37.                         surface.SetDrawColor(255,255,255,10)
  38.                         surface.DrawRect(0, 0, w, h * 0.45 )
  39.  
  40.                         surface.SetDrawColor(color_black)
  41.                         surface.DrawOutlinedRect(0, 0, w, h)
  42.  
  43.                         if self:IsDown() then
  44.                                 surface.SetDrawColor(50,50,50,120)
  45.                                 surface.DrawRect(1, 1, w - 2, h - 2)
  46.                         elseif self:IsHovered() then
  47.                                 surface.SetDrawColor(255,255,255,30)
  48.                                 surface.DrawRect(1, 1, w - 2, h - 2)
  49.                         end
  50.                 end
  51.  
  52.                 function menu:Paint()
  53.                         surface.SetDrawColor(Color(40,40,40,255))
  54.                         surface.DrawRect(0, 0, menu:GetWide(), menu:GetTall())
  55.                 end
  56.  
  57.                 menu.Players = makeTeamList(menu, 2)
  58.                 menu.Players:Dock(FILL)
  59.  
  60.         end
  61.         net.Start("mu_adminpanel_details")
  62.         net.SendToServer()
  63. end)

The code you did returns them if they are that group.
« Last Edit: January 31, 2015, 03:24:15 pm by lamb201 »

Offline Jerpy

  • Newbie
  • *
  • Posts: 21
  • Karma: 2
Re: Integrating ULX into murder?
« Reply #2 on: February 01, 2015, 12:38:07 pm »
Thanks for the help, but that didn't work. No script errors; but no rank was able to access the adminpanel. Didn't say 'you dont have access to this' or anything, but just nothing happens when it is entered in console.

Offline lamb201

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
Re: Integrating ULX into murder?
« Reply #3 on: February 02, 2015, 08:29:32 am »
Did you remove

Code: Lua
  1. local canUse = GAMEMODE.RoundSettings.AdminPanelAllowed
  2.         if !canUse then return end
  3.  


?

  • Print