Skip to content

Commit

Permalink
fix: use exports (#42)
Browse files Browse the repository at this point in the history
* fix: use exports

* fix: lint error
  • Loading branch information
Manason authored Sep 28, 2023
1 parent 6021a92 commit c1209e6
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 84 deletions.
4 changes: 2 additions & 2 deletions client/carwash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RegisterNetEvent('qb-carwash:client:washCar', function()
WashDecalsFromVehicle(cache.vehicle, 1.0)
washingVehicle = false
else -- if cancel
QBX.Functions.Notify('Washing canceled...', 'error')
exports.qbx_core:Notify('Washing canceled...', 'error')
washingVehicle = false
end
end)
Expand All @@ -42,7 +42,7 @@ CreateThread(function()
if dirtLevel > Config.CarWash.dirtLevel then
TriggerServerEvent('qb-carwash:server:washCar')
else
QBX.Functions.Notify('The vehicle isn\'t dirty', 'error')
exports.qbx_core:Notify('The vehicle isn\'t dirty', 'error')
end
end
else
Expand Down
46 changes: 23 additions & 23 deletions client/consumables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ RegisterNetEvent('consumables:client:Eat', function(itemName)
combat = true
}
}) then -- if completed
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items[itemName], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()[itemName], 'remove')
exports.scully_emotemenu:cancelEmote()
TriggerServerEvent('consumables:server:addHunger', QBX.PlayerData.metadata.hunger + ConsumablesEat[itemName])
TriggerServerEvent('hud:server:RelieveStress', math.random(2, 4))
Expand All @@ -182,7 +182,7 @@ RegisterNetEvent('consumables:client:Drink', function(itemName)
combat = true
}
}) then -- if completed
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items[itemName], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()[itemName], 'remove')
exports.scully_emotemenu:cancelEmote()
TriggerServerEvent('consumables:server:addThirst', QBX.PlayerData.metadata.thirst + ConsumablesDrink[itemName])
end
Expand All @@ -203,7 +203,7 @@ RegisterNetEvent('consumables:client:DrinkAlcohol', function(itemName)
}
}) then -- if completed
exports.scully_emotemenu:cancelEmote()
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items[itemName], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()[itemName], 'remove')
TriggerServerEvent('consumables:server:drinkAlcohol', itemName)
TriggerServerEvent('consumables:server:addThirst', QBX.PlayerData.metadata.thirst + ConsumablesAlcohol[itemName])
TriggerServerEvent('hud:server:RelieveStress', math.random(2, 4))
Expand All @@ -215,7 +215,7 @@ RegisterNetEvent('consumables:client:DrinkAlcohol', function(itemName)
end
else -- if canceled
exports.scully_emotemenu:cancelEmote()
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)

Expand All @@ -238,11 +238,11 @@ RegisterNetEvent('consumables:client:Cokebaggy', function()
}
}) then -- if completed
TriggerServerEvent('consumables:server:useCokeBaggy')
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['cokebaggy'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['cokebaggy'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 200)
cokeBaggyEffect()
else -- if canceled
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)

Expand All @@ -265,11 +265,11 @@ RegisterNetEvent('consumables:client:Crackbaggy', function()
}
}) then -- if completed
TriggerServerEvent('consumables:server:useCrackBaggy')
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['crack_baggy'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['crack_baggy'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 300)
crackBaggyEffect()
else -- if canceled
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)

Expand All @@ -292,10 +292,10 @@ RegisterNetEvent('consumables:client:EcstasyBaggy', function()
}
}) then -- if completed
TriggerServerEvent('consumables:server:useXTCBaggy')
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items.xtcbaggy, 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items().xtcbaggy, 'remove')
ecstasyEffect()
else -- if canceled
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)

Expand All @@ -318,11 +318,11 @@ RegisterNetEvent('consumables:client:oxy', function()
}
}) then -- if completed
TriggerServerEvent('consumables:server:useOxy')
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['oxy'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['oxy'], 'remove')
ClearPedBloodDamage(cache.ped)
healOxy()
else -- if canceled
QBX.Functions.Notify('Canceled', 'error')
exports.qbx_core:Notify('Canceled', 'error')
end
end)

