added delay for locking helpers

This commit is contained in:
Chr1Z93 2023-04-12 18:07:40 +02:00
parent 044b3a06e2
commit dee13c5d26

View File

@ -907,9 +907,7 @@ end
function spawnOrRemoveHelper(state, name, position, rotation) function spawnOrRemoveHelper(state, name, position, rotation)
if state then if state then
Player.getPlayers()[1].pingTable(position) Player.getPlayers()[1].pingTable(position)
local spawnedHelper = spawnHelperObject(name, position, rotation) return spawnHelperObject(name, position, rotation).getGUID()
spawnedHelper.setLock(true)
return spawnedHelper.getGUID()
else else
return removeHelperObject(name) return removeHelperObject(name)
end end
@ -937,6 +935,9 @@ function spawnHelperObject(name, position, rotation)
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
if obj["Nickname"] == name then if obj["Nickname"] == name then
spawnTable.data = obj spawnTable.data = obj
spawnTable.callback_function = function(spawnedObj)
Wait.time(function() spawnedObj.setLock(true) end, 1)
end
return spawnObjectData(spawnTable) return spawnObjectData(spawnTable)
end end
end end