fixed bugs

This commit is contained in:
Mustache Dom committed 2024-11-12 02:07:16 -08:00
1 parent 9d828a2b15
commit abb1bba3fe
11 files changed
+30 -29

No files matched your search

+12 -8
View File
@@ -1,18 +1,22 @@
local QBCore = exports['qb-core']:GetCoreObject()
local shrooms = {}
local function LoadModels(hash)
hash = GetHashKey(hash)
RequestModel(hash)
local timeout = GetGameTimer() + 5000 -- 5-second timeout
while not HasModelLoaded(hash) and GetGameTimer() < timeout do
Wait(10)
end
if HasModelLoaded(hash) then return true end
end
local function pick(loc)
if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end
TriggerServerEvent("shrooms:pickupCane", loc)
end
function LoadModel(hash)
RequestModel(hash)
while not HasModelLoaded(hash) do
Wait(0)
end
end
RegisterNetEvent('shrooms:respawnCane', function(loc)
local v = GlobalState.shrooms[loc]
local hash = GetHashKey(v.model)
@@ -42,7 +46,7 @@ end)
RegisterNetEvent("shrooms:init", function()
for k, v in pairs (GlobalState.shrooms) do
local hash = GetHashKey(v.model)
lib.requestModel(v.model, Config.RequestModelTime)
if not HasModelLoaded(hash) then LoadModels(hash) end
if not v.taken then
shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(shrooms[k], true, v.heading)