Expand All @@ -345,12 +345,12 @@ RegisterNetEvent('consumables:client:meth', function()
}
}) then -- if completed
TriggerServerEvent('consumables:server:useMeth')
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['meth'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['meth'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 300)
TriggerEvent('evidence:client:SetStatus', 'agitated', 300)
methBagEffect()
else -- if canceled
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)

Expand All @@ -367,7 +367,7 @@ RegisterNetEvent('consumables:client:UseJoint', function()
combat = true
}
}) then -- if completed
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['joint'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['joint'], 'remove')
exports.scully_emotemenu:playEmoteByCommand('joint')
TriggerEvent('evidence:client:SetStatus', 'weedsmell', 300)
smokeWeed()
Expand All @@ -388,7 +388,7 @@ RegisterNetEvent('consumables:client:UseParachute', function()
combat = true
}
}) then -- if completed
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['parachute'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['parachute'], 'remove')
GiveWeaponToPed(cache.ped, `GADGET_PARACHUTE`, 1, false, false)
local parachuteData = {
outfitData = {['bag'] = {item = 7, texture = 0}} -- Adding Parachute Clothing
Expand Down Expand Up @@ -423,12 +423,12 @@ RegisterNetEvent('consumables:client:ResetParachute', function()
parachuteEquipped = false
end
else
QBX.Functions.Notify('You don\'t have a parachute...', 'error')
exports.qbx_core:Notify('You don\'t have a parachute...', 'error')
end
end)

RegisterNetEvent('consumables:client:UseArmor', function()
if GetPedArmour(cache.ped) >= 75 then QBX.Functions.Notify('You already have enough armor on!', 'error') return end
if GetPedArmour(cache.ped) >= 75 then exports.qbx_core:Notify('You already have enough armor on!', 'error') return end
if lib.progressBar({
duration = 5000,
label = 'Putting on the body armour...',
Expand All @@ -441,15 +441,15 @@ RegisterNetEvent('consumables:client:UseArmor', function()
combat = true
}
}) then -- if completed
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['armor'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['armor'], 'remove')
TriggerServerEvent('hospital:server:SetArmor', 75)
TriggerServerEvent('consumables:server:useArmor')
SetPedArmour(cache.ped, 75)
end
end)

RegisterNetEvent('consumables:client:UseHeavyArmor', function()
if GetPedArmour(cache.ped) == 100 then QBX.Functions.Notify('You already have enough armor on!', 'error') return end
if GetPedArmour(cache.ped) == 100 then exports.qbx_core:Notify('You already have enough armor on!', 'error') return end
if lib.progressBar({
duration = 5000,
label = 'Putting on body armor...',
Expand All @@ -475,7 +475,7 @@ RegisterNetEvent('consumables:client:UseHeavyArmor', function()
currentVestTexture = GetPedTextureVariation(cache.ped, 30)
SetPedComponentVariation(cache.ped, 9, 30, 0, 2)
end
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['heavyarmor'], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['heavyarmor'], 'remove')
TriggerServerEvent('consumables:server:useHeavyArmor')
SetPedArmour(cache.ped, 100)
end
Expand All @@ -497,11 +497,11 @@ RegisterNetEvent('consumables:client:ResetArmor', function()
}) then -- if completed
SetPedComponentVariation(cache.ped, 9, currentVest, currentVestTexture, 2)
SetPedArmour(cache.ped, 0)
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items['heavyarmor'], 'add')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()['heavyarmor'], 'add')
TriggerServerEvent('consumables:server:resetArmor')
end
else
QBX.Functions.Notify('You\'re not wearing a vest...', 'error')
exports.qbx_core:Notify('You\'re not wearing a vest...', 'error')
end
end)

Expand Down
8 changes: 4 additions & 4 deletions client/cruise.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local function TriggerCruiseControl()
if cruisedSpeed > 0 and GetVehicleCurrentGear(cache.vehicle) > 0 then

TriggerEvent('seatbelt:client:ToggleCruise')
QBX.Functions.Notify('Cruise control enabled!', 'success')
exports.qbx_core:Notify('Cruise control enabled!', 'success')

