version '0.0.9'
This commit is contained in:
1 parent
4e28ee5793
commit
ce4ea7fca5
8 files changed
+114
-60
No files matched your search
@@ -1,3 +1,5 @@
|
||||
Utility = Utility or {}
|
||||
|
||||
local activePlacementProp = nil
|
||||
lib.locale()
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Utility = {}
|
||||
Utility = Utility or {}
|
||||
local blipIDs = {}
|
||||
local spawnedPeds = {}
|
||||
local ActivePoints = {}
|
||||
lib.locale()
|
||||
|
||||
Utility.CreateVehicle = function(model, coords, heading, networked)
|
||||
@@ -228,6 +229,42 @@ Utility.GetClosestPlayer = function(coords, distanceScope, includeMe)
|
||||
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
|
||||
Reference in new issue
Block a user