Fix spawned vehicles not unloading from memory, closes #142

Co-Authored-By: Alex Garcio <redalex@users.noreply.github.com>
This commit is contained in:
ElPumpo
2019-05-31 12:35:09 +02:00
co-authored by Alex Garcio
parent 3705e6b654
commit 967cde347e
7 changed files with 16 additions and 31 deletions
+10 -25
View File
@@ -365,6 +365,7 @@ function OpenShopMenu()
table.insert(LastVehicles, vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(vehicleData.model)
end)
end)
@@ -375,6 +376,7 @@ function OpenShopMenu()
table.insert(LastVehicles, vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
FreezeEntityPosition(vehicle, true)
SetModelAsNoLongerNeeded(firstVehicleData.model)
end)
end
@@ -385,18 +387,16 @@ function WaitForVehicleToLoad(modelHash)
if not HasModelLoaded(modelHash) then
RequestModel(modelHash)
BeginTextCommandBusyString('STRING')
AddTextComponentSubstringPlayerName(_U('shop_awaiting_model'))
EndTextCommandBusyString(4)
while not HasModelLoaded(modelHash) do
Citizen.Wait(1)
DisableControlAction(0, Keys['TOP'], true)
DisableControlAction(0, Keys['DOWN'], true)
DisableControlAction(0, Keys['LEFT'], true)
DisableControlAction(0, Keys['RIGHT'], true)
DisableControlAction(0, 176, true) -- ENTER key
DisableControlAction(0, Keys['BACKSPACE'], true)
drawLoadingText(_U('shop_awaiting_model'), 255, 255, 255, 255)
DisableAllControlActions(0)
end
RemoveLoadingPrompt()
end
end
@@ -999,19 +999,4 @@ Citizen.CreateThread(function()
LoadInterior(interiorID)
EnableInteriorProp(interiorID, 'csr_beforeMission') -- Load large window
RefreshInterior(interiorID)
end)
function drawLoadingText(text, red, green, blue, alpha)
SetTextFont(4)
SetTextScale(0.0, 0.5)
SetTextColour(red, green, blue, alpha)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextCentre(true)
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(0.5, 0.5)
end
end)