CreateThread(function()
while cruisedSpeed > 0 and cache.vehicle do
Expand All @@ -42,7 +42,7 @@ local function TriggerCruiseControl()
if not turningOrBraking and speed < (cruisedSpeed - 1.5) then
cruisedSpeed = 0
TriggerEvent('seatbelt:client:ToggleCruise')
QBX.Functions.Notify('Cruise control disabled!', 'error')
exports.qbx_core:Notify('Cruise control disabled!', 'error')
Wait(500)
break
end
Expand All @@ -59,7 +59,7 @@ local function TriggerCruiseControl()
if IsControlJustPressed(2, 72) then
cruisedSpeed = 0
TriggerEvent('seatbelt:client:ToggleCruise')
QBX.Functions.Notify('Cruise control disabled!', 'error')
exports.qbx_core:Notify('Cruise control disabled!', 'error')
Wait(500)
break
end
Expand All @@ -76,7 +76,7 @@ RegisterCommand('togglecruise', function()
if vehicleClasses[vehicleClass] then
TriggerCruiseControl()
else
QBX.Functions.Notify('Cruise control unavailable', 'error')
exports.qbx_core:Notify('Cruise control unavailable', 'error')
end
end
end, false)
Expand Down
4 changes: 2 additions & 2 deletions client/fireworks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ RegisterNetEvent('fireworks:client:UseFirework', function(itemName, assetName)
},
}) then
TriggerServerEvent('consumables:server:UseFirework', itemName)
TriggerEvent('inventory:client:ItemBox', QBX.Shared.Items[itemName], 'remove')
TriggerEvent('inventory:client:ItemBox', exports.ox_inventory:Items()[itemName], 'remove')
local pos = GetEntityCoords(cache.ped)
doFirework(assetName, pos)
else
QBX.Functions.Notify('Canceled...', 'error')
exports.qbx_core:Notify('Canceled...', 'error')
end
end)
2 changes: 1 addition & 1 deletion client/seatbelt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ end)
RegisterNetEvent('seatbelt:client:UseHarness', function(ItemData)
local class = GetVehicleClass(cache.vehicle)
if not cache.vehicle or class == 8 or class == 13 or class == 14 then
QBX.Functions.Notify('You\'re not in a car.', 'error')
exports.qbx_core:Notify('You\'re not in a car.', 'error')
return
end
if not harnessOn then
Expand Down
4 changes: 2 additions & 2 deletions client/suicide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ RegisterCommand('suicide', function()
Wait(750)
SetPedShootsAtCoord(cache.ped, 0.0, 0.0, 0.0, 0)
SetEntityHealth(cache.ped, 0)
QBX.Functions.Notify('You killed yourself', 'error')
exports.qbx_core:Notify('You killed yourself', 'error')
else
QBX.Functions.Notify('You don\'t have a pistol with ammo in your hand', 'error')
exports.qbx_core:Notify('You don\'t have a pistol with ammo in your hand', 'error')
end
end, false)
2 changes: 1 addition & 1 deletion client/vehicletext.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CreateThread(function()
for _, v in pairs(QBX.Shared.Vehicles) do
for _, v in pairs(exports.qbx_core:GetVehiclesByName()) do
local text
if v.brand then
text = v.brand .. ' ' .. v.name
Expand Down
1 change: 0 additions & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ files {
}

modules {
'qbx_core:core',
'qbx_core:playerdata',
'qbx_core:utils'
}
Expand Down
6 changes: 3 additions & 3 deletions server/afk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local timeMinutes = {
}

local function updateCheckUser(source)
local permissions = QBX.Functions.GetPermission(source)
local permissions = exports.qbx_core:GetPermission(source)

for k in pairs(permissions) do
if Config.IgnoreGroupsForAFK[k] then
Expand Down Expand Up @@ -66,9 +66,9 @@ CreateThread(function()
if time[v] > 0 then
local _type = timeMinutes[time[v]]
if _type == 'minutes' then
QBX.Functions.Notify(v, 'You are AFK and will be kicked in ' .. math.ceil(time[v] / 60) .. ' minute(s)!', 'error', 10000)
exports.qbx_core:Notify(v, 'You are AFK and will be kicked in ' .. math.ceil(time[v] / 60) .. ' minute(s)!', 'error', 10000)
elseif _type == 'seconds' then
QBX.Functions.Notify(v, 'You are AFK and will be kicked in ' .. time[v] .. ' seconds!', 'error', 10000)
exports.qbx_core:Notify(v, 'You are AFK and will be kicked in ' .. time[v] .. ' seconds!', 'error', 10000)
end
time[v] -= 1
else
Expand Down
Loading

0 comments on commit c1209e6

Please sign in to comment.