• Admin tab help
    4 replies, posted
I want my headadmins to be able to have access but they cant,this is the code [CODE]surface.CreateFont('PS_Heading', { font = 'coolvetica', size = 64 }) surface.CreateFont('PS_Heading2', { font = 'coolvetica', size = 24 }) surface.CreateFont('PS_Heading3', { font = 'coolvetica', size = 19 }) local ALL_ITEMS = 1 local OWNED_ITEMS = 2 local UNOWNED_ITEMS = 3 local function BuildItemMenu(menu, ply, itemstype, callback) local plyitems = ply:PS_GetItems() for category_id, CATEGORY in pairs(PS.Categories) do local catmenu = menu:AddSubMenu(CATEGORY.Name) table.SortByMember(PS.Items, PS.Config.SortItemsBy, function(a, b) return a > b end) for item_id, ITEM in pairs(PS.Items) do if ITEM.Category == CATEGORY.Name then if itemstype == ALL_ITEMS or (itemstype == OWNED_ITEMS and plyitems[item_id]) or (itemstype == UNOWNED_ITEMS and not plyitems[item_id]) then catmenu:AddOption(ITEM.Name, function() callback(item_id) end) end end end end end local PANEL = {} function PANEL:Init() self:SetSize( math.Clamp( 1024, 0, ScrW() ), math.Clamp( 768, 0, ScrH() ) ) self:SetPos((ScrW() / 2) - (self:GetWide() / 2), (ScrH() / 2) - (self:GetTall() / 2)) -- close button local closeButton = vgui.Create('DButton', self) closeButton:SetFont('marlett') closeButton:SetText('r') closeButton:SetColor(Color(255, 255, 255)) closeButton:SetSize(15, 15) closeButton:SetDrawBackground(false) closeButton:SetPos(self:GetWide() - 25, 10) closeButton.DoClick = function() PS:ToggleMenu() end local tabs = vgui.Create('DPropertySheet', self) if PS.Config.DisplayPreviewInMenu then tabs:DockMargin(10, 80, 410, 10) else tabs:DockMargin(10, 80, 10, 10) end tabs:Dock(FILL) tabs:SetSize(self:GetWide() - 60, self:GetTall() - 150) tabs:SetPos((self:GetWide() / 2) - (tabs:GetWide() / 2), 120) -- sorting local categories = {} for _, i in pairs(PS.Categories) do table.insert(categories, i) end table.sort(categories, function(a, b) if a.Order == b.Order then return a.Name < b.Name else return a.Order < b.Order end end) local items = {} for _, i in pairs(PS.Items) do table.insert(items, i) end table.SortByMember(items, PS.Config.SortItemsBy, function(a, b) return a > b end) -- items for _, CATEGORY in pairs(categories) do if CATEGORY.AllowedUserGroups and #CATEGORY.AllowedUserGroups > 0 then if not table.HasValue(CATEGORY.AllowedUserGroups, LocalPlayer():PS_GetUsergroup()) then continue end end if CATEGORY.CanPlayerSee then if not CATEGORY:CanPlayerSee(LocalPlayer()) then continue end end local ShopCategoryTab = vgui.Create('DPanel') local DScrollPanel = vgui.Create('DScrollPanel', ShopCategoryTab) DScrollPanel:Dock(FILL) local ShopCategoryTabLayout = vgui.Create('DIconLayout', DScrollPanel) ShopCategoryTabLayout:Dock(FILL) ShopCategoryTabLayout:SetBorder(10) ShopCategoryTabLayout:SetSpaceX(10) ShopCategoryTabLayout:SetSpaceY(10) DScrollPanel:AddItem(ShopCategoryTabLayout) for _, ITEM in pairs(items) do if ITEM.Category == CATEGORY.Name then local model = vgui.Create('DPointShopItem') model:SetData(ITEM) model:SetSize(126, 126) ShopCategoryTabLayout:Add(model) end end tabs:AddSheet(CATEGORY.Name, ShopCategoryTab, 'icon16/' .. CATEGORY.Icon .. '.png', false, false, '') end if (PS.Config.AdminCanAccessAdminTab and LocalPlayer():IsAdmin()) or (PS.Config.SuperAdminCanAccessAdminTab and LocalPlayer():IsSuperAdmin()) or (PS.Config.OwnerCanAccessAdminTab and LocalPlayer():IsUserGroup("Owner")) then -- admin tab local AdminTab = vgui.Create('DPanel') local ClientsList = vgui.Create('DListView', AdminTab) ClientsList:DockMargin(10, 10, 10, 10) ClientsList:Dock(FILL) ClientsList:SetMultiSelect(false) ClientsList:AddColumn('Name') ClientsList:AddColumn('Points'):SetFixedWidth(60) ClientsList:AddColumn('Items'):SetFixedWidth(60) ClientsList.OnClickLine = function(parent, line, selected) local ply = line.Player local menu = DermaMenu() menu:AddOption('Set '..PS.Config.PointsName..'...', function() Derma_StringRequest( "Set "..PS.Config.PointsName.." for " .. ply:GetName(), "Set "..PS.Config.PointsName.." to...", "", function(str) if not str or not tonumber(str) then return end net.Start('PS_SetPoints') net.WriteEntity(ply) net.WriteInt(tonumber(str), 32) net.SendToServer() end ) end) menu:AddOption('Give '..PS.Config.PointsName..'...', function() Derma_StringRequest( "Give "..PS.Config.PointsName.." to " .. ply:GetName(), "Give "..PS.Config.PointsName.."...", "", function(str) if not str or not tonumber(str) then return end net.Start('PS_GivePoints') net.WriteEntity(ply) net.WriteInt(tonumber(str), 32) net.SendToServer() end ) end) menu:AddOption('Take '..PS.Config.PointsName..'...', function() Derma_StringRequest( "Take "..PS.Config.PointsName.." from " .. ply:GetName(), "Ta
did you mis > "Do not post huge scripts and expect people to fix them. If you wrote the script then you should know why it doesn't work. If you're editing someone's script and can't get it to work then don't! Learn how to code!"
You can't just change the group name of a variable and expect it to work :v:
[QUOTE=Invule;46134426]did you mis > "Do not post huge scripts and expect people to fix them. If you wrote the script then you should know why it doesn't work. If you're editing someone's script and can't get it to work then don't! Learn how to code!"[/QUOTE] Did you miss the part where you dont post if youre going to be an absolute cunt? :D Im asking for help on HOW TO ADD PEOPLE TO ADMIN TAB,READ THE FUCKING TITLE, i just posted the part i thought i should edit as i have no idea how to do this specific part
[CODE]LocalPlayer():GetNWString("usergroup") == "Owner"[/CODE] if your head admins aren't considered an admin then you are doing something wrong with the groups and I'm kind of confused on what you are asking here.
Sorry, you need to Log In to post a reply to this thread.