Pointshop admin tab - ULX ranks

So I made custom ranks with ULX such as, Owner, Section Leader ETC… i still cant figure out a way to get the admin tab for the point shop to show up for my custom ulx ranks. Please help!

Edit the __category.lua file in the category’s folder.

The only folders I see are, accessories, headshatsmasks, playermodels, powerups, and trails. They all have _category files, but I don’t see an admin tab or admin folder any where.

Here is what I see, http://puu.sh/5Bjcq/96fa7872cc.png

If you give me the names of the specific groups you want to view the tab, then I can do it for you.

Just Owner

Is this what you’re looking for?

Put this is your sv_pointshop.lua file.


-- net hooks

net.Receive('PS_BuyItem', function(length, ply)
	ply:PS_BuyItem(net.ReadString())
end)

net.Receive('PS_SellItem', function(length, ply)
	ply:PS_SellItem(net.ReadString())
end)

net.Receive('PS_EquipItem', function(length, ply)
	ply:PS_EquipItem(net.ReadString())
end)

net.Receive('PS_HolsterItem', function(length, ply)
	ply:PS_HolsterItem(net.ReadString())
end)

net.Receive('PS_ModifyItem', function(length, ply)
	ply:PS_ModifyItem(net.ReadString(), net.ReadTable())
end)

-- player to player

net.Receive('PS_SendPoints', function(length, ply)
	local other = net.ReadEntity()
	local points = math.Clamp(net.ReadInt(32), 0, 1000000)
	
	if PS.Config.CanPlayersGivePoints and other and points and IsValid(other) and other:IsPlayer() and ply and IsValid(ply) and ply:IsPlayer() and ply:PS_HasPoints(points) then
		ply:PS_TakePoints(points)
		ply:PS_Notify('You gave ', other:Nick(), ' ', points, ' of your ', PS.Config.PointsName, '.')
		
		other:PS_GivePoints(points)
		other:PS_Notify(ply:Nick(), ' gave you ', points, ' of their ', PS.Config.PointsName, '.')
	end
end)

-- admin points

net.Receive('PS_GivePoints', function(length, ply)
	local other = net.ReadEntity()
	local points = net.ReadInt(32)
	
	if not PS.Config.AdminCanAccessAdminTab and not PS.Config.SuperAdminCanAccessAdminTab and not PS.Config.OwnerCanAccessAdminTab then return end
	
	local admin_allowed = PS.Config.AdminCanAccessAdminTab and ply:IsAdmin()
	local super_admin_allowed = PS.Config.SuperAdminCanAccessAdminTab and ply:IsSuperAdmin()
    local owner_allowed = PS.Config.OwnerCanAccessAdminTab and ply:IsUserGroup("Owner")
	
	if (admin_allowed or super_admin_allowed or owner_allowed) and other and points and IsValid(other) and other:IsPlayer() then
		other:PS_GivePoints(points)
		other:PS_Notify(ply:Nick(), ' gave you ', points, ' ', PS.Config.PointsName, '.')
	end
end)

net.Receive('PS_TakePoints', function(length, ply)
	local other = net.ReadEntity()
	local points = net.ReadInt(32)
	
	if not PS.Config.AdminCanAccessAdminTab and not PS.Config.SuperAdminCanAccessAdminTab and not PS.Config.OwnerCanAccessAdminTab then return end
	
	local admin_allowed = PS.Config.AdminCanAccessAdminTab and ply:IsAdmin()
	local super_admin_allowed = PS.Config.SuperAdminCanAccessAdminTab and ply:IsSuperAdmin()
    local owner_allowed = PS.Config.OwnerCanAccessAdminTab and ply:IsUserGroup("Owner")
	
	if (admin_allowed or super_admin_allowed or owner_allowed) and other and points and IsValid(other) and other:IsPlayer() then
		other:PS_TakePoints(points)
		other:PS_Notify(ply:Nick(), ' took ', points, ' ', PS.Config.PointsName, ' from you.')
	end
end)

net.Receive('PS_SetPoints', function(length, ply)
	local other = net.ReadEntity()
	local points = net.ReadInt(32)
	
	if not PS.Config.AdminCanAccessAdminTab and not PS.Config.SuperAdminCanAccessAdminTab and not PS.Config.OwnerCanAccessAdminTab then return end
	
	local admin_allowed = PS.Config.AdminCanAccessAdminTab and ply:IsAdmin()
	local super_admin_allowed = PS.Config.SuperAdminCanAccessAdminTab and ply:IsSuperAdmin()
    local owner_allowed = PS.Config.OwnerCanAccessAdminTab and ply:IsUserGroup("Owner")
	
	if (admin_allowed or super_admin_allowed or owner_allowed) and other and points and IsValid(other) and other:IsPlayer() then
		other:PS_SetPoints(points)
		other:PS_Notify(ply:Nick(), ' set your ', PS.Config.PointsName, ' to ', points, '.')
	end
end)

