diff --git a/fxmanifest.lua b/fxmanifest.lua index 79f95e2..998c06d 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -10,6 +10,7 @@ shared_scripts { 'settings/sharedConfig.lua', 'use/*.lua', 'modules/Utility/shared/*.lua', + 'modules/Math/*.lua', 'modules/locales/*.lua', } @@ -44,7 +45,6 @@ client_scripts { 'modules/Progressbar/**/client.lua', 'modules/Clothing/**/client.lua', 'modules/Input/client.lua', - 'modules/math/*.lua', 'modules/menu/client.lua', 'init.lua', } diff --git a/init.lua b/init.lua index 95a2a93..01a01eb 100644 --- a/init.lua +++ b/init.lua @@ -24,16 +24,11 @@ Bridge.RegisterModule("Framework", Framework) Bridge.RegisterModule("Inventory", Inventory) Bridge.RegisterModule("Notify", Notify) Bridge.RegisterModule("Utility", Utility) -Bridge.RegisterModule("Progressbar", Progressbar) Bridge.RegisterModule("Clothing", Clothing) Bridge.RegisterModule("Menu", Menu) Bridge.RegisterModule("Language", Language) -Bridge.RegisterModule("Debugger", Debugger) Bridge.RegisterModule("Doorlock", Doorlock) Bridge.RegisterModule("Phone", Phone) -Bridge.RegisterModule("Vehicle", Vehicle) -Bridge.RegisterModule("Dispatch", Dispatch) -Bridge.RegisterModule("Weather", Weather) Bridge.RegisterModule("Target", Target) Bridge.RegisterModule("Table", Table) Bridge.RegisterModule("Math", Math) @@ -59,6 +54,13 @@ end) if IsDuplicityVersion() then return end +Bridge.RegisterModule("Dispatch", Dispatch) +Bridge.RegisterModule("Fuel", Fuel) +Bridge.RegisterModule("Input", Input) +Bridge.RegisterModule("Progressbar", Progressbar) +Bridge.RegisterModule("VehicleKey", VehicleKey) +Bridge.RegisterModule("Weather", Weather) + -- Fill the bridge tables with player data. function FillBridgeTables() PlayerLoaded = true diff --git a/modules/Doorlock/doors_creator/client.lua b/modules/Doorlock/doors_creator/client.lua index 6d1cbf7..dbf6c86 100644 --- a/modules/Doorlock/doors_creator/client.lua +++ b/modules/Doorlock/doors_creator/client.lua @@ -1,6 +1,6 @@ if GetResourceState('doors_creator') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.GetClosestDoor = function() return exports["doors_creator"]:getClosestActiveDoor() diff --git a/modules/Doorlock/doors_creator/server.lua b/modules/Doorlock/doors_creator/server.lua index 1f3a0c0..0aee303 100644 --- a/modules/Doorlock/doors_creator/server.lua +++ b/modules/Doorlock/doors_creator/server.lua @@ -1,6 +1,6 @@ if GetResourceState('doors_creator') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.ToggleDoorLock = function(doorID, toggle) local state = toggle diff --git a/modules/Doorlock/ox_doorlock/client.lua b/modules/Doorlock/ox_doorlock/client.lua index 72b0846..b2dd1aa 100644 --- a/modules/Doorlock/ox_doorlock/client.lua +++ b/modules/Doorlock/ox_doorlock/client.lua @@ -1,6 +1,6 @@ if GetResourceState('ox_doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.GetClosestDoor = function() return exports.ox_doorlock:getClosestDoor() diff --git a/modules/Doorlock/ox_doorlock/server.lua b/modules/Doorlock/ox_doorlock/server.lua index 72088be..1594980 100644 --- a/modules/Doorlock/ox_doorlock/server.lua +++ b/modules/Doorlock/ox_doorlock/server.lua @@ -1,6 +1,6 @@ if GetResourceState('ox_doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.ToggleDoorLock = function(doorID, toggle) local state = toggle diff --git a/modules/Doorlock/qb-doorlock/client.lua b/modules/Doorlock/qb-doorlock/client.lua index 0001125..ba8166e 100644 --- a/modules/Doorlock/qb-doorlock/client.lua +++ b/modules/Doorlock/qb-doorlock/client.lua @@ -1,6 +1,6 @@ if GetResourceState('qb-doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.GetClosestDoor = function() local closestDoor = exports["qb-doorlock"]:GetClosestDoor() diff --git a/modules/Doorlock/qb-doorlock/server.lua b/modules/Doorlock/qb-doorlock/server.lua index e595a7a..3a48b0c 100644 --- a/modules/Doorlock/qb-doorlock/server.lua +++ b/modules/Doorlock/qb-doorlock/server.lua @@ -1,6 +1,6 @@ if GetResourceState('qb-doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.ToggleDoorLock = function(doorID, toggle) TriggerClientEvent('qb-doorlock:client:setState', -1, 0, doorID, toggle, false, false, false) diff --git a/modules/Doorlock/rcore_doorlock/client.lua b/modules/Doorlock/rcore_doorlock/client.lua index ef47fb9..041307f 100644 --- a/modules/Doorlock/rcore_doorlock/client.lua +++ b/modules/Doorlock/rcore_doorlock/client.lua @@ -1,6 +1,6 @@ if GetResourceState('rcore_doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.GetClosestDoor = function() local allDoors = exports.rcore_doorlock:getLoadedDoors() diff --git a/modules/Doorlock/rcore_doorlock/server.lua b/modules/Doorlock/rcore_doorlock/server.lua index 8c8c4f7..1af685e 100644 --- a/modules/Doorlock/rcore_doorlock/server.lua +++ b/modules/Doorlock/rcore_doorlock/server.lua @@ -1,6 +1,6 @@ if GetResourceState('rcore_doorlock') ~= 'started' then return end -Doorlock = {} +Doorlock = Doorlock or {} Doorlock.ToggleDoorLock = function(doorID, toggle) local state = toggle diff --git a/modules/doorlock/doors_creator/client.lua b/modules/doorlock/doors_creator/client.lua new file mode 100644 index 0000000..dbf6c86 --- /dev/null +++ b/modules/doorlock/doors_creator/client.lua @@ -0,0 +1,7 @@ +if GetResourceState('doors_creator') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.GetClosestDoor = function() + return exports["doors_creator"]:getClosestActiveDoor() +end \ No newline at end of file diff --git a/modules/doorlock/doors_creator/server.lua b/modules/doorlock/doors_creator/server.lua new file mode 100644 index 0000000..0aee303 --- /dev/null +++ b/modules/doorlock/doors_creator/server.lua @@ -0,0 +1,13 @@ +if GetResourceState('doors_creator') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.ToggleDoorLock = function(doorID, toggle) + local state = toggle + if state then + exports["doors_creator"]:setDoorState(doorID, 1) + else + exports["doors_creator"]:setDoorState(doorID, 0) + end + return true +end \ No newline at end of file diff --git a/modules/doorlock/ox_doorlock/client.lua b/modules/doorlock/ox_doorlock/client.lua new file mode 100644 index 0000000..b2dd1aa --- /dev/null +++ b/modules/doorlock/ox_doorlock/client.lua @@ -0,0 +1,7 @@ +if GetResourceState('ox_doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.GetClosestDoor = function() + return exports.ox_doorlock:getClosestDoor() +end diff --git a/modules/doorlock/ox_doorlock/server.lua b/modules/doorlock/ox_doorlock/server.lua new file mode 100644 index 0000000..1594980 --- /dev/null +++ b/modules/doorlock/ox_doorlock/server.lua @@ -0,0 +1,13 @@ +if GetResourceState('ox_doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.ToggleDoorLock = function(doorID, toggle) + local state = toggle + if state then + exports.ox_doorlock:setDoorState(doorID, 1) + else + exports.ox_doorlock:setDoorState(doorID, 0) + end + return true +end \ No newline at end of file diff --git a/modules/doorlock/qb-doorlock/client.lua b/modules/doorlock/qb-doorlock/client.lua new file mode 100644 index 0000000..ba8166e --- /dev/null +++ b/modules/doorlock/qb-doorlock/client.lua @@ -0,0 +1,20 @@ +if GetResourceState('qb-doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.GetClosestDoor = function() + local closestDoor = exports["qb-doorlock"]:GetClosestDoor() + if Table.CheckPopulated(closestDoor) then return closestDoor end + local allDoors = exports["qb-doorlock"]:GetDoorList() + local pedCoords = GetEntityCoords(cache.ped) + local door = 0 + local doorDist = 1000.0 + for doorID, data in pairs(allDoors) do + local dist = #(pedCoords - data.objCoords) + if dist < doorDist then + door = doorID + doorDist = dist + end + end + return door +end \ No newline at end of file diff --git a/modules/doorlock/qb-doorlock/server.lua b/modules/doorlock/qb-doorlock/server.lua new file mode 100644 index 0000000..3a48b0c --- /dev/null +++ b/modules/doorlock/qb-doorlock/server.lua @@ -0,0 +1,8 @@ +if GetResourceState('qb-doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.ToggleDoorLock = function(doorID, toggle) + TriggerClientEvent('qb-doorlock:client:setState', -1, 0, doorID, toggle, false, false, false) + return true +end \ No newline at end of file diff --git a/modules/doorlock/rcore_doorlock/client.lua b/modules/doorlock/rcore_doorlock/client.lua new file mode 100644 index 0000000..041307f --- /dev/null +++ b/modules/doorlock/rcore_doorlock/client.lua @@ -0,0 +1,18 @@ +if GetResourceState('rcore_doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.GetClosestDoor = function() + local allDoors = exports.rcore_doorlock:getLoadedDoors() + local pedCoords = GetEntityCoords(cache.ped) + local door = 0 + local doorDist = 1000.0 + for _, data in pairs(allDoors) do + local dist = #(pedCoords - data.coords) + if dist < doorDist then + door = data.id + doorDist = dist + end + end + return door +end \ No newline at end of file diff --git a/modules/doorlock/rcore_doorlock/server.lua b/modules/doorlock/rcore_doorlock/server.lua new file mode 100644 index 0000000..1af685e --- /dev/null +++ b/modules/doorlock/rcore_doorlock/server.lua @@ -0,0 +1,13 @@ +if GetResourceState('rcore_doorlock') ~= 'started' then return end + +Doorlock = Doorlock or {} + +Doorlock.ToggleDoorLock = function(doorID, toggle) + local state = toggle + if state then + exports.rcore_doorlock:changeDoorState(doorID, 0) + else + exports.rcore_doorlock:changeDoorState(doorID, 1) + end + return true +end \ No newline at end of file diff --git a/modules/fuel/LegacyFuel/client.lua b/modules/fuel/LegacyFuel/client.lua new file mode 100644 index 0000000..e5e6613 --- /dev/null +++ b/modules/fuel/LegacyFuel/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('LegacyFuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['LegacyFuel']:GetFuel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['LegacyFuel']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/Renewed-Fuel/client.lua b/modules/fuel/Renewed-Fuel/client.lua new file mode 100644 index 0000000..97e17ff --- /dev/null +++ b/modules/fuel/Renewed-Fuel/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('Renewed-Fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['Renewed-Fuel']:GetFuel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['Renewed-Fuel']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/_defualts/client.lua b/modules/fuel/_defualts/client.lua new file mode 100644 index 0000000..7b1055b --- /dev/null +++ b/modules/fuel/_defualts/client.lua @@ -0,0 +1,11 @@ +Fuel = Fuel or {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return GetVehicleFuelLevel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return SetVehicleFuelLevel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/cdn-fuel/client.lua b/modules/fuel/cdn-fuel/client.lua new file mode 100644 index 0000000..752d7b4 --- /dev/null +++ b/modules/fuel/cdn-fuel/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('cdn-fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['cdn-fuel']:GetFuel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['cdn-fuel']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/okokGasStation/client.lua b/modules/fuel/okokGasStation/client.lua new file mode 100644 index 0000000..f263a31 --- /dev/null +++ b/modules/fuel/okokGasStation/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('okokGasStation') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['okokGasStation']:GetFuel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['okokGasStation']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/ox_fuel/client.lua b/modules/fuel/ox_fuel/client.lua new file mode 100644 index 0000000..2b03c6c --- /dev/null +++ b/modules/fuel/ox_fuel/client.lua @@ -0,0 +1,14 @@ +if GetResourceState('cdn-fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return Entity(vehicle).state.fuel +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + local currentFuel = Entity(vehicle).state.fuel + Entity(vehicle).state.fuel = currentFuel + fuel + return Entity(vehicle).state.fuel +end \ No newline at end of file diff --git a/modules/fuel/ps-fuel/client.lua b/modules/fuel/ps-fuel/client.lua new file mode 100644 index 0000000..1d51570 --- /dev/null +++ b/modules/fuel/ps-fuel/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('ps-fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['ps-fuel']:GetFuel(vehicle) +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['ps-fuel']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/fuel/ti_fuel/client.lua b/modules/fuel/ti_fuel/client.lua new file mode 100644 index 0000000..234734c --- /dev/null +++ b/modules/fuel/ti_fuel/client.lua @@ -0,0 +1,13 @@ +if GetResourceState('ti_fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0, type end + local level, type = exports["ti_fuel"]:getFuel(vehicle) + return level, type +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['ti_fuel']:setFuel(vehicle, fuel, type or "RON91") +end \ No newline at end of file diff --git a/modules/fuel/x-fuel/client.lua b/modules/fuel/x-fuel/client.lua new file mode 100644 index 0000000..0b34d99 --- /dev/null +++ b/modules/fuel/x-fuel/client.lua @@ -0,0 +1,13 @@ +if GetResourceState('x-fuel') ~= 'started' then return end +Fuel = {} + +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0, type end + local level, type = exports["x-fuel"]:getFuel(vehicle) + return level, type +end + +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['x-fuel']:SetFuel(vehicle, fuel) +end \ No newline at end of file diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua new file mode 100644 index 0000000..db02090 --- /dev/null +++ b/modules/inventory/_default/client.lua @@ -0,0 +1,10 @@ +Inventory = Inventory or {} + +Inventory.GetItemInfo = function(item) + print('client funct') + return Framework.GetItemInfo(item) +end + +Inventory.GetImagePath = function(item) + return "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/_default/server.lua b/modules/inventory/_default/server.lua new file mode 100644 index 0000000..42ec76d --- /dev/null +++ b/modules/inventory/_default/server.lua @@ -0,0 +1,33 @@ +Inventory = Inventory or {} + +Inventory.AddItem = function(src, item, count, slot, metadata) + return Framework.AddItem(src, item, count, slot, metadata) +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + return Framework.RemoveItem(src, item, count, slot, metadata) +end + +Inventory.GetItemInfo = function(item) + return false, print("This Inventory Has Not Been Bridged For An Item Info Feature.") +end + +Inventory.GetItemCount = function(src, item, metadata) + return Framework.GetItemCount(src, item, metadata) +end + +Inventory.GetInventoryItems = function(src) + return Framework.GetPlayerInventory(src) +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + return Framework.SetMetadata(src, item, slot, metadata) +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + return false, print("This Inventory Has Not Been Bridged For A Stash Feature.") +end + +Inventory.GetImagePath = function(item) + return "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/codem-inventory/client.lua b/modules/inventory/codem-inventory/client.lua new file mode 100644 index 0000000..93d902d --- /dev/null +++ b/modules/inventory/codem-inventory/client.lua @@ -0,0 +1,21 @@ +if GetResourceState('codem-inventory') ~= 'started' then return end +Inventory = Inventory or {} + +Inventory.GetItemInfo = function(item) + local itemData = exports['codem-inventory']:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.GetImagePath = function(item) + local imagePath = string.format("nui://codem-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end diff --git a/modules/inventory/codem-inventory/server.lua b/modules/inventory/codem-inventory/server.lua new file mode 100644 index 0000000..aff87d7 --- /dev/null +++ b/modules/inventory/codem-inventory/server.lua @@ -0,0 +1,78 @@ +if GetResourceState('codem-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.AddItem = function(src, item, count, slot, metadata) + return exports['codem-inventory']:AddItem(src, item, count, slot, metadata) +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + if metadata == nil then + return exports['codem-inventory']:RemoveItem(src, item, count, slot) + else + local items = exports['codem-inventory']:GetInventory(nil, src) + for _, itemInfo in pairs(items) do + if itemInfo.name == item then + if itemInfo.info == metadata then + return exports['codem-inventory']:RemoveItem(src, item, count, itemInfo.slot) + end + end + end + end +end + +Inventory.GetItemInfo = function(item) + local itemData = exports['codem-inventory']:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.GetItemCount = function(src, item, metadata) + if metadata == nil then + return exports['codem-inventory']:GetItemsTotalAmount(src, item) + else + local count = 0 + local items = exports['codem-inventory']:GetInventory(nil, src) + for _, itemInfo in pairs(items) do + if itemInfo.name == item and itemInfo.info == metadata then + count = count + itemInfo.amount + end + return count + end + end +end + +Inventory.GetInventoryItems = function(src) + local items = exports['codem-inventory']:GetInventory(nil, src) + local repackedTable = {} + for _, v in pairs(items) do + table.insert(repackedTable, { + name = v.name, + count = v.amount, + metadata = v.info, + slot = v.slot, + }) + end + return items +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + exports['codem-inventory']:SetItemMetadata(src, slot, metadata) +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + TriggerEvent('codem-inventory:server:openstash', id, slots, weight, label) +end + +Inventory.GetImagePath = function(item) + local imagePath = string.format("nui://codem-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/core_inventory/client.lua b/modules/inventory/core_inventory/client.lua new file mode 100644 index 0000000..124acd1 --- /dev/null +++ b/modules/inventory/core_inventory/client.lua @@ -0,0 +1,7 @@ +if GetResourceState('core_inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.TestFunction = function(item) + return 'test funct client inv' +end \ No newline at end of file diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua new file mode 100644 index 0000000..bf8e186 --- /dev/null +++ b/modules/inventory/core_inventory/server.lua @@ -0,0 +1,7 @@ +if GetResourceState('core_inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.TestFunction = function(item) + return 'test funct server inv' +end \ No newline at end of file diff --git a/modules/inventory/origen_inventory/client.lua b/modules/inventory/origen_inventory/client.lua new file mode 100644 index 0000000..b8bfa99 --- /dev/null +++ b/modules/inventory/origen_inventory/client.lua @@ -0,0 +1,24 @@ +if GetResourceState('origen_inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +local origen_inventory = exports.origen_inventory + +Inventory.GetItemInfo = function(item) + local itemData = origen_inventory:Items(item) + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable or {} +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/origen_inventory/server.lua b/modules/inventory/origen_inventory/server.lua new file mode 100644 index 0000000..0bf768e --- /dev/null +++ b/modules/inventory/origen_inventory/server.lua @@ -0,0 +1,80 @@ +if GetResourceState('origen_inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +local origen_inventory = exports.origen_inventory + +Inventory.AddItem = function(src, item, count, slot, metadata) + if not origen_inventory:CanCarryItem(src, item, count) then + return Bridge.notify.SendNotify(src, "Inventory Full", "error", 5000) + end + return origen_inventory:AddItem(src, item, count, nil, nil, metadata) +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + return origen_inventory:RemoveItem(src, item, count, metadata) +end + +Inventory.GetItemInfo = function(item) + local itemData = origen_inventory:Items(item) + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable or {} +end + +Inventory.GetItemCount = function(src, item, metadata) + if not metadata then + return origen_inventory:GetItemTotalAmount(src, item) + else + local items = origen_inventory:GetInventory(src) + local count = 0 + for _, itemInfo in pairs(items) do + if itemInfo.name == item and itemInfo.info == metadata then + count = count + itemInfo.amount + end + end + return count + end +end + +Inventory.GetPlayerInventory = function(src) + local playerItems = origen_inventory:GetInventory(src) + local repackedTable = {} + for _, v in pairs(playerItems) do + table.insert(repackedTable, { + name = v.name, + count = v.amount, + metadata = v.info, + slot = v.slot, + }) + end + return repackedTable +end + +Inventory.CanCarryItem = function(src, item, count) + return origen_inventory:CanCarryItems(src, item, count) +end + +Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + return origen_inventory:RegisterStash(id, { label = label, slots = slots, weight = weight }) +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + return origen_inventory:OpenInventory(src, 'stash', id) +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + origen_inventory:SetItemMetadata(src, item, slot, metadata) +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/ox_inventory/client.lua b/modules/inventory/ox_inventory/client.lua new file mode 100644 index 0000000..83a2f18 --- /dev/null +++ b/modules/inventory/ox_inventory/client.lua @@ -0,0 +1,26 @@ +if GetResourceState('ox_inventory') ~= 'started' then return end +local ox_inventory = exports.ox_inventory + +Inventory = Inventory or {} + +Inventory.GetItemInfo = function(item) + local itemData = ox_inventory:Items(item) + if not itemData then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.stack or "true", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = (itemData.client and itemData.client.image) or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item)) + local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end + +--Bridge.RegisterModule("Inventory", Inventory) \ No newline at end of file diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua new file mode 100644 index 0000000..01ac955 --- /dev/null +++ b/modules/inventory/ox_inventory/server.lua @@ -0,0 +1,67 @@ +if GetResourceState('ox_inventory') ~= 'started' then return end + +local ox_inventory = exports.ox_inventory + +Inventory = Inventory or {} + +Inventory.AddItem = function(src, item, count, slot, metadata) + return ox_inventory:AddItem(src, item, count, metadata) +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + return ox_inventory:RemoveItem(src, item, count, metadata, slot) +end + +Inventory.GetItem = function(src, item, metadata) + return ox_inventory:GetItem(src, item, metadata, false) +end + +Inventory.GetItemCount = function(src, item, metadata) + return ox_inventory:GetItemCount(src, item, metadata, false) +end + +Inventory.GetPlayerInventory = function(src) + return ox_inventory:GetInventoryItems(src, false) +end + +Inventory.CanCarryItem = function(src, item, count) + return ox_inventory:CanCarryItem(src, item, count) +end + +Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + return ox_inventory:RegisterStash(id, label, slots, weight, owner) +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + TriggerClientEvent('ox_inventory:openInventory', src, 'stash', 'stash_' .. id) +end + +Inventory.GetItemInfo = function(item) + local itemData = ox_inventory:Items(item) + if not itemData then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.stack or "true", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.client.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + ox_inventory:SetMetadata(src, slot, metadata) +end + +Inventory.UpdatePlate = function(oldplate, newplate) + ox_inventory:UpdateVehicle(oldplate, newplate) + if GetResourceState('jg-mechanic') ~= 'started' then return end + exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item)) + local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/ps-inventory/client.lua b/modules/inventory/ps-inventory/client.lua new file mode 100644 index 0000000..f031826 --- /dev/null +++ b/modules/inventory/ps-inventory/client.lua @@ -0,0 +1,15 @@ +if GetResourceState('ps-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data) + if source ~= 65535 then return end + TriggerEvent('ps-inventory:client:SetCurrentStash', id) + TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) +end) + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/ps-inventory/server.lua b/modules/inventory/ps-inventory/server.lua new file mode 100644 index 0000000..bf0df31 --- /dev/null +++ b/modules/inventory/ps-inventory/server.lua @@ -0,0 +1,17 @@ +if GetResourceState('ps-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + return true +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = label, maxweight = weight, slots = slots, }) +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/qb-inventory/client.lua b/modules/inventory/qb-inventory/client.lua new file mode 100644 index 0000000..fc28b4a --- /dev/null +++ b/modules/inventory/qb-inventory/client.lua @@ -0,0 +1,15 @@ +if GetResourceState('qb-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data) + if source ~= 65535 then return end + TriggerEvent("inventory:client:SetCurrentStash", id) + TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) +end) + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua new file mode 100644 index 0000000..f2604e8 --- /dev/null +++ b/modules/inventory/qb-inventory/server.lua @@ -0,0 +1,17 @@ +if GetResourceState('qb-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + return true +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots }) +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/qs-inventory/client.lua b/modules/inventory/qs-inventory/client.lua new file mode 100644 index 0000000..e54e334 --- /dev/null +++ b/modules/inventory/qs-inventory/client.lua @@ -0,0 +1,27 @@ +if GetResourceState('qs-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.OpenStash = function(id) + exports['qs-inventory']:RegisterStash(id, 50, 50000) +end + +Inventory.GetItemInfo = function(item) + local itemData = exports['qs-inventory']:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua new file mode 100644 index 0000000..7fab8cc --- /dev/null +++ b/modules/inventory/qs-inventory/server.lua @@ -0,0 +1,67 @@ +if GetResourceState('qs-inventory') ~= 'started' then return end + +Inventory = Inventory or {} + +Inventory.AddItem = function(src, item, count, slot, metadata) + if not exports['qs-inventory']:CanCarryItem(src, item, count) then return false end + return exports['qs-inventory']:AddItem(src, item, count, slot, metadata) +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + return exports['qs-inventory']:RemoveItem(src, item, count, slot, metadata) +end + +Inventory.GetItemCount = function(src, item, metadata) + return exports['qs-inventory']:GetItemTotalAmount(src, item) +end + +Inventory.GetPlayerInventory = function(src) + local playerItems = exports['qs-inventory']:GetInventory(src) + local repackedTable = {} + for _, v in pairs(playerItems) do + table.insert(repackedTable, { + name = v.name, + count = v.amount, + metadata = v.info, + slot = v.slot, + }) + end + return repackedTable +end + +Inventory.CanCarryItem = function(src, item, count) + return exports['qs-inventory']:CanCarryItem(src, item, count) +end + +Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) + return true +end + +Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) + TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots }) + TriggerClientEvent("inventory:client:SetCurrentStash",src, id) +end + +Inventory.GetItemInfo = function(item) + local itemData = exports['qs-inventory']:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + return exports['qs-inventory']:SetItemMetadata(src, slot, metadata) +end + +Inventory.GetImagePath = function(item) + local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item)) + local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua new file mode 100644 index 0000000..41cfc13 --- /dev/null +++ b/modules/inventory/tgiann-inventory/client.lua @@ -0,0 +1,29 @@ +if GetResourceState('tgiann-inventory') ~= 'started' then return end +local tgiann = exports["tgiann-inventory"] + +Inventory = Inventory or {} + +Inventory.OpenStash = function(id) + -- open stash export... not sure what it is yet. +end + +Inventory.GetItemInfo = function(item) + local itemData = tgiann:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.GetImagePath = function(item) + local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) + local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) + local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua new file mode 100644 index 0000000..92a9fb0 --- /dev/null +++ b/modules/inventory/tgiann-inventory/server.lua @@ -0,0 +1,63 @@ +if GetResourceState('tgiann-inventory') ~= 'started' then return end +local tgiann = exports["tgiann-inventory"] + +Inventory = Inventory or {} + +Inventory.AddItem = function(src, item, count, slot, metadata) + if not tgiann:CanCarryItem(src, item, count) then return false end + local action = tgiann:AddItem(src, item, count, metadata) + return (action.itemAddRemoveLog == 'added') +end + +Inventory.RemoveItem = function(src, item, count, slot, metadata) + return tgiann:RemoveItem(src, item, count, nil, metadata) +end + +Inventory.GetItem = function(src, item, metadata) + local item = tgiann:GetItemByName(src, item, metadata) + item.count = item.amount + item.metadata = item.info + return item +end + +Inventory.GetItemCount = function(src, item, metadata) + local _item = tgiann:GetItemByName(src, item, metadata) + return _item.amount or 0 +end + +Inventory.GetInventoryItems = function(src) + return tgiann:GetPlayerItems(src) +end + +Inventory.CanCarryItem = function(src, item, count) + return tgiann:CanCarryItem(src, item, count) +end + +Inventory.RegisterStash = function(id, label, slots, weight, owner) + return tgiann:CreateCustomStashWithItem(id, {}) +end + +Inventory.GetItemInfo = function(item) + local itemData = tgiann:GetItemList() + if not itemData[item] then return {} end + local repackedTable = { + name = itemData.name or "Missing Name", + label = itemData.label or "Missing Label", + stack = itemData.unique or "false", + weight = itemData.weight or "0", + description = itemData.description or "none", + image = itemData.image or Inventory.GetImagePath(item), + } + return repackedTable +end + +Inventory.SetMetadata = function(src, item, slot, metadata) + tgiann:UpdateItemMetadata(src, item, slot, metadata) +end + +Inventory.GetImagePath = function(item) + local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) + local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) + local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) + return imagePath or "https://avatars.githubusercontent.com/u/47620135" +end \ No newline at end of file diff --git a/modules/phone/_defualts/client.lua b/modules/phone/_defualts/client.lua new file mode 100644 index 0000000..8b33ca9 --- /dev/null +++ b/modules/phone/_defualts/client.lua @@ -0,0 +1,5 @@ +Phone = Phone or {} + +Phone.SendEmail = function(email, title, message) + return false, Print.Error('There Is No Phone Bridged.') +end \ No newline at end of file diff --git a/modules/phone/_defualts/server.lua b/modules/phone/_defualts/server.lua new file mode 100644 index 0000000..a367380 --- /dev/null +++ b/modules/phone/_defualts/server.lua @@ -0,0 +1,9 @@ +Phone = Phone or {} + +Phone.GetPlayerPhone = function(src) + return false, Print.Error('There Is No Phone Bridged.') +end + +Phone.SendEmail = function(src, email, title, message) + return false, Print.Error('There Is No Phone Bridged.') +end \ No newline at end of file diff --git a/modules/phone/gksphone/client.lua b/modules/phone/gksphone/client.lua new file mode 100644 index 0000000..ea45267 --- /dev/null +++ b/modules/phone/gksphone/client.lua @@ -0,0 +1,6 @@ +if GetResourceState('gksphone') ~= 'started' then return end +Phone = {} + +Phone.SendEmail = function(email, title, message) + return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message }) +end \ No newline at end of file diff --git a/modules/phone/gksphone/server.lua b/modules/phone/gksphone/server.lua new file mode 100644 index 0000000..5de2c37 --- /dev/null +++ b/modules/phone/gksphone/server.lua @@ -0,0 +1,16 @@ +if GetResourceState('gksphone') ~= 'started' then return end +Phone = {} + +Phone.GetPlayerPhone = function(src) + return exports["gksphone"]:GetPhoneBySource(src) or false +end + +Phone.SendEmail = function(src, email, title, message) + local data = {} + data.sender = email + data.image = '/html/static/img/icons/mail.png' + data.subject = title + data.message = message + exports["gksphone"]:SendNewMail(src, data) + return true +end \ No newline at end of file diff --git a/modules/phone/lb-phone/client.lua b/modules/phone/lb-phone/client.lua new file mode 100644 index 0000000..5918f64 --- /dev/null +++ b/modules/phone/lb-phone/client.lua @@ -0,0 +1,6 @@ +if GetResourceState('lb-phone') ~= 'started' then return end +Phone = {} + +Phone.SendEmail = function(email, title, message) + TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message}) +end \ No newline at end of file diff --git a/modules/phone/lb-phone/server.lua b/modules/phone/lb-phone/server.lua new file mode 100644 index 0000000..84cf579 --- /dev/null +++ b/modules/phone/lb-phone/server.lua @@ -0,0 +1,26 @@ +if GetResourceState('lb-phone') ~= 'started' then return end +Phone = {} + +Phone.GetPlayerPhone = function(src) + return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false +end + +Phone.SendEmail = function(src, email, title, message) + local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src) + if not numberNumber then return false, Prints.Error("Could not Find Phone number") end + local playerEmail = exports["lb-phone"]:GetEmailAddress(numberNumber) + if not playerEmail then return false, Prints.Error("Could not Find email") end + local success, id = exports["lb-phone"]:SendMail({ + to = playerEmail, + sender = email, + subject = title, + message = message, + }) + return success +end + +RegisterNetEvent('community_bridge:Server:genericEmail', function(data) + local src = source + Prints.Debug('community_bridge:Server:genericEmail Hit') + return Phone.SendEmail(src, data.email, data.title, data.message) +end) \ No newline at end of file diff --git a/modules/phone/qs-smartphone/client.lua b/modules/phone/qs-smartphone/client.lua new file mode 100644 index 0000000..b325b24 --- /dev/null +++ b/modules/phone/qs-smartphone/client.lua @@ -0,0 +1,11 @@ +if GetResourceState('qs-smartphone') ~= 'started' then return end +Phone = {} + +Phone.SendEmail = function(email, title, message) + return TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} }) +end + +RegisterNetEvent('community_bridge:Server:genericEmail', function(data) + TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = data.email, subject = data.title, message = data.message, button = {} }) + return true +end) \ No newline at end of file diff --git a/modules/phone/qs-smartphone/server.lua b/modules/phone/qs-smartphone/server.lua new file mode 100644 index 0000000..909ee8d --- /dev/null +++ b/modules/phone/qs-smartphone/server.lua @@ -0,0 +1,11 @@ +if GetResourceState('qs-smartphone') ~= 'started' then return end +Phone = {} + +Phone.GetPlayerPhone = function(src) + return exports['qs-base']:GetPlayerPhone(src) or false +end + +Phone.SendEmail = function(src, email, title, message) + TriggerClientEvent('community_bridge:Server:genericEmail', src, { sender = email, subject = title, message = message, button = {} }) + return true +end \ No newline at end of file diff --git a/modules/progressbar/ox_lib/client.lua b/modules/progressbar/ox_lib/client.lua new file mode 100644 index 0000000..50efeef --- /dev/null +++ b/modules/progressbar/ox_lib/client.lua @@ -0,0 +1,38 @@ +if BridgeClientConfig.ProgressBar ~= "ox" then return end +Progressbar = {} +local _progBarType = BridgeClientConfig.ProgressBarStyle or "bar" + +Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction) + local runTime = time or 10000 + local textLabel = label or "Doing something" + local deadBool = whiledead or false + local cancelBool = cancancel or false + local disableKeys = disable or { move = true, sprint = true, car = true, combat = true, } + local anim = animTable or nil + local success = successAction or function() Prints.Debug("Success") end + local canceled = canceledAction or function() Prints.Debug("Cancelled") end + if _progBarType == "bar" then + if exports.ox_lib:progressBar({ + duration = runTime, + label = textLabel, + useWhileDead = deadBool, + canCancel = cancelBool, + disable = disableKeys, + anim = anim, + }) then success() else canceled() end + elseif _progBarType == "circle" then + if exports.ox_lib:progressCircle({ + duration = runTime, + label = textLabel, + position = 'bottom', + useWhileDead = deadBool, + canCancel = cancelBool, + disable = disableKeys, + anim = anim, + }) then success() else canceled() end + end +end + +Progressbar.IsProgressBarActive = function() + return exports.ox_lib:progressActive() +end \ No newline at end of file diff --git a/modules/progressbar/qb-progressbar/client.lua b/modules/progressbar/qb-progressbar/client.lua new file mode 100644 index 0000000..a9df93f --- /dev/null +++ b/modules/progressbar/qb-progressbar/client.lua @@ -0,0 +1,60 @@ +if BridgeClientConfig.ProgressBar ~= "qb" then return end +Progressbar = {} + +local function convertOxToQB(disabledTable, animTable) + local repackedTable = { disabled = {}, animations = {}} + for _, v in pairs(disabledTable) do + if v.move then + repackedTable.disabled.disableMovement = v.move + end + if v.car then + repackedTable.disabled.disableCarMovement = v.car + end + if v.combat then + repackedTable.disabled.disableCombat = v.combat + end + if v.mouse then + repackedTable.disabled.disableMouse = v.mouse + end + end + for _, v in pairs(animTable) do + if v.dict then + repackedTable.animations.animDict = v.animDict + end + if v.clip then + repackedTable.animations.anim = v.anim + end + end + return repackedTable +end + +Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction) + local runTime = time or 10000 + local textLabel = label or "Doing something" + local deadBool = whiledead or false + local cancelBool = cancancel or false + local success = successAction or function() Prints.Debug("Success") end + local canceled = canceledAction or function() Prints.Debug("Cancelled") end + local repackedTable = convertOxToQB(disable, animTable) + exports['progressbar']:Progress({ + name = textLabel, + duration = runTime, + label = textLabel, + useWhileDead = deadBool, + canCancel = cancelBool, + controlDisables = repackedTable.disabled, + animation = repackedTable.animations, + prop = {}, + propTwo = {} + }, function(cancelled) + if not cancelled then + success() + else + canceled() + end + end) +end + +Progressbar.IsProgressBarActive = function() + return exports["progressbar"]:isDoingSomething() +end \ No newline at end of file diff --git a/modules/utility/client/object_Placer.lua b/modules/utility/client/object_Placer.lua new file mode 100644 index 0000000..f2a4ddc --- /dev/null +++ b/modules/utility/client/object_Placer.lua @@ -0,0 +1,109 @@ +Utility = Utility or {} + +local activePlacementProp = nil +lib.locale() + +-- Object placer -- +local placementText = { + locale('place_object'), + locale('place_object_place'), + locale('place_object_cancel'), + locale('place_object_scroll_up'), + locale('place_object_scroll_down') +} + +local function finishPlacing() + Bridge.notify.HideHelpText() + if activePlacementProp == nil then return end + DeleteObject(activePlacementProp) + activePlacementProp = nil +end + +Utility.PlaceObject = function(object, distance, snapToGround, allowedMats, offset) + if activePlacementProp then return end + + if not object then Prints.Error('no_prop_defined') end + + local propObject = type(object) == 'string' and joaat(object) or object + local heading = 0.0 + local checkDist = distance or 10.0 + + Utility.LoadModel(propObject) + + activePlacementProp = CreateObject(propObject, 1.0, 1.0, 1.0, false, true, true) + SetModelAsNoLongerNeeded(propObject) + SetEntityAlpha(activePlacementProp, 150, false) + SetEntityCollision(activePlacementProp, false, false) + SetEntityInvincible(activePlacementProp, true) + FreezeEntityPosition(activePlacementProp, true) + + Bridge.notify.ShowHelpText(type(placementText) == 'table' and table.concat(placementText) or placementText, { + position = "left-center", + }) + + local outLine = false + + while activePlacementProp do + --local hit, _, coords, _, materialHash = lib.raycast.fromCamera(1, 4) + --local hit, _, coords, _, materialHash = lib.raycast.fromCamera(1, 4, nil) + local hit, _, coords, _, materialHash = lib.raycast.fromCamera(1, 4) + if hit then + if offset then + coords += offset + end + + SetEntityCoords(activePlacementProp, coords.x, coords.y, coords.z, false, false, false, false) + local distCheck = #(GetEntityCoords(cache.ped) - coords) + SetEntityHeading(activePlacementProp, heading) + + if snapToGround then + PlaceObjectOnGroundProperly(activePlacementProp) + end + + if outLine then + outLine = false + SetEntityDrawOutline(activePlacementProp, false) + end + + if (allowedMats and not allowedMats[materialHash]) or distCheck >= checkDist then + if not outLine then + outLine = true + SetEntityDrawOutline(activePlacementProp, true) + end + end + + if IsControlJustReleased(0, 38) then + if not outLine and (not allowedMats or allowedMats[materialHash]) and distCheck < checkDist then + finishPlacing() + + return coords, heading + end + end + + if IsControlJustReleased(0, 73) then + finishPlacing() + + return nil, nil + end + + if IsControlJustReleased(0, 14) then + heading = heading + 5 + if heading > 360 then heading = 0.0 end + end + + if IsControlJustReleased(0, 15) then + heading = heading - 5 + if heading < 0 then + heading = 360.0 + end + end + end + end +end + +Utility.StopPlacing = function() + if not activePlacementProp then return end + finishPlacing() +end + +-- This is derrived and slightly altered from its creator and licensed under GPL-3.0 license Author:Zoo, the original is located here https://github.com/Renewed-Scripts/Renewed-Lib/tree/main \ No newline at end of file diff --git a/modules/utility/client/utility.lua b/modules/utility/client/utility.lua new file mode 100644 index 0000000..4cc1e60 --- /dev/null +++ b/modules/utility/client/utility.lua @@ -0,0 +1,288 @@ +Utility = Utility or {} +local blipIDs = {} +local spawnedPeds = {} +local ActivePoints = {} +lib.locale() + +Utility.CreateVehicle = function(model, coords, heading, networked) + if networked == nil then networked = true end + Utility.LoadModel(model) + if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end + local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, networked, false) + SetVehicleHasBeenOwnedByPlayer(vehicle, true) + SetVehicleNeedsToBeHotwired(vehicle, false) + SetModelAsNoLongerNeeded(model) + SetVehRadioStation(vehicle, "OFF") + return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), } +end + +Utility.StartBusySpinner = function(text) + AddTextEntry(text, text) + BeginTextCommandBusyString(text) + AddTextComponentSubstringPlayerName(text) + EndTextCommandBusyString(0) +end + +Utility.StopBusySpinner = function() + if BusyspinnerIsOn() then BusyspinnerOff() end +end + +Utility.CreateProp = function(model, coords, heading, networked) + if networked == nil then networked = true end + Utility.LoadModel(model) + if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end + local propEntity = CreateObject(model, coords.x, coords.y, coords.z, networked, false, false) + SetEntityHeading(propEntity, heading) + SetModelAsNoLongerNeeded(model) + return propEntity +end + +Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange) + local blip = AddBlipForCoord(coords.x, coords.y, coords.z) + SetBlipSprite(blip, sprite or 8) + SetBlipColour(blip, color or 3) + SetBlipScale(blip, scale or 0.8) + SetBlipAsShortRange(blip, shortRange) + AddTextEntry(label, label) + BeginTextCommandSetBlipName(label) + EndTextCommandSetBlipName(blip) + table.insert(blipIDs, blip) + return blip +end + +Utility.RemoveBlip = function(blip) + local success = false + for i, storedBlip in ipairs(blipIDs) do + if storedBlip == blip then + RemoveBlip(blip) + table.remove(blipIDs, i) + success = true + break + end + end + return success +end + +Utility.LoadModel = function(model) + if type(model) ~= 'number' then model = joaat(model) end + if not IsModelValid(model) and not IsModelInCdimage(model) then return false end + RequestModel(model) + local count = 0 + while not HasModelLoaded(model) and count < 30000 do + Wait(0) + count = count + 1 + end + return HasModelLoaded(model) +end + +Utility.CreatePed = function(model, coords, heading, networked, clothing) + if networked == nil then networked = true end + Utility.LoadModel(model) + if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end + local spawnedEntity = CreatePed(0, model, coords.x, coords.y, coords.z, heading, networked, false) + if clothing then + for componentID, v in pairs(clothing) do + SetPedComponentVariation(spawnedEntity, componentID, v[1], v[2], 0) + end + end + FreezeEntityPosition(spawnedEntity, true) + SetEntityInvincible(spawnedEntity, true) + SetBlockingOfNonTemporaryEvents(spawnedEntity, true) + SetModelAsNoLongerNeeded(model) + table.insert(spawnedPeds, spawnedEntity) + return spawnedEntity +end + +Utility.RemovePed = function(entity) + local success = false + DeleteEntity(entity) + for i, storedEntity in ipairs(spawnedPeds) do + if storedEntity == entity then + table.remove(spawnedPeds, i) + success = true + break + end + end + return success +end + +Utility.NativeInputMenu = function(text, length) + local maxLength = Math.Clamp(length, 1, 50) + local menutText = text or 'enter text' + AddTextEntry(menutText, menutText) + DisplayOnscreenKeyboard(1, menutText, "", "", "", "", "", maxLength) + while(UpdateOnscreenKeyboard() == 0) do + DisableAllControlActions(0) + Wait(0) + end + if(GetOnscreenKeyboardResult()) then + local result = GetOnscreenKeyboardResult() + return result + end + return false +end + +Utility.GetEntitySkinData = function(entity) + local skinData = {} + skinData.clothing = {} + for i = 0, 11 do + skinData.clothing[i] = {GetPedDrawableVariation(entity, i), GetPedTextureVariation(entity, i)} + end + return skinData +end + +Utility.SetEntitySkinData = function(entity, skinData) + for i = 0, 11 do + SetPedComponentVariation(entity, i, skinData.clothing[i][1], skinData.clothing[i][2], 0) + end + return true +end + +Utility.NativeAlert = function(data) + local message = data.message or 'No message provided' + local coords = data.coords or GetEntityCoords(cache.ped) + local job = data.job + local scale = data.scale or 0.8 + local sprite = data.sprite or 1 + TriggerServerEvent('community_bridge:server:alert', {message = message, coords = coords, job = job, scale = scale, sprite = sprite}) +end + +Utility.ReloadSkin = function() + local skinData = Utility.GetEntitySkinData(cache.ped) + Utility.SetEntitySkinData(cache.ped, skinData) + for _, props in pairs(GetGamePool("CObject")) do + if IsEntityAttachedToEntity(cache.ped, props) then + SetEntityAsMissionEntity(props, true, true) + DeleteObject(props) + DeleteEntity(props) + end + end + return true +end + +Utility.RestoreAppearance = function(data) + return Utility.SetEntitySkinData(cache.ped, data) +end + +Utility.HelpText = function(text, duration) + AddTextEntry(text, text) + BeginTextCommandDisplayHelp(text) + EndTextCommandDisplayHelp(0, false, true, duration or 5000) +end + +Utility.NotifyText = function(text) + AddTextEntry(text, text) + SetNotificationTextEntry(text) + DrawNotification(false, true) +end + +Utility.TeleportPlayer = function(coords, conditionFunction, afterTeleportFunction) + if conditionFunction ~= nil then + if not conditionFunction() then + return + end + end + DoScreenFadeOut(2500) + Wait(2500) + SetEntityCoords(cache.ped, coords.x, coords.y, coords.z, false, false, false, false) + if coords.w then + SetEntityHeading(cache.ped, coords.w) + end + FreezeEntityPosition(cache.ped, true) + local count = 0 + while not HasCollisionLoadedAroundEntity(cache.ped) and count <= 30000 do + RequestCollisionAtCoord(coords.x, coords.y, coords.z) + Wait(0) + count = count + 1 + end + FreezeEntityPosition(cache.ped, false) + DoScreenFadeIn(1000) + if afterTeleportFunction ~= nil then + afterTeleportFunction() + end +end + +Utility.GetEntityHashFromModel = function(model) + if type(model) ~= 'number' then model = joaat(model) end + return model +end + +Utility.GetClosestPlayer = function(coords, distanceScope, includeMe) + local players = GetActivePlayers() + local closestPlayer = 0 + local selfPed = cache.ped + local selfCoords = coords or GetEntityCoords(cache.ped) + local closestDistance = distanceScope or 5 + + for _, player in ipairs(players) do + local playerPed = GetPlayerPed(player) + if includeMe or playerPed ~= selfPed then + local playerCoords = GetEntityCoords(playerPed) + local distance = #(selfCoords - playerCoords) + if closestDistance == -1 or distance < closestDistance then + closestPlayer = player + closestDistance = distance + end + end + end + + return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer) +end + +-- register points +Utility.RegisterPoint = function(pointCoords, pointDistance, pointOnEnter, pointOnExit) + local enterZone = lib.points.new({ + coords = pointCoords, + distance = pointDistance, + onEnter = function(self) + pointOnEnter(self) + end, + onExit = function(self) + pointOnExit(self) + end, + }) + local pointID = Utility.CreateUniqueId(nil, 5, nil) + ActivePoints[pointID] = enterZone + return enterZone, pointID +end + +-- Function to retrieve the enterZone using pointID +Utility.GetPointById = function(pointID) + return ActivePoints[pointID] +end + +Utility.RemovePoint = function(pointID) + local point = ActivePoints[pointID] + if point then + --print("Removing point with ID " .. pointID) + point:remove() -- Call the remove method on the point (ensure this method stops all event listeners) + ActivePoints[pointID] = nil -- Remove from ActivePoints table + --print("Point removed successfully.") + return true + else + --print("Point with ID " .. pointID .. " not found.") + return false + end +end + +AddEventHandler('onResourceStop', function(resource) + if resource == GetCurrentResourceName() then + for _, blip in pairs(blipIDs) do + if DoesBlipExist(blip.id) then + RemoveBlip(blip.id) + end + end + for _, ped in pairs(spawnedPeds) do + if DoesEntityExist(ped) then + DeleteEntity(ped) + end + end + end +end) + +RegisterNetEvent('community_bridge:client:alert', function(data) + local blip = Utility.CreateBlip(data.coords, data.sprite, 3, data.scale, data.message, true) + SetTimeout(40000, function() + Utility.RemoveBlip(blip) + end) +end) \ No newline at end of file diff --git a/modules/utility/server/VersionChecker.lua b/modules/utility/server/VersionChecker.lua new file mode 100644 index 0000000..9ee14aa --- /dev/null +++ b/modules/utility/server/VersionChecker.lua @@ -0,0 +1,38 @@ +Utility = Utility or {} + +function Utility.VersionChecker(repoPath) + local resource = repoPath:match("([^/]+)$") + if not resource then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end + + local version = GetResourceMetadata(resource, "version", 0) + if not version then return Prints.Error(('^1Unable to determine current resource version for %s ^0'):format(resource)) end + + version = version:match('%d+%.%d+%.%d+') + if not version then return Prints.Error(('^1Invalid version format for %s ^0'):format(resource)) end + + local username, reponame = repoPath:match("([^/]+)/([^/]+)") + if not username or not reponame then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end + PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response) + local failure = ('^1Unable locate github repo for resource %s ^0'):format(resource) + + if status ~= 200 then return Prints.Error(failure) end + response = json.decode(response) + + if response.prerelease then return Prints.Error(failure) end + + local latest = response.tag_name:match('%d+%.%d+%.%d+') + if not latest then return Prints.Error(failure) end + + if latest == version then return print(('^2 %s is on the latest version.^0'):format(resource)) end + local currentVersion, latestVersion = version:gsub('%D', ''), latest:gsub('%D', '') + + if currentVersion < latestVersion then + return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the GitHub release page.^7\r\n%s'):format(resource, version, response.html_url)) + end + end, 'GET') +end + +AddEventHandler('onResourceStart', function(resourceName) + if GetCurrentResourceName() ~= resourceName then return end + Utility.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge") +end) \ No newline at end of file diff --git a/modules/utility/server/logs.lua b/modules/utility/server/logs.lua new file mode 100644 index 0000000..e8c8d8d --- /dev/null +++ b/modules/utility/server/logs.lua @@ -0,0 +1,50 @@ +Utility = Utility or {} + +local WebhookURL = BridgeServerConfig.WebhookURL +local LogoForEmbed = BridgeServerConfig.WebhookImage + +Utility.SendLog = function(src, message) + if not src or not message then return end + if BridgeServerConfig.LogSystem == "builtin" then + PerformHttpRequest(WebhookURL, function(err, text, headers) end, 'POST', json.encode( + { + username = "Community_Bridge's Logger", + avatar_url = 'https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024', + embeds = { + { + color = "15769093", + title = GetCurrentResourceName(), + url = 'https://discord.gg/wsPAK5mEPg', + --description = message, + thumbnail = { url = LogoForEmbed }, + fields = { + { + name = '**Player ID**', + value = src, + inline = true, + }, + { + name = '**Player Identifier**', + value = Framework.GetPlayerIdentifier(src), + inline = true, + }, + { + name = 'Log Message', + value = "```"..message.."```", + inline = false, + }, + }, + timestamp = os.date('!%Y-%m-%dT%H:%M:%S'), + footer = { + text = "Community_Bridge | "..GetCurrentResourceName(), + icon_url = 'https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024', + }, + } + } + }), { ['Content-Type']= 'application/json' }) + elseif BridgeServerConfig.LogSystem == "qb" then + return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message) + elseif BridgeServerConfig.LogSystem == "ox" then + return exports.ox_lib:logger(src, GetCurrentResourceName(), message) + end +end \ No newline at end of file diff --git a/modules/utility/server/lootTables.lua b/modules/utility/server/lootTables.lua new file mode 100644 index 0000000..9244c54 --- /dev/null +++ b/modules/utility/server/lootTables.lua @@ -0,0 +1,70 @@ +Utility = Utility or {} + +local lootTables = {} + +Utility.RegisterLootTable = function(name, items) + local repackedTable = {} + for k, v in pairs(items) do + table.insert(repackedTable, { + name = k, + min = v.min, + max = v.max, + chance = v.chance, + tier = v.tier, + item = v.item, + metadata = v.metadata + }) + end + lootTables[name] = repackedTable + return lootTables[name] +end + +Utility.GetLootTable = function(name) + assert(name, "No Name Passed For Loot Table") + return lootTables[name] or {} +end + +Utility.GetRandomItem = function(name, tier, randomNumber) + assert(name, "No Name Passed For Loot Table") + if tier == nil then tier = 1 end + local lootTable = lootTables[name] or {} + math.randomseed(GetGameTimer()) + local chance = randomNumber or math.random(1, 100) + for _, v in pairs(lootTable) do + if v.chance <= chance and tier == v.tier then + return { item = v.item, metadata = v.metadata, count = math.random(v.min, v.max), tier = v.tier, chance = v.chance} + end + end +end + +Utility.GetRandomItems = function(name, tier, randomNumber) + assert(name, "No Name Passed For Loot Table") + if tier == nil then tier = 1 end + local lootTable = Utility.GetLootTable(name) + math.randomseed(GetGameTimer()) + local chance = randomNumber or math.random(1, 100) + local items = {} + for _, v in pairs(lootTable) do + if v.chance <= chance and tier == v.tier then + table.insert(items,{item = v.item, metadata = v.metadata, count = math.random(v.min, v.max), tier = v.tier, chance = v.chance}) + end + end + return items +end + +Utility.GetRandomItemsWithLimit = function(name, tier, randomNumber) + assert(name, "No Name Passed For Loot Table") + if tier == nil then tier = 1 end + local lootTable = Utility.GetLootTable(name) + math.randomseed(GetGameTimer()) + local chance = randomNumber or math.random(1, 100) + local items = {} + for k = #lootTable, 1, -1 do + local v = lootTable[k] + if chance <= v.chance and tier == v.tier then + table.insert(items, {v.item, v.metadata, math.random(v.min, v.max), v.tier, v.chance}) + table.remove(lootTable, k) + end + end + return items +end \ No newline at end of file diff --git a/modules/utility/server/supplement_events.lua b/modules/utility/server/supplement_events.lua new file mode 100644 index 0000000..fbe2fa1 --- /dev/null +++ b/modules/utility/server/supplement_events.lua @@ -0,0 +1,6 @@ +RegisterServerEvent("community_bridge:server:alert", function(data) + local playersByJob = Framework.GetPlayersByJob(data.job) + for _, src in pairs(playersByJob) do + TriggerClientEvent("community_bridge:client:alert", src, data) + end +end) \ No newline at end of file diff --git a/modules/utilities/shared/callbacks.lua b/modules/utility/shared/callbacks.lua similarity index 100% rename from modules/utilities/shared/callbacks.lua rename to modules/utility/shared/callbacks.lua diff --git a/modules/utility/shared/prints.lua b/modules/utility/shared/prints.lua new file mode 100644 index 0000000..a3198ac --- /dev/null +++ b/modules/utility/shared/prints.lua @@ -0,0 +1,24 @@ +Prints = Prints or {} + +local function printMessage(level, color, message) + if type(message) == 'table' then + message = json.encode(message) + end + print(color .. '[' .. level .. ']:', message) +end + +Prints.Info = function(message) + printMessage('INFO', '^5', message) +end + +Prints.Warn = function(message) + printMessage('WARN', '^3', message) +end + +Prints.Error = function(message) + printMessage('ERROR', '^1', message) +end + +Prints.Debug = function(message) + printMessage('DEBUG', '^2', message) +end \ No newline at end of file diff --git a/modules/utilities/tables.lua b/modules/utility/shared/tables.lua similarity index 100% rename from modules/utilities/tables.lua rename to modules/utility/shared/tables.lua diff --git a/modules/utility/shared/uniqueids.lua b/modules/utility/shared/uniqueids.lua new file mode 100644 index 0000000..f950b30 --- /dev/null +++ b/modules/utility/shared/uniqueids.lua @@ -0,0 +1,25 @@ +Utility = Utility or {} +-- for unique ids +Utility.CreateUniqueId = function(tbl, len, pattern) -- both optional + tbl = tbl or {} -- table to check uniqueness. Ids to check against must be the key to the tables value + len = len or 8 + + local id = "" + for i = 1, len do + local char = "" + if pattern then + char = pattern:sub(math.random(1, #pattern), math.random(1, #pattern)) + else + char = math.random(1, 2) == 1 and string.char(math.random(65, 90)) or math.random(0, 9) -- CAP letter and number + end + id = id .. char + end + if tbl[id] then + return Utility.CreateUniqueId(tbl, len, pattern) + end + return id +end + +Utility.RandomString = function() + return Utility.CreateUniqueId(nil, 14, nil) +end \ No newline at end of file diff --git a/modules/vehicleKey/MrNewbVehicleKeys/client.lua b/modules/vehicleKey/MrNewbVehicleKeys/client.lua new file mode 100644 index 0000000..75778f6 --- /dev/null +++ b/modules/vehicleKey/MrNewbVehicleKeys/client.lua @@ -0,0 +1,13 @@ +if GetResourceState('MrNewbVehicleKeys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + return exports.MrNewbVehicleKeys:GiveKeys(vehicle) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + if not vehicle and not plate then return false end + if not DoesEntityExist(vehicle) then return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate) end + return exports.MrNewbVehicleKeys:RemoveKeys(vehicle) +end \ No newline at end of file diff --git a/modules/vehicleKey/Renewed-Vehiclekeys/client.lua b/modules/vehicleKey/Renewed-Vehiclekeys/client.lua new file mode 100644 index 0000000..6d502de --- /dev/null +++ b/modules/vehicleKey/Renewed-Vehiclekeys/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('Renewed-Vehiclekeys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + return exports['Renewed-Vehiclekeys']:addKey(plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + return exports['Renewed-Vehiclekeys']:removeKey(plate) +end \ No newline at end of file diff --git a/modules/vehicleKey/cd_garage/client.lua b/modules/vehicleKey/cd_garage/client.lua new file mode 100644 index 0000000..310b9eb --- /dev/null +++ b/modules/vehicleKey/cd_garage/client.lua @@ -0,0 +1,10 @@ +if GetResourceState('cd_garage') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + TriggerEvent('cd_garage:AddKeys', plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + +end \ No newline at end of file diff --git a/modules/vehicleKey/mk_vehiclekeys/client.lua b/modules/vehicleKey/mk_vehiclekeys/client.lua new file mode 100644 index 0000000..82d7f4c --- /dev/null +++ b/modules/vehicleKey/mk_vehiclekeys/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('mk_vehiclekeys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + return exports["mk_vehiclekeys"]:AddKey(vehicle) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + return exports["mk_vehiclekeys"]:RemoveKey(vehicle) +end \ No newline at end of file diff --git a/modules/vehicleKey/okokGarage/client.lua b/modules/vehicleKey/okokGarage/client.lua new file mode 100644 index 0000000..88543e4 --- /dev/null +++ b/modules/vehicleKey/okokGarage/client.lua @@ -0,0 +1,10 @@ +if GetResourceState('okokGarage') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + TriggerServerEvent('okokGarage:GiveKeys', plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + return true +end \ No newline at end of file diff --git a/modules/vehicleKey/qb-vehiclekeys/client.lua b/modules/vehicleKey/qb-vehiclekeys/client.lua new file mode 100644 index 0000000..226200e --- /dev/null +++ b/modules/vehicleKey/qb-vehiclekeys/client.lua @@ -0,0 +1,11 @@ +if GetResourceState('qb-vehiclekeys') ~= 'started' then return end +if GetResourceState('qbx_vehiclekeys') == 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + return true +end \ No newline at end of file diff --git a/modules/vehicleKey/qbx_vehiclekeys/client.lua b/modules/vehicleKey/qbx_vehiclekeys/client.lua new file mode 100644 index 0000000..f46158c --- /dev/null +++ b/modules/vehicleKey/qbx_vehiclekeys/client.lua @@ -0,0 +1,10 @@ +if GetResourceState('qbx_vehiclekeys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + return true +end \ No newline at end of file diff --git a/modules/vehicleKey/qs-vehiclekeys/client.lua b/modules/vehicleKey/qs-vehiclekeys/client.lua new file mode 100644 index 0000000..aca4377 --- /dev/null +++ b/modules/vehicleKey/qs-vehiclekeys/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('qs-vehiclekeys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) + local verifiedPlate = GetVehicleNumberPlateText(vehicle) + exports['qs-vehiclekeys']:GiveKeys(verifiedPlate, model, true) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + return true +end \ No newline at end of file diff --git a/modules/vehicleKey/t1ger_keys/client.lua b/modules/vehicleKey/t1ger_keys/client.lua new file mode 100644 index 0000000..112e14b --- /dev/null +++ b/modules/vehicleKey/t1ger_keys/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('t1ger_keys') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + if not DoesEntityExist(vehicle) then return false end + local vehicle_display_name = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) + return exports['t1ger_keys']:GiveTemporaryKeys(plate, vehicle_display_name, 'some_keys') +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + +end \ No newline at end of file diff --git a/modules/vehicleKey/wasabi_carlock/client.lua b/modules/vehicleKey/wasabi_carlock/client.lua new file mode 100644 index 0000000..d71e8a6 --- /dev/null +++ b/modules/vehicleKey/wasabi_carlock/client.lua @@ -0,0 +1,10 @@ +if GetResourceState('wasabi_carlock') ~= 'started' then return end +VehicleKey = {} + +VehicleKey.GiveKeys = function(vehicle, plate) + exports.wasabi_carlock:GiveKey(plate) +end + +VehicleKey.RemoveKeys = function(vehicle, plate) + exports.wasabi_carlock:RemoveKey(plate) +end \ No newline at end of file