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
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)
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['br'] = {
['buy_vehicle_shop'] = 'comprar %s por $%s?',
['buy_vehicle'] = 'comprar veículo',
['car_dealer'] = 'Concessionária de carros',
['shop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
['shop_awaiting_model'] = 'the vehicle is currently loading, please wait',
['create_bill'] = 'criar recibo',
['dealer_boss'] = 'Concessionária de carros - Chefe',
['delivered'] = 'veículo ~g~entregue~s~ para o revendedor',
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['en'] = {
['buy_vehicle_shop'] = 'do you want to purchase %s for $%s?',
['buy_vehicle'] = 'buy vehicle',
['car_dealer'] = 'car Dealership',
['shop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
['shop_awaiting_model'] = 'the vehicle is currently loading, please wait',
['create_bill'] = 'create bill',
['dealer_boss'] = 'car Dealer - Boss',
['delivered'] = 'the vehicle has been ~g~delivered~s~ to the dealer',
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['fi'] = {
['buy_vehicle_shop'] = 'haluatko ostaa ajoneuvon %s hintaan $%s?',
['buy_vehicle'] = 'osta ajoneuvo',
['car_dealer'] = 'autokauppa',
['shop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
['shop_awaiting_model'] = 'the vehicle is currently loading, please wait',
['create_bill'] = 'tee lasku',
['dealer_boss'] = 'autokauppa - Pomo',
['delivered'] = 'ajoneuvo on ~g~kuljetettu~s~ myyjälle',
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['fr'] = {
['buy_vehicle_shop'] = 'acheter %s pour $%s?',
['buy_vehicle'] = 'acheter véhicule',
['car_dealer'] = 'concessionnaire',
['shop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
['shop_awaiting_model'] = 'the vehicle is currently loading, please wait',
['create_bill'] = 'créer facture',
['dealer_boss'] = 'concessionnaire - Patron',
['delivered'] = 'véhicule ~g~rendu~s~ au concessionnaire',
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['pl'] = {
['buy_vehicle_shop'] = 'czy chcesz kupić %s za $%s?',
['buy_vehicle'] = 'kup pojazd',
['car_dealer'] = 'sprzedawca Aut',
['shop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
['shop_awaiting_model'] = 'the vehicle is currently loading, please wait',
['create_bill'] = 'stwórz fakture',
['dealer_boss'] = 'salon samochodowy - Szef',
['delivered'] = 'pojazd został ~g~dostarczony~s~ do salonu',
+1 -1
View File
@@ -11,7 +11,7 @@ Locales['sv'] = {
['buy_vehicle_shop'] = 'vill du köpa in %s för %s SEK?',
['buy_vehicle'] = 'Köp in fordon',
['car_dealer'] = 'bilförsäljare',
['shop_awaiting_model'] = 'ditt fordon håller på att ~g~LADDA NER & LÄSA IN~s~ vänta tills det är klart',
['shop_awaiting_model'] = 'fordon laddas in, vänligen vänta',
['create_bill'] = 'ge faktura',
['dealer_boss'] = 'chefmeny',
['delivered'] = 'fordonet har ~g~lämnats tillbaka~s~ till bilförsäljaren',