-- admin items

net.Receive('PS_GiveItem', function(length, ply)
	local other = net.ReadEntity()
	local item_id = net.ReadString()
	
	if not PS.Config.AdminCanAccessAdminTab and not PS.Config.SuperAdminCanAccessAdminTab and not PS.Config.OwnerCanAccessAdminTab then return end
	
	local admin_allowed = PS.Config.AdminCanAccessAdminTab and ply:IsAdmin()
	local super_admin_allowed = PS.Config.SuperAdminCanAccessAdminTab and ply:IsSuperAdmin()
    local owner_allowed = PS.Config.OwnerCanAccessAdminTab and ply:IsUserGroup("Owner")
	
	if (admin_allowed or super_admin_allowed or owner_allowed) and other and item_id and PS.Items[item_id] and IsValid(other) and other:IsPlayer() and not other:PS_HasItem(item_id) then
		other:PS_GiveItem(item_id)
	end
end)

net.Receive('PS_TakeItem', function(length, ply)
	local other = net.ReadEntity()
	local item_id = net.ReadString()
	
	if not PS.Config.AdminCanAccessAdminTab and not PS.Config.SuperAdminCanAccessAdminTab and not PS.Config.OwnerCanAccessAdminTab then return end
	
	local admin_allowed = PS.Config.AdminCanAccessAdminTab and ply:IsAdmin()
	local super_admin_allowed = PS.Config.SuperAdminCanAccessAdminTab and ply:IsSuperAdmin()
    local owner_allowed = PS.Config.OwnerCanAccessAdminTab and ply:IsUserGroup("Owner")
	
	if (admin_allowed or super_admin_allowed or owner_allowed) and other and item_id and PS.Items[item_id] and IsValid(other) and other:IsPlayer() and other:PS_HasItem(item_id) then
		-- holster it first without notificaiton
		other.PS_Items[item_id].Equipped = false
	
		local ITEM = PS.Items[item_id]
		ITEM:OnHolster(other)
		other:PS_TakeItem(item_id)
	end
end)

-- hooks

local KeyToHook = {
	F1 = "ShowHelp",
	F2 = "ShowTeam",
	F3 = "ShowSpare1",
	F4 = "ShowSpare2",
	None = "ThisHookDoesNotExist"
}

hook.Add(KeyToHook[PS.Config.ShopKey], "PS_ShopKey", function(ply)
	ply:PS_ToggleMenu()
end)

hook.Add('PlayerSpawn', 'PS_PlayerSpawn', function(ply) ply:PS_PlayerSpawn() end)
hook.Add('PlayerDeath', 'PS_PlayerDeath', function(ply) ply:PS_PlayerDeath() end)
hook.Add('PlayerInitialSpawn', 'PS_PlayerInitialSpawn', function(ply) ply:PS_PlayerInitialSpawn() end)
hook.Add('PlayerDisconnected', 'PS_PlayerDisconnected', function(ply) ply:PS_PlayerDisconnected() end)

hook.Add('PlayerSay', 'PS_PlayerSay', function(ply, text)
	if string.len(PS.Config.ShopChatCommand) > 0 then
		if string.sub(text, 0, string.len(PS.Config.ShopChatCommand)) == PS.Config.ShopChatCommand then
			ply:PS_ToggleMenu()
			return ''
		end
	end
end)

-- ugly networked strings

util.AddNetworkString('PS_Items')
util.AddNetworkString('PS_Points')
util.AddNetworkString('PS_BuyItem')
util.AddNetworkString('PS_SellItem')
util.AddNetworkString('PS_EquipItem')
util.AddNetworkString('PS_HolsterItem')
util.AddNetworkString('PS_ModifyItem')
util.AddNetworkString('PS_SendPoints')
util.AddNetworkString('PS_GivePoints')
util.AddNetworkString('PS_TakePoints')
util.AddNetworkString('PS_SetPoints')
util.AddNetworkString('PS_GiveItem')
util.AddNetworkString('PS_TakeItem')
util.AddNetworkString('PS_AddClientsideModel')
util.AddNetworkString('PS_RemoveClientsideModel')
util.AddNetworkString('PS_SendClientsideModels')
util.AddNetworkString('PS_SendNotification')
util.AddNetworkString('PS_ToggleMenu')

