Targets, entities and events, oh my!

Targets updated to have boxzone
Entities dont require a model and are effectively points with on spawn on despawn
onplayerloaded and onplayeriunloaded now pass source
This commit is contained in:
gononono64 committed 2025-06-02 22:19:42 -05:00
1 parent 3a141cb8f2
commit 34d24cb6a9
11 files changed
+61 -352

No files matched your search

+16 -3
View File
@@ -102,19 +102,32 @@ end
---@param size table
---@param heading number
---@param options table
Target.AddBoxZone = function(name, coords, size, heading, options)
options = Target.FixOptions(options)
Target.AddBoxZone = function(name, coords, size, heading, options, debug)
options = Target.FixOptions(options or {})
local target = ox_target:addBoxZone({
coords = coords,
size = size,
rotation = heading,
debug = targetDebug,
debug = debug or targetDebug,
options = options,
})
table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() })
return target
end
-- RegisterCommand('boxzone:test', function(source, args, rawCommand)
-- local coords = GetEntityCoords(PlayerPedId())
-- Target.AddBoxZone('test_zone', coords, { 2.0, 2.0, 2.0 }, 0.0, {
-- {
-- label = 'Test Option',
-- icon = 'fas fa-check',
-- onSelect = function()
-- print('Test option selected!')
-- end
-- }
-- }, true)
-- end)
---This will add a circle zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
+5 -5
View File
@@ -66,7 +66,7 @@ Target.AddGlobalVehicle = function(options)
})
end
---This will remove target options from all vehicles.
---This will remove target options from all vehicles.
---@param options table
Target.RemoveGlobalVehicle = function(options)
local assembledLables = {}
@@ -116,14 +116,14 @@ end
---@param size table
---@param heading number
---@param options table
Target.AddBoxZone = function(name, coords, size, heading, options)
Target.AddBoxZone = function(name, coords, size, heading, options, debug)
options = Target.FixOptions(options)
qb_target:AddBoxZone(name, coords, size.x, size.y, {
name = name,
debugPoly = targetDebug,
debugPoly = debug or targetDebug,
heading = heading,
minZ = coords.z - (size.x * 0.5),
maxZ = coords.z + (size.x * 0.5),
minZ = coords.z - (size.z * 0.5),
maxZ = coords.z + (size.z * 0.5),
}, {
options = options,
distance = options.distance or 1.5,