diff --git a/client/afk.lua b/client/afk.lua index 3d7ee19f..9d52563b 100644 --- a/client/afk.lua +++ b/client/afk.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local isLoggedIn = LocalPlayer.state.isLoggedIn local checkUser = true local prevPos, time = nil, nil diff --git a/client/carwash.lua b/client/carwash.lua index 346624f5..ad136630 100644 --- a/client/carwash.lua +++ b/client/carwash.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local washingVeh, listen = false, false local washPoly = {} diff --git a/client/consumables.lua b/client/consumables.lua index 464f59b3..36cfa4cf 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,6 +1,5 @@ -- Variables -local QBCore = exports['qb-core']:GetCoreObject() local alcoholCount = 0 local healing, parachuteEquipped = false, false local currVest, currVestTexture = nil, nil diff --git a/client/cruise.lua b/client/cruise.lua index 19aa4384..e02872b2 100644 --- a/client/cruise.lua +++ b/client/cruise.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local vehicleClasses = { [0] = true, [1] = true, @@ -31,9 +31,20 @@ local function triggerCruiseControl(veh) if speed > 0 and GetVehicleCurrentGear(veh) > 0 then speed = GetEntitySpeed(veh) local isTurningOrHandbraking = IsControlPressed(2, 76) or IsControlPressed(2, 63) or IsControlPressed(2, 64) + if GetResourceState('qb-fuel') == 'started' then + if exports['qb-fuel']:GetFuel(veh) <= 10 then + QBCore.Functions.Notify(Lang:t('cruise.not_Enough_Fuel'), 'error') + return + end + end + if GetResourceState('LegacyFuel') == 'started' then + if exports['LegacyFuel']:GetFuel(veh) <= 10 then + QBCore.Functions.Notify(Lang:t('cruise.not_Enough_Fuel'), 'error') + return + end + end TriggerEvent('seatbelt:client:ToggleCruise', true) QBCore.Functions.Notify(Lang:t('cruise.activated')) - CreateThread(function() while speed > 0 and GetPedInVehicleSeat(veh, -1) == ped do Wait(0) @@ -76,4 +87,4 @@ RegisterCommand('togglecruise', function() end end, false) -RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y') +RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y') \ No newline at end of file diff --git a/client/discord.lua b/client/discord.lua index 3041732b..862fee29 100644 --- a/client/discord.lua +++ b/client/discord.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() CreateThread(function() while Config.Discord.isEnabled do diff --git a/client/fireworks.lua b/client/fireworks.lua index 60117f60..f802a2a8 100644 --- a/client/fireworks.lua +++ b/client/fireworks.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local fireworkTime = 0 local fireworkLoc = nil local fireworkList = { @@ -35,42 +35,20 @@ local fireworkList = { } } -local function DrawText3D(x, y, z, text) - SetTextScale(0.35, 0.35) - SetTextFont(4) - SetTextProportional(true) - SetTextColour(255, 255, 255, 215) - BeginTextCommandDisplayText('STRING') - SetTextCentre(true) - AddTextComponentSubstringPlayerName(text) - SetDrawOrigin(x, y, z, 0) - EndTextCommandDisplayText(0.0, 0.0) - local factor = (string.len(text)) / 370 - DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) - ClearDrawOrigin() -end - -local function fireworkText() - CreateThread(function() - while true do - Wait(0) - if fireworkTime > 0 and fireworkLoc then - DrawText3D(fireworkLoc.x, fireworkLoc.y, fireworkLoc.z, Lang:t('firework.time_left') .. fireworkTime) - end - if fireworkTime <= 0 then break end - end - end) -end local function startFirework(asset, coords) fireworkTime = Config.Fireworks.delay fireworkLoc = { x = coords.x, y = coords.y, z = coords.z } + local pedCoords = GetEntityCoords(PlayerPedId()) CreateThread(function() - fireworkText() while fireworkTime > 0 do + if #(pedCoords - vector3(coords.x, coords.y, coords.z)) < 50.0 then + exports['qb-core']:DrawText(Lang:t('firework.time_left') .. ' ' .. fireworkTime) + end Wait(1000) fireworkTime -= 1 end + exports['qb-core']:HideText() UseParticleFxAssetNextCall('scr_indep_fireworks') for _ = 1, math.random(5, 10), 1 do local firework = fireworkList[asset][math.random(1, #fireworkList[asset])] diff --git a/client/seatbelt.lua b/client/seatbelt.lua index 18ee93b8..8478a687 100644 --- a/client/seatbelt.lua +++ b/client/seatbelt.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local seatbeltOn = false local harnessOn = false local harnessHp = Config.HarnessUses diff --git a/client/tackle.lua b/client/tackle.lua index 39f6bb33..a47d8886 100644 --- a/client/tackle.lua +++ b/client/tackle.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local function tackleAnim() local ped = PlayerPedId() diff --git a/client/vehiclepush.lua b/client/vehiclepush.lua index 714c7a5b..c0b7e0fc 100644 --- a/client/vehiclepush.lua +++ b/client/vehiclepush.lua @@ -66,6 +66,10 @@ CreateThread(function() icon = 'fas fa-wrench', label = 'Push Vehicle', action = function(entity) + if GetEntityHealth(entity) > Config.DamageNeeded then + QBCore.Functions.Notify(Lang:t('pushcar.notDamaged'), 'error') + return + end TriggerEvent('vehiclepush:client:push', entity) end, distance = 1.3 diff --git a/client/vehicletext.lua b/client/vehicletext.lua index 0d729009..0bb7767e 100644 --- a/client/vehicletext.lua +++ b/client/vehicletext.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + CreateThread(function() for _, v in pairs(QBCore.Shared.Vehicles) do diff --git a/config.lua b/config.lua index f204df42..4659abfd 100644 --- a/config.lua +++ b/config.lua @@ -1,5 +1,5 @@ Config = {} - +QBCore = exports['qb-core']:GetCoreObject() Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' -- Use qb-target interactions (don't change this, go to your server.cfg and add `setr UseTarget true` to use this and just that from true to false or the other way around) Config.PauseMapText = '' -- Text shown above the map when ESC is pressed. If left empty 'FiveM' will appear Config.HarnessUses = 20 diff --git a/locales/de.lua b/locales/de.lua index eeeda5d8..4939dbbd 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -35,7 +35,8 @@ local Translations = { cruise = { unavailable = "Tempomat nicht verfügbar", activated = "Tempomat aktiviert", - deactivated = "Tempomat deaktiviert" + deactivated = "Tempomat deaktiviert", + not_Enough_Fuel = "Nicht genug Treibstoff" }, editor = { started = "Aufnahme gestartet!", @@ -46,7 +47,7 @@ local Translations = { firework = { place_progress = "Feuerwerk platzieren...", canceled = "Abgebrochen...", - time_left = "Feuerwerk startet in ~r~" + time_left = "Feuerwerk startet in " }, seatbelt = { use_harness_progress = "Renngurt anlegen", @@ -57,7 +58,8 @@ local Translations = { teleport_default = 'Aufzug benutzen' }, pushcar = { - stop_push = "[E] Schieben beenden" + stop_push = "[E] Schieben beenden", + notDamaged = "Das Fahrzeug ist nicht beschädigt genug, um es zu schieben!", } } diff --git a/locales/en.lua b/locales/en.lua index b35d9b9b..b3ad3007 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -35,7 +35,8 @@ local Translations = { cruise = { unavailable = "Cruise control unavailable", activated = "Cruise control activated", - deactivated = "Cruise control deactivated" + deactivated = "Cruise control deactivated", + not_Enough_Fuel = "Not enough fuel" }, editor = { started = "Started Recording!", @@ -46,7 +47,7 @@ local Translations = { firework = { place_progress = "Placing firework...", canceled = "Canceled...", - time_left = "Firework launch in ~r~" + time_left = "Firework launch in " }, seatbelt = { use_harness_progress = "Attaching Race Harness", @@ -57,7 +58,8 @@ local Translations = { teleport_default = 'Use Elevator' }, pushcar = { - stop_push = "[E] Stop Pushing" + stop_push = "[E] Stop Pushing", + notDamaged = "The vehicle isn't damaged enough to push!", } } diff --git a/locales/es.lua b/locales/es.lua index a9b6d0c6..a487943a 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -35,7 +35,8 @@ local Translations = { cruise = { unavailable = "Control de crucero no disponible", activated = "Control de crucero activado", - deactivated = "Control de crucero desactivado" + deactivated = "Control de crucero desactivado", + not_Enough_Fuel = "No hay suficiente combustible" }, editor = { started = "¡Grabación iniciada!", @@ -46,7 +47,7 @@ local Translations = { firework = { place_progress = "Colocando fuegos artificiales...", canceled = "Cancelado...", - time_left = "Lanzamiento de fuegos artificiales en ~r~" + time_left = "Lanzamiento de fuegos artificiales en " }, seatbelt = { use_harness_progress = "Colocando arnés de carrera", @@ -57,7 +58,8 @@ local Translations = { teleport_default = 'Usar ascensor' }, pushcar = { - stop_push = "[E] Dejar de empujar" + stop_push = "[E] Dejar de empujar", + notDamaged = "¡El vehículo no está lo suficientemente dañado para empujar!" } } diff --git a/locales/nl.lua b/locales/nl.lua index b1a90805..9b111629 100644 --- a/locales/nl.lua +++ b/locales/nl.lua @@ -35,7 +35,8 @@ local Translations = { cruise = { unavailable = "Cruisecontrol niet beschikbaar", activated = "Cruise geactiveerd", - deactivated = "Cruise gedeactiveerd" + deactivated = "Cruise gedeactiveerd", + not_Enough_Fuel = "Niet genoeg brandstof" }, editor = { started = "Aan het opnemen!", @@ -46,7 +47,7 @@ local Translations = { firework = { place_progress = "Vuurwerk aan het plaatsen...", canceled = "Geannuleerd...", - time_left = "Vuurwerk over ~r~" + time_left = "Vuurwerk over " }, seatbelt = { use_harness_progress = "Raceharnas bevestigen", @@ -57,7 +58,8 @@ local Translations = { teleport_default = 'Gebruik lift' }, pushcar = { - stop_push = "[E] Stop met duwen" + stop_push = "[E] Stop met duwen", + notDamaged = "Het voertuig is niet beschadigd genoeg om te duwen!" } } diff --git a/locales/pt-br.lua b/locales/pt-br.lua index 66e49cce..2f32a3e7 100644 --- a/locales/pt-br.lua +++ b/locales/pt-br.lua @@ -35,7 +35,8 @@ local Translations = { cruise = { unavailable = "Controle de cruzeiro indisponível", activated = "Cruise Control Ativado", - deactivated = "Cruise Control Desativado" + deactivated = "Cruise Control Desativado", + not_Enough_Fuel = "Combustível insuficiente" }, editor = { started = "Gravação Iniciada!", @@ -46,7 +47,7 @@ local Translations = { firework = { place_progress = "Soltando fogos de artifício...", canceled = "Cancelado...", - time_left = "Fogos de artifício acabaram ~r~" + time_left = "Fogos de artifício acabaram " }, seatbelt = { use_harness_progress = "Prendendo o Cinto de Corrida", diff --git a/locales/pt.lua b/locales/pt.lua index dafccf23..3309fd03 100644 --- a/locales/pt.lua +++ b/locales/pt.lua @@ -30,11 +30,34 @@ local Translations = { ["time_until_firework"] = "Fogo de Artifício em ~r~%{time}", ["push_vehicle"] = "[~g~SHIFT~w~] + [~g~E~w~] para empurrar veículo" }, + cruise = { + ["not_Enough_Fuel"] = "Combustível insuficiente", + ["activated"] = "Cruise control ativado", + ["deactivated"] = "Cruise control desativado", + ["unavailable"] = "Cruise control indisponível" + }, editor = { ["record"] = "Gravação Iniciada!", ["save"] = "Gravação Guardada!", ["delete_clip"] = "Gravação Apagada!", ["editor"] = "Later aligator!" + }, + firework = { + ["canceled"] = "Cancelado...", + ["time_left"] = "Fogo de Artifício em ", + ["place_firework"] = "A colocar fogo de artifício..." + }, + seatbelt = { + ["no_car"] = "Não estás dentro de um carro.", + ["use_harness"] = "A colocar Arnês de Corrida", + ["remove_harness"] = "A remover Arnês de Corrida" + }, + teleport = { + ["teleport_default"] = "Usar Elevador" + }, + pushcar = { + ["stop_push"] = "[E] Parar de Empurrar", + ["notDamaged"] = "O veículo não está danificado o suficiente para empurrar!" } } diff --git a/server/afk.lua b/server/afk.lua index 2c0ae135..611edd7c 100644 --- a/server/afk.lua +++ b/server/afk.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + RegisterNetEvent('KickForAFK', function() DropPlayer(source, Lang:t("afk.kick_message")) diff --git a/server/consumables.lua b/server/consumables.lua index 69df6db3..ae4c01c0 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + ----------- / alcohol for k, _ in pairs(Config.Consumables.alcohol) do diff --git a/server/logs.lua b/server/logs.lua index f0a67b39..804cb6cc 100644 --- a/server/logs.lua +++ b/server/logs.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local Webhooks = { ['default'] = '', diff --git a/server/main.lua b/server/main.lua index ec3097ce..c7f3c7be 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,4 +1,4 @@ -local QBCore = exports['qb-core']:GetCoreObject() + RegisterNetEvent('tackle:server:TacklePlayer', function(playerId) TriggerClientEvent('tackle:client:GetTackled', playerId)