-- console commands

concommand.Add(PS.Config.ShopCommand, function(ply, cmd, args)
	ply:PS_ToggleMenu()
end)

concommand.Add('ps_clear_points', function(ply, cmd, args)
	if IsValid(ply) then return end -- only allowed from server console
	
	for _, ply in pairs(player.GetAll()) do
		ply:PS_SetPoints(0)
	end
	
	sql.Query("DELETE FROM playerpdata WHERE infoid LIKE '%PS_Points%'")
end)

concommand.Add('ps_clear_items', function(ply, cmd, args)
	if IsValid(ply) then return end -- only allowed from server console
	
	for _, ply in pairs(player.GetAll()) do
		ply.PS_Items = {}
		ply:PS_SendItems()
	end
	
	sql.Query("DELETE FROM playerpdata WHERE infoid LIKE '%PS_Items%'")
end)

-- version checker

PS.CurrentBuild = 0
PS.LatestBuild = 0
PS.BuildOutdated = false

local function CompareVersions()
	if PS.CurrentBuild < PS.LatestBuild then
		MsgN('PointShop is out of date!')
		MsgN('Local version: ' .. PS.CurrentBuild .. ', Latest version: ' .. PS.LatestBuild)

		PS.BuildOutdated = true
	else
		MsgN('PointShop is on the latest version.')
	end
end

function PS:CheckVersion()
	if file.Exists('data/pointshop_build.txt', 'GAME') then
		PS.CurrentBuild = tonumber(file.Read('data/pointshop_build.txt', 'GAME')) or 0
	end

	local url = self.Config.Branch .. 'data/pointshop_build.txt'
	http.Fetch( url,
		function( content ) -- onSuccess
			PS.LatestBuild = tonumber( content ) or 0
			CompareVersions()
		end,
		function(failCode) -- onFailure
			MsgN('PointShop couldn\'t check version.')
			MsgN(url, ' returned ', failCode)
		end
	)
end

-- data providers

PS.DataProviders = {}

function PS:LoadDataProviders()
	local files, _ = file.Find('providers/*', 'LUA')
	
	for _, filename in pairs(files) do
		PROVIDER = {}
		PROVIDER.__index = {}
		
		PROVIDER.ID = string.gsub(filename, '.lua', '')
		
		function PROVIDER:GetFallback()
			return self.DataProviders[self.Fallback]
		end
		
		include('providers/' .. filename)
		
		self.DataProviders[PROVIDER.ID] = PROVIDER
	end
end

function PS:GetPlayerData(ply, callback)
	local provider = self.DataProviders[self.Config.DataProvider]
	
	if not provider or not self.Config.DataProvider then
		Error('PointShop: Missing provider. Update ALL files when there is an update.')
		return
	end
	
	provider:GetData(ply, function(points, items)
		callback(PS:ValidatePoints(tonumber(points)), PS:ValidateItems(items))
	end)
end

function PS:SetPlayerData(ply, points, items)
	local provider = self.DataProviders[self.Config.DataProvider]
	
	if not provider or not self.Config.DataProvider then
		Error('PointShop: Missing provider. Update ALL files when there is an update.')
		return
	end
	
	provider:SetData(ply, points, items)
end

Put this in your sh_config.lua under PS.Config.SuperAdminCanAccessAdminTab


PS.Config.OwnerCanAccessAdminTab = true -- Can Owner access the Admin tab?

And lastly, replace line 209 of DPointShopMenu with


if (PS.Config.AdminCanAccessAdminTab and LocalPlayer():IsAdmin()) or (PS.Config.SuperAdminCanAccessAdminTab and LocalPlayer():IsSuperAdmin()) or (PS.Config.OwnerCanAccessAdminTab and LocalPlayer():IsUserGroup("Owner")) then

are you sure its line 209? line 209 just says end.
Actually, this is what I did, http://puu.sh/5BlkE/dd0b82ad1a.png. But im getting lua errors and the shop wont open

Sorry, I have a custom DPointShopMenu. Search for a line that says


if (PS.Config.AdminCanAccessAdminTab and LocalPlayer():IsAdmin()) or (PS.Config.SuperAdminCanAccessAdminTab and LocalPlayer():IsSuperAdmin()) then

Alright, I replaced it, but getting lua error. shop wont open

What’s the error?

