Skip to content

Commit

Permalink
Merge pull request #7 from Giana/update/duty-check
Browse files Browse the repository at this point in the history
Update/duty check
  • Loading branch information
Giana committed Mar 19, 2023
2 parents 4c77679 + 389a220 commit 8b80304
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ G-DrugSelling is a script for FiveM QBCore for selling drugs (or any items) from

**IMAGES**
-----
Coming Soon
![Drug Selling NPC](https://i.ibb.co/rZHcgPr/drugsellingnpc.png)
![Drug Selling NPC Target](https://i.ibb.co/cQ3NPPS/drugsellingnpctarget.png)
![Drug Selling NPC Sell Rewards](https://i.ibb.co/5LB815k/drugsellingnpcsellrewards.png)

**DEPENDENCIES**
-----
Expand All @@ -29,4 +31,4 @@ Coming Soon
**CREDIT**
-----
Code excerpts for NPC spawning and the concept of NPC render distance were repurposed and refactored from [pickle_farming](https://github.com/PickleModifications/pickle_farming).
Code excerpts for getting and caching current police count were repurposed from [qb-jewelery](https://github.com/qbcore-framework/qb-jewelery).
Code excerpts for caching current police count were repurposed from [qb-jewelery](https://github.com/qbcore-framework/qb-jewelery).
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ game 'gta5'

author 'Giana - github.com/Giana'
description 'g-drugselling'
version '1.0.0'
version '1.1.0'

shared_scripts {
'@qb-core/shared/locale.lua',
Expand Down
13 changes: 4 additions & 9 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ end)

QBCore.Functions.CreateCallback('g-drugselling:server:getCopCount', function(source, cb)
local src = source
local policeCount = 0
for _, v in pairs(QBCore.Functions.GetQBPlayers()) do
if v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then
policeCount = policeCount + 1
end
end
CachedPolice[src] = policeCount
cb(policeCount)
end)
local amount = QBCore.Functions.GetDutyCount('police')
CachedPolice[src] = amount
cb(amount)
end)

0 comments on commit 8b80304

Please sign in to comment.