Remove example scripts and update core logic

Deleted all files in the examples directory to clean up unused or test scripts. Updated fxmanifest.lua to enable ox_lib initialization. Improved error handling and entity tracking in utility functions, added prop removal, and made minor localization and code style adjustments throughout the codebase. Significant reword of inventory module, notification module, and framework module. Added support for wasabi_uikit, added support for keep-progressbars,
This commit is contained in:
MrNewb committed 2025-12-14 16:22:35 -05:00
1 parent c40a260ea2
commit 343af95794
100 files changed
+2403 -2755

No files matched your search

+26 -9
View File
@@ -1,6 +1,7 @@
Utility = Utility or {}
local blipIDs = {}
local spawnedPeds = {}
local spawnedProps = {}
Locales = Locales or Require('modules/locales/shared.lua')
Point = Point or Require('lib/points/client/points.lua')
@@ -39,10 +40,11 @@ end
---@return number|nil
function Utility.CreateProp(model, coords, heading, networked)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
local propEntity = CreateObject(hash, coords.x, coords.y, coords.z, networked, false, false)
SetEntityHeading(propEntity, heading)
SetModelAsNoLongerNeeded(hash)
spawnedProps[tostring(propEntity)] = true
return propEntity
end
@@ -62,7 +64,7 @@ end
---@return number|nil, table
function Utility.CreateVehicle(model, coords, heading, networked)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, {}, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, {}, print("^6 Model was unable to load "..tostring(model).." ^0") end
local vehicle = CreateVehicle(hash, coords.x, coords.y, coords.z, heading, networked, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetVehicleNeedsToBeHotwired(vehicle, false)
@@ -80,7 +82,7 @@ end
---@return number|nil
function Utility.CreatePed(model, coords, heading, networked, settings)
local loaded, hash = ensureModelLoaded(model)
if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end
if not loaded then return nil, print("^6 Model was unable to load "..tostring(model).." ^0") end
local spawnedEntity = CreatePed(0, hash, coords.x, coords.y, coords.z, heading, networked, false)
SetModelAsNoLongerNeeded(hash)
spawnedPeds[tostring(spawnedEntity)] = true
@@ -120,14 +122,12 @@ end
function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, displayType)
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, sprite or 8)
SetTextFont(0)
SetBlipDisplay(blip, displayType or 2)
SetBlipScale(blip, scale or 0.8)
SetBlipColour(blip, color or 3)
SetBlipScale(blip, scale or 0.8)
SetBlipDisplay(blip, displayType or 2)
SetBlipAsShortRange(blip, shortRange)
BeginTextCommandSetBlipName("STRING")
--AddTextComponentSubstringPlayerName(label) -- switch to this if below line doesnt show da chinese
AddTextComponentString(label)
AddTextComponentSubstringPlayerName(label)
EndTextCommandSetBlipName(blip)
blipIDs[tostring(blip)] = blip
return blip
@@ -174,7 +174,7 @@ end
---@param blip number
---@return boolean
function Utility.RemoveBlip(blip)
if not blipIDs[tostring(blip)] then return false, print("NO BLIP BY ID") end
if not blipIDs[tostring(blip)] then return false, print("^6 No blip to remove with matching ID ^0") end
RemoveBlip(blipIDs[tostring(blip)])
blipIDs[tostring(blip)] = nil
return true
@@ -213,6 +213,18 @@ function Utility.RemovePed(entity)
return true
end
---Remove a ped if it exists
---@param entity number
---@return boolean
function Utility.RemoveProp(entity)
if not spawnedProps[tostring(entity)] then return false end
spawnedProps[tostring(entity)] = nil
if not DoesEntityExist(entity) then return false end
SetEntityAsMissionEntity(entity, true, true)
DeleteEntity(entity)
return true
end
---Show a native input menu and return the result
---@param text string
---@param length number
@@ -615,6 +627,11 @@ AddEventHandler('onResourceStop', function(resource)
DeleteEntity(tonumber(ped))
end
end
for _, prop in pairs(spawnedProps) do
if prop and DoesEntityExist(tonumber(prop)) then
DeleteEntity(tonumber(prop))
end
end
end)
exports('Utility', Utility)