Skip to content

Commit

Permalink
fix: cleanup lua scripts on player drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanzaida committed May 28, 2024
1 parent 6d2653c commit 0d6b5c5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,14 @@ else
TriggerServerEvent('bcl-runcode:run:lua:server', id, data)
cbs[id] = cb
end)
end
end

AddEventHandler('playerDropped', function()
local source = tostring(source)
for id, script in pairs(scripts) do
if string.sub(id, 1, #source) == source then
script:cleanup()
scripts[id] = nil
end
end
end)

0 comments on commit 0d6b5c5

Please sign in to comment.