Skip to content

Commit

Permalink
refactor: using core exports (#18)
Browse files Browse the repository at this point in the history
* chore: nonexistent module -Axxu

* fix: QBX.Function.GetPlayer -> exports.qbx_core:GetPlayer
  • Loading branch information
AxxuDEV authored Oct 3, 2023
1 parent 636f3d8 commit c1895b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ client_script 'client/main.lua'
server_script 'server/main.lua'

modules {
'qbx_core:core',
'qbx_core:playerdata',
'qbx_core:utils'
}
}
10 changes: 5 additions & 5 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RegisterNetEvent('qb-vehiclekeys:server:AcquireVehicleKeys', function(plate)
end)

RegisterNetEvent('qb-vehiclekeys:server:breakLockpick', function(itemName)
local player = QBX.Functions.GetPlayer(source)
local player = exports.qbx_core:GetPlayer(source)
if not player then return end
if not (itemName == "lockpick" or itemName == "advancedlockpick") then return end
if player.Functions.RemoveItem(itemName, 1) then
Expand All @@ -49,7 +49,7 @@ RegisterNetEvent('qb-vehiclekeys:server:setVehLockState', function(vehNetId, sta
end)

lib.callback.register('qbx-vehiclekeys:server:getVehicleKeys', function(source)
local citizenid = QBX.Functions.GetPlayer(source).PlayerData.citizenid
local citizenid = exports.qbx_core:GetPlayer(source).PlayerData.citizenid
local keysList = {}
for plate, citizenids in pairs (vehicleList) do
if citizenids[citizenid] then
Expand All @@ -63,7 +63,7 @@ end)
---- Functions ----
-----------------------
function GiveKeys(id, plate)
local citizenid = QBX.Functions.GetPlayer(id).PlayerData.citizenid
local citizenid = exports.qbx_core:GetPlayer(id).PlayerData.citizenid

if not vehicleList[plate] then vehicleList[plate] = {} end
vehicleList[plate][citizenid] = true
Expand All @@ -73,7 +73,7 @@ function GiveKeys(id, plate)
end

function RemoveKeys(id, plate)
local citizenid = QBX.Functions.GetPlayer(id).PlayerData.citizenid
local citizenid = exports.qbx_core:GetPlayer(id).PlayerData.citizenid

if vehicleList[plate] and vehicleList[plate][citizenid] then
vehicleList[plate][citizenid] = nil
Expand All @@ -83,7 +83,7 @@ function RemoveKeys(id, plate)
end

function HasKeys(id, plate)
local citizenid = QBX.Functions.GetPlayer(id).PlayerData.citizenid
local citizenid = exports.qbx_core:GetPlayer(id).PlayerData.citizenid
if vehicleList[plate] and vehicleList[plate][citizenid] then
return true
end
Expand Down

0 comments on commit c1895b8

Please sign in to comment.