[ERROR] addons/pointshop-master/lua/cl_pointshop.lua:14: attempt to index field ‘ShopMenu’ (a nil value)

  1. ToggleMenu - addons/pointshop-master/lua/cl_pointshop.lua:14
  2. func - addons/pointshop-master/lua/cl_pointshop.lua:65
    3. unknown - lua/includes/modules/net.lua:31

I did not even tamper with that file, and point shop wont even open.

Mine works just fine. Just manually drag in these files and it should fix your issue: https://www.dropbox.com/s/4sigrs6a6elafrq/pointshopfiles.rar

I deleted all the old files, and replaced them with the dropbox ones. Still not working =/ And just to make sure, is the dpointshopmenu line correct? http://puu.sh/5BmQI/a32387fd46.png

I just noticed your edit, and you did the DPointShopMenu wrong. Put this in DPointShopMenu.lua:


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(),
                                        "Take "..PS.Config.PointsName.."...",
                                        "",
                                        function(str)
                                                if not str or not tonumber(str) then return end
                                                
                                                net.Start('PS_TakePoints')
                                                        net.WriteEntity(ply)
                                                        net.WriteInt(tonumber(str), 32)
                                                net.SendToServer()
                                        end
                                )
                        end)
                        
                        menu:AddSpacer()
                        
                        BuildItemMenu(menu:AddSubMenu('Give Item'), ply, UNOWNED_ITEMS, function(item_id)
                                net.Start('PS_GiveItem')
                                        net.WriteEntity(ply)
                                        net.WriteString(item_id)
                                net.SendToServer()
                        end)
                        
                        BuildItemMenu(menu:AddSubMenu('Take Item'), ply, OWNED_ITEMS, function(item_id)
                                net.Start('PS_TakeItem')
                                        net.WriteEntity(ply)
                                        net.WriteString(item_id)
                                net.SendToServer()
                        end)
                        
                        menu:Open()
                end
                
                self.ClientsList = ClientsList
                
                tabs:AddSheet('Admin', AdminTab, 'icon16/shield.png', false, false, '')
        end
        
        -- preview panel

        local preview
        if PS.Config.DisplayPreviewInMenu then
                preview = vgui.Create('DPanel', self)
                
                preview:DockMargin(self:GetWide() - 400, 100, 10, 10)
                preview:Dock(FILL)
                
                local previewpanel = vgui.Create('DPointShopPreview', preview)
                previewpanel:Dock(FILL)
        end
        
        -- give points button
        
        if PS.Config.CanPlayersGivePoints then
                local givebutton = vgui.Create('DButton', preview or self)
                givebutton:SetText("Give "..PS.Config.PointsName)
                if PS.Config.DisplayPreviewInMenu then
                        givebutton:DockMargin(8, 8, 8, 8)
                else
                        givebutton:DockMargin(8, 0, 8, 8)
                end
                givebutton:Dock(BOTTOM)
                givebutton.DoClick = function()
                        vgui.Create('DPointShopGivePoints')
                end
        end
end

function PANEL:Think()
        if self.ClientsList then
                local lines = self.ClientsList:GetLines()
                
                for _, ply in pairs(player.GetAll()) do
                        local found = false
                        
                        for _, line in pairs(lines) do
                                if line.Player == ply then
                                        found = true
                                end
                        end
                        
                        if not found then
                                self.ClientsList:AddLine(ply:GetName(), ply:PS_GetPoints(), table.Count(ply:PS_GetItems())).Player = ply
                        end
                end
                
                for i, line in pairs(lines) do
                        if IsValid(line.Player) then
                                local ply = line.Player
                                
                                line:SetValue(1, ply:GetName())
                                line:SetValue(2, ply:PS_GetPoints())
                                line:SetValue(3, table.Count(ply:PS_GetItems()))
                        else
                                self.ClientsList:RemoveLine(i)
                        end
                end
        end
end

function PANEL:Paint()
        Derma_DrawBackgroundBlur(self)
        
        draw.RoundedBox(10, 0, 0, self:GetWide(), self:GetTall(), Color(0, 0, 0, 150))
        
        draw.SimpleText('PointShop', 'PS_Heading', 20, 10, color_white)
        draw.SimpleText('by _Undefined', 'PS_Heading2', 275, 50, color_white)
        draw.SimpleText('You have ' .. LocalPlayer():PS_GetPoints() .. ' ' .. PS.Config.PointsName, 'PS_Heading3', self:GetWide() - 10, 60, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_BOTTOM)
end

vgui.Register('DPointShopMenu', PANEL)

It worked, thanks so much!!! <3