Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Job Type for Group results #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions server/framework/qb-core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ local resourceName = 'qb-core'
if not GetResourceState(resourceName):find('start') then return end

SetTimeout(0, function()
local QB = exports[resourceName]:GetCoreObject()
local QB = exports[resourceName]:GetCoreObject()

GetPlayer = QB.Functions.GetPlayer
GetPlayer = QB.Functions.GetPlayer

if GetResourceState('ox_inventory') == 'missing' then
function RemoveItem(playerId, item, slot)
local player = GetPlayer(playerId)
local player = GetPlayer(playerId)

if player then player.Functions.RemoveItem(item, 1, slot) end
if player then player.Functions.RemoveItem(item, 1, slot) end
end

---@param player table
Expand All @@ -21,7 +21,7 @@ SetTimeout(0, function()
function DoesPlayerHaveItem(player, items, removeItem)
for i = 1, #items do
local item = items[i]
local itemName = item.name or item
local itemName = item.name or item

if item.metadata then
local playerItems = player.Functions.GetItemsByName(itemName)
Expand Down Expand Up @@ -50,7 +50,7 @@ SetTimeout(0, function()
end
end
end
end
end
end)

function GetCharacterId(player)
Expand All @@ -68,6 +68,8 @@ function IsPlayerInGroup(player, filter)

if data.name == filter then
return data.name, data.grade.level
elseif data.type == filter then
return data.type, data.grade.level
end
end
else
Expand All @@ -77,9 +79,12 @@ function IsPlayerInGroup(player, filter)
for i = 1, #groups do
local data = player.PlayerData[groups[i]]
local grade = filter[data.name]
local grade2 = filter[data.type]

if grade and grade <= data.grade.level then
return data.name, data.grade.level
elseif grade2 and grade2 <= data.grade.level then
return data.type, data.grade.level
end
end
elseif tabletype == 'array' then
Expand All @@ -91,6 +96,8 @@ function IsPlayerInGroup(player, filter)

if data.name == group then
return data.name, data.grade.level
elseif data.type == group then
return data.type, data.grade.level
end
end
end
Expand Down