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

Update/duty check #7

Merged
merged 6 commits into from
Mar 19, 2023
Merged
Show file tree
Hide file tree
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
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)