Skip to content

Commit 8f91206

Browse files
committed
Don't import whole core
1 parent 3f33e2c commit 8f91206

4 files changed

Lines changed: 23 additions & 17 deletions

File tree

client/deliveries.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
local QBCore = exports['qb-core']:GetCoreObject({ 'Functions' })
22
local JobsDone = 0
33
local LocationsDone = {}
44
local CurrentLocation = nil

client/main.lua

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
local QBCore = exports['qb-core']:GetCoreObject({ 'Functions' })
22
local currentShop, playerData
33
local pedSpawned = false
44
local listen = false
@@ -169,9 +169,16 @@ RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
169169
deletePeds()
170170
end)
171171

172-
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(jobInfo)
173-
if not playerData or not playerData.job then return end
174-
playerData.job = jobInfo
172+
RegisterNetEvent('QBCore:Client:OnPlayerUpdated', function(key, val)
173+
if key == 'job' then
174+
local jobInfo = val
175+
if not playerData or not playerData.job then return end
176+
playerData.job = jobInfo
177+
elseif key == 'all' then
178+
local jobInfo = val.job
179+
if not playerData or not playerData.job then return end
180+
playerData.job = jobInfo
181+
end
175182
end)
176183

177184
AddEventHandler('onResourceStart', function(resourceName)

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ game 'gta5'
33
lua54 'yes'
44
author 'Kakarot'
55
description 'Allows players to purchase items from various shops around the map'
6-
version '1.2.1'
6+
version '1.5.0'
77

88
shared_scripts {
99
'@PolyZone/client.lua',

server/main.lua

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
21
local Bail = {}
32

43
-- Functions
@@ -33,14 +32,14 @@ local function saveShopInv(shop, products)
3332
end
3433

3534
local function deliveryPay(source, shop)
36-
local Player = QBCore.Functions.GetPlayer(source)
35+
local Player = exports['qb-core']:GetPlayer(source)
3736
if not Player then return end
3837
local playerPed = GetPlayerPed(source)
3938
local playerCoords = GetEntityCoords(playerPed)
4039
local deliverCoords = Config.Locations[shop].delivery
4140
local distance = #(playerCoords - vector3(deliverCoords.x, deliverCoords.y, deliverCoords.z))
4241
if distance > 10 then return end
43-
Player.Functions.AddMoney('bank', Config.DeliveryPrice, 'qb-shops:deliveryPay')
42+
Player.AddMoney('bank', Config.DeliveryPrice, 'qb-shops:deliveryPay')
4443
if math.random(100) <= 10 then exports['qb-inventory']:AddItem(source, Config.RewardItem, 1, false, false, 'qb-shops:deliveryPay') end
4544
end
4645

@@ -74,13 +73,13 @@ end)
7473

7574
RegisterNetEvent('qb-shops:server:DoBail', function(bool)
7675
local src = source
77-
local Player = QBCore.Functions.GetPlayer(src)
76+
local Player = exports['qb-core']:GetPlayer(src)
7877
if bool then
79-
if Player.Functions.RemoveMoney('cash', Config.TruckDeposit, 'tow-received-bail') then
78+
if Player.RemoveMoney('cash', Config.TruckDeposit, 'tow-received-bail') then
8079
Bail[Player.PlayerData.citizenid] = Config.TruckDeposit
8180
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.paid_with_cash', { value = Config.TruckDeposit }), 'success')
8281
TriggerClientEvent('qb-shops:client:SpawnVehicle', src)
83-
elseif Player.Functions.RemoveMoney('bank', Config.TruckDeposit, 'tow-received-bail') then
82+
elseif Player.RemoveMoney('bank', Config.TruckDeposit, 'tow-received-bail') then
8483
Bail[Player.PlayerData.citizenid] = Config.TruckDeposit
8584
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.paid_with_bank', { value = Config.TruckDeposit }), 'success')
8685
TriggerClientEvent('qb-shops:client:SpawnVehicle', src)
@@ -89,7 +88,7 @@ RegisterNetEvent('qb-shops:server:DoBail', function(bool)
8988
end
9089
else
9190
if Bail[Player.PlayerData.citizenid] then
92-
Player.Functions.AddMoney('cash', Bail[Player.PlayerData.citizenid], 'trucker-bail-paid')
91+
Player.AddMoney('cash', Bail[Player.PlayerData.citizenid], 'trucker-bail-paid')
9392
Bail[Player.PlayerData.citizenid] = nil
9493
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.refund_to_cash', { value = Config.TruckDeposit }), 'success')
9594
end
@@ -103,13 +102,13 @@ RegisterNetEvent('qb-shops:server:PaySlip', function(drops)
103102
local coords = Config.DeliveryLocations['main'].coords
104103
local distance = #(playerCoords - vector3(coords.x, coords.y, coords.z))
105104
if distance > 10 then return end
106-
local Player = QBCore.Functions.GetPlayer(src)
105+
local Player = exports['qb-core']:GetPlayer(src)
107106
if not Player then return end
108107
local completedDrops = tonumber(drops)
109108
if not drops then return end
110109
local payment = Config.DeliveryPrice * completedDrops
111-
Player.Functions.AddMoney('bank', payment, 'trucker-salary')
112-
Player.Functions.AddRep('delivery', completedDrops)
110+
Player.AddMoney('bank', payment, 'trucker-salary')
111+
Player.AddRep('delivery', completedDrops)
113112
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.you_earned', { value = payment }), 'success')
114113
end)
115114

@@ -120,7 +119,7 @@ RegisterNetEvent('qb-shops:server:openShop', function(data)
120119
local shopName = data.shop
121120
local shopData = Config.Locations[shopName]
122121
if not shopData then return end
123-
local Player = QBCore.Functions.GetPlayer(src)
122+
local Player = exports['qb-core']:GetPlayer(src)
124123
if not Player then return end
125124
local playerData = Player.PlayerData
126125
local products = shopData.products

0 commit comments

Comments
 (0)