This commit is contained in:
Nordi98 2025-06-12 16:16:47 +02:00
parent f10ca59400
commit 26083791e2
4 changed files with 16 additions and 2 deletions

View file

@ -25,6 +25,17 @@ local function cleanupEntities()
end
end
-- Cleanup other players weapons
for playerId, weapons in pairs(otherPlayersWeapons) do
for weaponName, _ in pairs(weapons) do
if Sling.cachedAttachments[weaponName] then
safeDelete(Sling.cachedAttachments[weaponName].obj)
safeDelete(Sling.cachedAttachments[weaponName].placeholder)
end
end
otherPlayersWeapons[playerId] = nil
end
Sling.currentAttachedAmount = 0
collectgarbage("collect")
end

View file

@ -18,8 +18,6 @@ Sling = {
}
}
local otherPlayersWeapons = {}
function Sling:SyncWeaponAttachment(weaponName, weaponVal, coords, action)
local weaponData = {
weaponName = weaponName,
@ -29,6 +27,9 @@ function Sling:SyncWeaponAttachment(weaponName, weaponVal, coords, action)
TriggerServerEvent('force-sling:server:syncWeapons', weaponData, action)
end
[Rest der Datei bleibt unverändert...]
function Sling:InitMain()
Debug("info", "Initializing main thread")

View file

@ -0,0 +1 @@
otherPlayersWeapons = {}

View file

@ -37,6 +37,7 @@ client_scripts {
"client/custom/frameworks/*.lua",
"client/custom/*.lua",
"client/misc/*.lua",
'client/shared.lua',
}
files {