mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
Add cleanup of targets when switching players
This commit is contained in:
@@ -247,7 +247,7 @@ function GenerateRandomPedData(data)
|
|||||||
return newTable
|
return newTable
|
||||||
end
|
end
|
||||||
|
|
||||||
onPlayerUnloaded(function()
|
onPlayerUnload(function()
|
||||||
for k in pairs(Peds) do
|
for k in pairs(Peds) do
|
||||||
DeletePed(Peds[k])
|
DeletePed(Peds[k])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ function destroyProp(entity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
onPlayerUnloaded(function()
|
onPlayerUnload(function()
|
||||||
for k in pairs(Props) do
|
for k in pairs(Props) do
|
||||||
DeleteObject(Props[k])
|
DeleteObject(Props[k])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -503,8 +503,7 @@ end
|
|||||||
-- Cleanup on Resource Stop
|
-- Cleanup on Resource Stop
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|
||||||
-- When the current resource stops, remove all targets.
|
local function CleanupTargets()
|
||||||
onResourceStop(function()
|
|
||||||
-- Remove entity targets.
|
-- Remove entity targets.
|
||||||
for i = 1, #targetEntities do
|
for i = 1, #targetEntities do
|
||||||
if isStarted(OXTargetExport) then
|
if isStarted(OXTargetExport) then
|
||||||
@@ -529,4 +528,13 @@ onResourceStop(function()
|
|||||||
exports[QBTargetExport]:RemoveZone(circleTargets[i].name)
|
exports[QBTargetExport]:RemoveZone(circleTargets[i].name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
onPlayerUnload(function()
|
||||||
|
CleanupTargets()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- When the current resource stops, remove all targets.
|
||||||
|
onResourceStop(function()
|
||||||
|
CleanupTargets()
|
||||||
end, true)
|
end, true)
|
||||||
Reference in New Issue
Block a user