local meta = FindMetaTable("Player") function meta:ChooseRandPSDropItem() for k, v in pairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCONSOLE, "Called!") end self.PSDropItems = table.Copy(PS.Items) -- This should remove blacklisted entities from the table... for k, ITEM in pairs(self.PSDropItems) do for k, v in pairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCONSOLE, k.." "..ITEM.ID) end local CATEGORY = PS:FindCategoryByName(ITEM.Category) local r, message = false, nil -- MY own custom tables if table.HasValue(PSDrops.ItemBlackList, ITEM.ID) then r = true end if table.HasValue(PSDrops.CatBlackList, CATEGORY.Name) then r = true end -- CanPlayerBuy support. If you can't buy it, you can't get it. if (type(ITEM.CanPlayerBuy) == "function") then r = not ITEM:CanPlayerBuy(self) elseif (type(ITEM.CanPlayerBuy) == "boolean") then r = not ITEM.CanPlayerBuy end -- Custom for my server. if ITEM.AdminOnly and not (self:IsMod() or self:IsAdmin()) then r = true end if ITEM.VIPOnly and not self:IsVIP() then r = true end -- See Category support. if CATEGORY.CanPlayerSee and not CATEGORY:CanPlayerSee(self) then r = true end -- Allowed usergroups support. if (ITEM.AllowedUserGroups and #ITEM.AllowedUserGroups > 0) and ( !table.HasValue(ITEM.AllowedUserGroups, self:PS_GetUsergroup() ) ) then r = true end if (CATEGORY.AllowedUserGroups and #CATEGORY.AllowedUserGroups > 0) and ( !table.HasValue(CATEGORY.AllowedUserGroups, self:PS_GetUsergroup() ) ) then r = true end -- And finally, remove it from the droptable! if r then table.RemoveByValue(self.PSDropItems, k) for k, v in pairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCONSOLE, ITEM.Name.." removed from "..self:Nick().."'s ItemTable") end end end for k, v in pairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCONSOLE,"Print Table...") end MsgAll(PrintTable(self.PSDropItems)) for k, v in pairs(self.PSDropItems) do end return table.Random(self.PSDropItems) end