forked from Simnation/Main
sling
This commit is contained in:
parent
6e5993916b
commit
8095e624a4
3 changed files with 10 additions and 16 deletions
|
@ -12,7 +12,6 @@ local function cleanupEntities()
|
|||
return false
|
||||
end
|
||||
|
||||
-- Sicherheitsprüfung für Sling
|
||||
if Sling then
|
||||
if Sling.object then
|
||||
safeDelete(Sling.object)
|
||||
|
@ -32,23 +31,19 @@ local function cleanupEntities()
|
|||
Sling.currentAttachedAmount = 0
|
||||
end
|
||||
|
||||
-- Cleanup other players weapons
|
||||
if otherPlayersWeapons then
|
||||
for playerId, weapons in pairs(otherPlayersWeapons) do
|
||||
for weaponName, _ in pairs(weapons) do
|
||||
if Sling and Sling.cachedAttachments and Sling.cachedAttachments[weaponName] then
|
||||
safeDelete(Sling.cachedAttachments[weaponName].obj)
|
||||
safeDelete(Sling.cachedAttachments[weaponName].placeholder)
|
||||
end
|
||||
for playerId, weapons in pairs(otherPlayersWeapons) do
|
||||
for weaponName, _ in pairs(weapons) do
|
||||
if Sling and Sling.cachedAttachments and Sling.cachedAttachments[weaponName] then
|
||||
safeDelete(Sling.cachedAttachments[weaponName].obj)
|
||||
safeDelete(Sling.cachedAttachments[weaponName].placeholder)
|
||||
end
|
||||
otherPlayersWeapons[playerId] = nil
|
||||
end
|
||||
otherPlayersWeapons[playerId] = nil
|
||||
end
|
||||
|
||||
collectgarbage("collect")
|
||||
end
|
||||
|
||||
-- Verzögere die Registrierung der Events bis Sling initialisiert ist
|
||||
CreateThread(function()
|
||||
while not Sling do
|
||||
Wait(100)
|
||||
|
@ -85,9 +80,7 @@ AddEventHandler('force-sling:client:syncWeapons', function(playerId, weaponData,
|
|||
local targetPed = GetPlayerPed(GetPlayerFromServerId(playerId))
|
||||
if not targetPed or not DoesEntityExist(targetPed) then return end
|
||||
|
||||
if not otherPlayersWeapons[playerId] then
|
||||
otherPlayersWeapons[playerId] = {}
|
||||
end
|
||||
otherPlayersWeapons[playerId] = otherPlayersWeapons[playerId] or {}
|
||||
|
||||
Utils:CreateAndAttachWeapon(
|
||||
weaponData.weaponName,
|
||||
|
|
|
@ -13,7 +13,7 @@ dependencies {
|
|||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
'client/shared.lua', -- Moved here to be loaded first
|
||||
"shared/variables.lua", -- Add this line
|
||||
"shared/*.lua",
|
||||
"config.lua",
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ server_scripts {
|
|||
|
||||
client_scripts {
|
||||
"client/utils.lua",
|
||||
"client/functions.lua", -- Moved before events
|
||||
"client/functions.lua",
|
||||
"client/events.lua",
|
||||
"client/main.lua",
|
||||
"client/custom/frameworks/*.lua",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
otherPlayersWeapons = {}
|
Loading…
Add table
Add a link
Reference in a new issue