Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation to pt-br and loadmodel for low specs #73

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,23 @@ end
local function startTestDriveTimer(time)
local gameTimer = GetGameTimer()
local timeMs = time * 1000
local outVeh = false
while not IsPedInAnyVehicle(cache.ped, false) do Wait(0) end

CreateThread(function()
while inTestDrive do
local currentGameTime = GetGameTimer()
local secondsLeft = currentGameTime - gameTimer
if currentGameTime < gameTimer + timeMs and secondsLeft >= timeMs - 50 then
if currentGameTime < gameTimer + timeMs and secondsLeft >= timeMs - 50 or outVeh then
TriggerServerEvent('qbx_vehicleshop:server:deleteVehicle', testDriveVeh)
testDriveVeh = 0
inTestDrive = false
exports.qbx_core:Notify(locale('general.testdrive_complete'), 'success')
end
qbx.drawText2d({ text = locale('general.testdrive_timer')..math.ceil(time - secondsLeft / 1000), coords = vec2(1.0, 1.38), scale = 0.5})
if not IsPedInAnyVehicle(cache.ped, false) or IsPlayerDead(cache.playerId) then
outVeh = true
end
Wait(0)
end
end)
Expand Down Expand Up @@ -507,7 +512,7 @@ end
---@param coords vector4
---@return number vehicleEntity
local function createShowroomVehicle(model, coords)
lib.requestModel(model, 1000)
lib.requestModel(model, 5000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhabs may be worth use requestModelTimeout

local veh = CreateVehicle(model, coords.x, coords.y, coords.z, coords.w, false, false)
SetModelAsNoLongerNeeded(model)
SetVehicleOnGroundProperly(veh)
Expand Down Expand Up @@ -598,6 +603,8 @@ RegisterNetEvent('qbx_vehicleshop:client:testDrive', function(args)
local plate = 'TEST'..lib.string.random('1111')
local netId = lib.callback.await('qbx_vehicleshop:server:spawnVehicle', false, args.vehicle, testDrive.spawn, plate)
testDriveVeh = netId
while not NetworkGetEntityFromNetworkId(netId) do Wait(100) end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib.waitFor should be better option


exports.qbx_core:Notify(locale('general.testdrive_timenoti', testDrive.limit), 'inform')
startTestDriveTimer(testDrive.limit * 60)
end)
Expand Down
2 changes: 1 addition & 1 deletion config/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ return {
useTarget = false,
debugPoly = false,
enableFreeUseBuy = true, -- Allows players to buy from NPC shops
requestModelTimeout = 5000, -- load model timeout for oxlib
requestModelTimeout = 100000, -- load model timeout for oxlib
enableTestDrive = true,

finance = {
Expand Down
2 changes: 1 addition & 1 deletion config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ return {
finance = {
paymentWarning = 10, -- time in minutes that player has to make payment before repo
paymentInterval = 24, -- time in hours between payment being due
preventSelling = false, -- prevents players from using /transfervehicle if financed
preventSelling = true, -- prevents players from using /transfervehicle if financed
},
saleTimeout = 60000 -- Delay between attempts to sell/gift a vehicle. Prevents abuse
}
83 changes: 83 additions & 0 deletions locales/pt-br.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"error": {
"testdrive_alreadyin": "Já está em um test drive",
"testdrive_return": "Este não é o seu veículo de test drive",
"Invalid_ID": "ID de jogador fornecido inválido",
"playertoofar": "Este jogador não está perto o suficiente",
"notenoughmoney": "Dinheiro insuficiente",
"minimumallowed": "O pagamento mínimo permitido é $",
"overpaid": "Você pagou a mais",
"alreadypaid": "O veículo já está quitado",
"notworth": "O veículo não vale tanto",
"downtoosmall": "Pagamento inicial muito pequeno",
"exceededmax": "Excedido o valor máximo de pagamento",
"repossessed": "Seu veículo com placa %s foi recuperado",
"buyerinfo": "Não foi possível obter informações do comprador",
"notinveh": "Você deve estar no veículo que deseja transferir",
"vehinfo": "Não foi possível obter informações do veículo",
"notown": "Você não possui este veículo",
"buyertoopoor": "O comprador não tem dinheiro suficiente",
"nofinanced": "Você não possui nenhum veículo financiado",
"financed": "Este veículo está financiado",
"buyerdeclined": "O jogador recusou a transação",
"sale_timeout": "Espere um pouco antes de negociar seu veículo"
},
"success": {
"purchased": "Parabéns pela compra!",
"earned_commission": "Você ganhou $ %s de comissão",
"gifted": "Você presenteou seu veículo",
"received_gift": "Você recebeu um veículo de presente",
"soldfor": "Você vendeu seu veículo por $",
"boughtfor": "Você comprou um veículo por $"
},
"menus": {
"vehHeader_header": "Opções do Veículo",
"vehHeader_txt": "Interaja com o veículo atual",
"financed_header": "Veículos Financiados",
"finance_txt": "Veja seus veículos possuídos",
"returnTestDrive_header": "Finalizar Test Drive",
"categories_header": "Categorias",
"goback_header": "Voltar",
"veh_price": "Preço: $",
"veh_platetxt": "Placa: ",
"veh_finance": "Pagamento do Veículo",
"veh_finance_balance": "Saldo Total Restante",
"veh_finance_currency": "$",
"veh_finance_total": "Pagamentos Totais Restantes",
"veh_finance_reccuring": "Valor do Pagamento Recorrente",
"veh_finance_pay": "Efetuar um pagamento",
"veh_finance_payoff": "Quitar veículo",
"veh_finance_payment": "Valor do Pagamento ($)",
"submit_text": "Enviar",
"test_header": "Test Drive",
"finance_header": "Financiar Veículo",
"owned_vehicles_header": "Veículos Possuídos",
"swap_header": "Trocar Veículo",
"swap_txt": "Troque o veículo atualmente selecionado",
"financesubmit_downpayment": "Valor do Pagamento Inicial - Mín ",
"financesubmit_totalpayment": "Pagamentos Totais - Máx ",
"freeuse_test_txt": "Teste o veículo atualmente selecionado",
"freeuse_buy_header": "Comprar Veículo",
"freeuse_buy_txt": "Compre o veículo atualmente selecionado",
"freeuse_finance_txt": "Financie o veículo atualmente selecionado",
"managed_test_txt": "Permita que o jogador faça um test drive",
"managed_sell_header": "Vender Veículo",
"managed_sell_txt": "Venda o veículo para o jogador",
"managed_finance_txt": "Financie o veículo para o jogador",
"submit_ID": "ID do Servidor (#)",
"keypress_showFinanceMenu": "[E] Abrir Menu de Finanças",
"keypress_vehicleViewMenu": "[E] Visualizar Veículo"
},
"general": {
"testdrive_timer": "Tempo Restante do Test Drive: ",
"vehinteraction": "Interação com o Veículo",
"testdrive_timenoti": "Você tem %s minutos restantes",
"testdrive_complete": "Test drive do veículo concluído",
"paymentduein": "Seu pagamento do veículo vence em %s minutos",
"command_transfervehicle": "Presenteie ou venda seu veículo",
"command_transfervehicle_help": "ID do comprador",
"command_transfervehicle_amount": "Valor da venda (opcional)",
"transfervehicle_confirm": "Confirmar a troca de %s %s por $ %s"
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last line should be empty

10 changes: 6 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ lib.callback.register('qbx_vehicleshop:server:GetVehiclesByName', function(sourc
local vehicles = FetchVehicleEntitiesByCitizenId(player.PlayerData.citizenid)
local financeVehicles = FetchFinancedVehicleEntitiesByCitizenId(player.PlayerData.citizenid)
for _, v in pairs(financeVehicles) do
vehicles[v.vehicleId].balance = v.balance
vehicles[v.vehicleId].paymentamount = v.paymentamount
vehicles[v.vehicleId].paymentsleft = v.paymentsleft
vehicles[v.vehicleId].financetime = v.financetime
if vehicles[v.vehicleId] then
vehicles[v.vehicleId].balance = v.balance
vehicles[v.vehicleId].paymentamount = v.paymentamount
vehicles[v.vehicleId].paymentsleft = v.paymentsleft
vehicles[v.vehicleId].financetime = v.financetime
end
end
if vehicles[1] then
return vehicles
Expand Down