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