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