diff --git a/shared/crafting.lua b/shared/crafting.lua index a9cb3d8..3c76c9a 100644 --- a/shared/crafting.lua +++ b/shared/crafting.lua @@ -168,7 +168,7 @@ function craftingMenu(data) headertxt = data.craftable.Headertxt, onBack = data.onBack or nil, canClose = true, - onExit = function() end, + onExit = data.onExit or (function() end), }) lookEnt(data.coords) end diff --git a/shared/isAnimal.lua b/shared/isAnimal.lua index f99c118..a50ec38 100644 --- a/shared/isAnimal.lua +++ b/shared/isAnimal.lua @@ -10,23 +10,6 @@ When running client-side (not on the server), the module checks the player's Ped after they load. - Usage Examples: - -- Check if the player's Ped is an animal: - local animalStatus = isPedAnimal() - - -- Check if a given Ped is a cat: - if isCat(somePed) then print("This is a cat!") end - - -- Determine if a Ped is a dog and whether it's big or small: - local isDogFlag, isBig = isDog(somePed) - - -- Retrieve a flat list of all animal model hashes: - local allAnimalModels = getAnimalModels() - - File Separation Suggestion: - For scalability, consider separating this module into two files: - • AnimalDetection.lua (for functions and callbacks) - • AnimalPedsData.lua (for the AnimalPeds table) ]] -- Global animal classification flags. diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua index 7281f1c..c8d850a 100644 --- a/shared/itemcontrol.lua +++ b/shared/itemcontrol.lua @@ -354,7 +354,7 @@ function getDurability(item) local durability = nil if isStarted(QBInv) or isStarted(PSInv) then local itemcheck = Core.Functions.GetPlayerData().items - for _, v in pairs(itemcheck) do + for k, v in pairs(itemcheck) do if v.name == item then if v.slot <= lowestSlot then lowestSlot = v.slot @@ -366,7 +366,7 @@ function getDurability(item) if isStarted(OXInv) then local itemcheck = exports[OXInv]:Search('slots', item) - for _, v in pairs(itemcheck) do + for k, v in pairs(itemcheck) do if v.slot <= lowestSlot then debugPrint(v.slot, itemcheck[k].metadata.durability) lowestSlot = v.slot diff --git a/shared/metaHandlers.lua b/shared/metaHandlers.lua index 81a0ebf..8a19766 100644 --- a/shared/metaHandlers.lua +++ b/shared/metaHandlers.lua @@ -28,7 +28,7 @@ function GetPlayer(source) return exports[QBXExport]:GetCoreObject().Functions.GetPlayer(source) elseif isStarted(ESXExport) then debugPrint("^6Bridge^7: ^3GetPlayer^7() ESXExport") - return exports[ESXExport]:GetPlayerFromId(source) + return ESX.GetPlayerFromId(source) elseif isStarted(OXCoreExport) then debugPrint("^6Bridge^7: ^3GetPlayer^7() OXCoreExport") return exports[OXCoreExport]:GetPlayer(source) diff --git a/shared/societybank.lua b/shared/societybank.lua index 75395c3..2657ed6 100644 --- a/shared/societybank.lua +++ b/shared/societybank.lua @@ -20,6 +20,8 @@ --- ``` function getSocietyAccount(society) local bankScript, amount = "", 0 + if society == nil or society == "none" then return amount end + if isStarted("qb-banking") then bankScript = "qb-banking" if not exports["qb-banking"]:GetAccount(society) then @@ -35,11 +37,11 @@ function getSocietyAccount(society) end amount = exports["qb-banking"]:GetAccountBalance(society) - elseif isStarted("esx_society") then - bankScript = "esx_society" - -- Since esx_society does not have a native client export for retrieving money, - -- we use a server callback to get the final amount. - amount = triggerCallback(getScript() .. ":getESXSocietyAccount", society) or 0 + --elseif isStarted("esx_society") then + -- bankScript = "esx_society" + -- -- Since esx_society does not have a native client export for retrieving money, + -- -- we use a server callback to get the final amount. + -- amount = triggerCallback(getScript()..":getESXSocietyAccount", society) or 0 elseif isStarted("Renewed-Banking") then bankScript = "Renewed-Banking" @@ -85,9 +87,9 @@ function chargeSociety(society, amount) end end exports["qb-banking"]:RemoveMoney(society, amount) - elseif isStarted("esx_society") then - bankScript = "esx_society" - TriggerEvent("esx_society:withdrawMoney", society, amount) + --elseif isStarted("esx_society") then + -- bankScript = "esx_society" + -- TriggerEvent("esx_society:withdrawMoney", society, amount) elseif isStarted("Renewed-Banking") then bankScript = "Renewed-Banking" @@ -138,12 +140,12 @@ function fundSociety(society, amount) end exports["qb-banking"]:AddMoney(society, amount) - elseif isStarted("esx_society") then - bankScript = "esx_society" - -- Use the esx_society event to deposit money. - TriggerServerEvent('esx_society:depositMoney', society, amount) - -- Use callback to return the updated balance. - newAmount = triggerCallback(getScript() .. ":getESXSocietyAccount", society) or 0 + --elseif isStarted("esx_society") then + -- bankScript = "esx_society" + -- -- Use the esx_society event to deposit money. + -- TriggerServerEvent('esx_society:depositMoney', society, amount) + -- -- Use callback to return the updated balance. + -- newAmount = triggerCallback(getScript()..":getESXSocietyAccount", society) or 0 elseif isStarted("Renewed-Banking") then bankScript = "Renewed-Banking" @@ -170,7 +172,7 @@ end -- other if isStarted("esx_society") then - createCallback(getScript() .. ":getESXSocietyAccount", function(source, society) + createCallback(getScript()..":getESXSocietyAccount", function(source, society) -- Example query – adjust table/field names to match your esx_society implementation. local result = MySQL.scalar.await('SELECT money FROM society_money WHERE society = ?', { society }) return result or 0 diff --git a/shared/stashcontrol.lua b/shared/stashcontrol.lua index dc99009..550c7d0 100644 --- a/shared/stashcontrol.lua +++ b/shared/stashcontrol.lua @@ -48,7 +48,6 @@ function GetStashTimeout(stashName, stop) stash = stashCache[stashName] else debugPrint("^6Bridge^7: ^2Local Stash ^7'^3"..stashName.."^7'^2 cache found^7") - ("^6Bridge^7: ^2Local Stash '^3"..stashName.."^7' cache found") end -- If there are already items in cache, skip recheck.