From 9e2f942dd0550a2f1033fe5d9cc1e702dc9e10d6 Mon Sep 17 00:00:00 2001 From: Noah Pombas Date: Fri, 3 Jan 2025 18:55:53 +0100 Subject: [PATCH] Upload Script! --- pTaxi/esx/client.lua | 193 +++++++++++++++++++++++++++++++ pTaxi/esx/config.lua | 15 +++ pTaxi/esx/fxmanifest.lua | 23 ++++ pTaxi/esx/pTaxi-esx.zip | Bin 0 -> 3765 bytes pTaxi/esx/server.lua | 28 +++++ pTaxi/qbcore/client.lua | 208 ++++++++++++++++++++++++++++++++++ pTaxi/qbcore/config.lua | 16 +++ pTaxi/qbcore/fxmanifest.lua | 22 ++++ pTaxi/qbcore/pTaxi-qbcore.zip | Bin 0 -> 3805 bytes pTaxi/qbcore/server.lua | 22 ++++ 10 files changed, 527 insertions(+) create mode 100644 pTaxi/esx/client.lua create mode 100644 pTaxi/esx/config.lua create mode 100644 pTaxi/esx/fxmanifest.lua create mode 100644 pTaxi/esx/pTaxi-esx.zip create mode 100644 pTaxi/esx/server.lua create mode 100644 pTaxi/qbcore/client.lua create mode 100644 pTaxi/qbcore/config.lua create mode 100644 pTaxi/qbcore/fxmanifest.lua create mode 100644 pTaxi/qbcore/pTaxi-qbcore.zip create mode 100644 pTaxi/qbcore/server.lua diff --git a/pTaxi/esx/client.lua b/pTaxi/esx/client.lua new file mode 100644 index 0000000..d30c029 --- /dev/null +++ b/pTaxi/esx/client.lua @@ -0,0 +1,193 @@ +-- Made with ❤️ by noahpombas.ch +if Pombas.legacy == true then + ESX = exports["es_extended"]:getSharedObject() +else + Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + end) +end + +local lastTaxiCallTime = nil +local cooldownTime = Pombas.delay * 60 + +RegisterCommand("chamarTaxi", function(source, args, rawCommand) + SetWaypointOff() + local currentTime = GetGameTimer() / 1000 + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + + if lastTaxiCallTime ~= nil and (currentTime - lastTaxiCallTime < cooldownTime) then + local remainingTime = cooldownTime - (currentTime - lastTaxiCallTime) + local time = math.floor(remainingTime / 60) + TriggerEvent("chat:addMessage", { args = { "^1Táxi ", "Você precisa esperar " .. time .. " minutos para chamar outro táxi!" } }) + return + end + + + lastTaxiCallTime = currentTime + + TriggerServerEvent("taxi:verificarSaldo") +end) + +-- Made with ❤️ by noahpombas.ch +RegisterNetEvent("taxi:saldoVerificado") +AddEventHandler("taxi:saldoVerificado", function(temSaldo) + if not temSaldo then + TriggerEvent("chat:addMessage", { args = { "^1Táxi", "Você não tem dinheiro suficiente no banco!" } }) + return + end + + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + local taxiModel = GetHashKey(Pombas.car) + local driverModel = GetHashKey(Pombas.driverModel) + + RequestModel(taxiModel) + RequestModel(driverModel) + while not HasModelLoaded(taxiModel) or not HasModelLoaded(driverModel) do + Wait(500) + end + + local foundRoad, outPos1, outPos2 = GetClosestRoad(coords.x, coords.y, coords.z, 1.0, 1, false) + local spawnCoords = vector3(0.0, 0.0, 0.0) + + if foundRoad then + spawnCoords = (outPos1 + outPos2) / 2 + else + spawnCoords = vector3(coords.x + 10, coords.y + 10, coords.z) + end + + local taxi = CreateVehicle(taxiModel, spawnCoords.x, spawnCoords.y, spawnCoords.z, GetEntityHeading(ped), true, false) + SetEntityAsMissionEntity(taxi, true, true) + + + local driver = CreatePedInsideVehicle(taxi, 26, driverModel, -1, true, false) + SetBlockingOfNonTemporaryEvents(driver, true) + SetPedCanBeDraggedOut(driver, false) + SetDriverAbility(driver, 1.0) + SetDriverAggressiveness(driver, 0.0) + TaskVehicleDriveWander(driver, taxi, 20.0, 786603) + SetEntityInvincible(taxi, true) + SetEntityInvincible(driver, true) + SetEntityAsMissionEntity(driver, true, true) + SetPedCombatAttributes(driver, 46, true) + SetPedFleeAttributes(driver, 0, false) + SetBlockingOfNonTemporaryEvents(driver, true) + + TaskVehicleDriveToCoord(driver, taxi, spawnCoords.x, spawnCoords.y, spawnCoords.z, 5000.0, 0, GetEntityModel(taxi), 786603, 1.0, true) + + + local taxiBlip = AddBlipForEntity(taxi) + SetBlipSprite(taxiBlip, 198) + SetBlipColour(taxiBlip, 46) + SetBlipScale(taxiBlip, 1.0) + + + local playerEntered = false + while not playerEntered do + local taxiCoords = GetEntityCoords(taxi) + local pedCoords = GetEntityCoords(ped) + + if #(pedCoords - taxiCoords) < 10.0 then + SetWaypointOff() + TaskEnterVehicle(ped, taxi, -1, 1, 1.0, 1, 0) + playerEntered = true + end + Wait(500) + end + + -- Solicitar que o jogador marque um destino no mapa + TriggerEvent("chat:addMessage", { args = { "^2Táxi", "Por favor, marque o destino no mapa!" } }) + local destinoMarcado = false + local waypointCoords = nil + + while not destinoMarcado do + local waypointBlip = GetFirstBlipInfoId(8) -- 8 é o ID de waypoint + if DoesBlipExist(waypointBlip) then + waypointCoords = GetBlipInfoIdCoord(waypointBlip) + destinoMarcado = true + end + Wait(500) + end + + local isPassenger = GetPedInVehicleSeat(taxi, 1) + local playerInside = false + + while not playerInside do + local pedCoords = GetEntityCoords(ped) + local taxiCoords = GetEntityCoords(taxi) + if #(pedCoords - taxiCoords) < 10.0 then + TaskEnterVehicle(ped, taxi, -1, 1, 1.0, 1, 0) + playerInside = true + end + end + + local foundRoad, outPos1, outPos2 = GetClosestRoad(waypointCoords.x, waypointCoords.y, waypointCoords.z, 1.0, 1, false) + if foundRoad then + spawnCoords = (outPos1 + outPos2) / 2 + else + spawnCoords = vector3(waypointCoords.x, waypointCoords.y, waypointCoords.z) + end + + + local destinoBlip = AddBlipForCoord(spawnCoords.x, spawnCoords.y, spawnCoords.z) + SetBlipSprite(destinoBlip, 1) + SetBlipColour(destinoBlip, 5) + SetBlipScale(destinoBlip, 1.0) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Destino") + EndTextCommandSetBlipName(destinoBlip) + + + local playerCoords = GetEntityCoords(PlayerPedId()) + local distancia = #(playerCoords - spawnCoords) + local preco = math.floor(distancia * Pombas.price) + + TriggerEvent("chat:addMessage", { args = { "^2Táxi", "Destino marcado! Custo estimado: $" .. preco } }) + + + TaskVehicleDriveToCoord(driver, taxi, spawnCoords.x, spawnCoords.y, spawnCoords.z, 5000.0, 0, GetEntityModel(taxi), 2883621, 1.0, true) + + local playerExited = 0 + local arrivedAtDestination = false + + while true do + local playerCoords = GetEntityCoords(PlayerPedId()) + local distancia = #(playerCoords - spawnCoords) + local isPassenger = GetPedInVehicleSeat(taxi, 1) + + + if isPassenger == 0 then + if playerExited == 0 then + playerExited = 1 + TriggerEvent("chat:addMessage", { args = { "^1Táxi", "Destino cancelado!" } }) + TriggerServerEvent('taxi:chargeFullPrice', preco) + Wait(3000) + DeleteVehicle(taxi) + DeletePed(driver) + RemoveBlip(destinoBlip) + end + end + + + if distancia < 10.0 and not arrivedAtDestination then + arrivedAtDestination = true + playerExited = 1 + TriggerEvent("chat:addMessage", { args = { "^1Táxi", "Chegou ao seu Destino!" } }) + TriggerServerEvent('taxi:chargeFullPrice', preco) + TaskLeaveVehicle(PlayerPedId(), taxi, 0) + Wait(3000) + DeleteVehicle(taxi) + DeletePed(driver) + RemoveBlip(destinoBlip) + end + + + + + Wait(1000) + end +end) \ No newline at end of file diff --git a/pTaxi/esx/config.lua b/pTaxi/esx/config.lua new file mode 100644 index 0000000..2069ef6 --- /dev/null +++ b/pTaxi/esx/config.lua @@ -0,0 +1,15 @@ +-- ███╗ ██╗ ██████╗ █████╗ ██╗ ██╗██████╗ ██████╗ ███╗ ███╗██████╗ █████╗ ███████╗ ██████╗██╗ ██╗ +-- ████╗ ██║██╔═══██╗██╔══██╗██║ ██║██╔══██╗██╔═══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝ ██╔════╝██║ ██║ +-- ██╔██╗ ██║██║ ██║███████║███████║██████╔╝██║ ██║██╔████╔██║██████╔╝███████║███████╗ ██║ ███████║ +-- ██║╚██╗██║██║ ██║██╔══██║██╔══██║██╔═══╝ ██║ ██║██║╚██╔╝██║██╔══██╗██╔══██║╚════██║ ██║ ██╔══██║ +-- ██║ ╚████║╚██████╔╝██║ ██║██║ ██║██║ ╚██████╔╝██║ ╚═╝ ██║██████╔╝██║ ██║███████║ ██╗ ╚██████╗██║ ██║ +-- ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ +Pombas = {} + +Pombas.legacy = true -- true = legacy ||| false = esx +Pombas.delay = 5, -- command cooldown in minutes +Pombas.car = "taxi", -- Car Model +Pombas.driverModel = "s_m_m_movprem_01", -- Driver Model | https://docs.fivem.net/docs/game-references/ped-models/ +Pombas.price = 0.2, -- Price per Meter +Pombas.minBalance = 50 -- Minimum Balance to call a Taxi +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/esx/fxmanifest.lua b/pTaxi/esx/fxmanifest.lua new file mode 100644 index 0000000..f0188f4 --- /dev/null +++ b/pTaxi/esx/fxmanifest.lua @@ -0,0 +1,23 @@ +-- Made with ❤️ by noahpombas.ch +fx_version 'cerulean' +game 'gta5' + +author 'noahpombas.ch' +description 'pTaxi, made with ❤️ by noahpombas.ch' +version '1.0.0' + +client_scripts { + 'client.lua', +} + +server_scripts { + '@es_extended/locale.lua', + 'server.lua' +} + +shared_script 'config.lua' + +dependencies { + 'es_extended' +} +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/esx/pTaxi-esx.zip b/pTaxi/esx/pTaxi-esx.zip new file mode 100644 index 0000000000000000000000000000000000000000..637c421ebfccae057641f888ca9a05777afb7dad GIT binary patch literal 3765 zcmai12T+q+77k4UNa#&O5{g1-QUXX3=^!PPAkw6V8k&@d^j<`|p{Y~@q7tHg@7$Sh?tF8;^POX)M?uL70G@59NBow6-xe(Z z3~=;xbN2EV_YANPK+^%pC`s3Ue#{W`0O|+)Xctm+^PydOEo{8Fl(iE?{N4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E<1>&B&$Y0VtY*+Gh?3l!ZS@kN8W z>I)gX4=c(J`Xm7tabzb`&&n5oSQWGia1Vm|+rJZpC@Oc_zlG68luIN5*;+F0e>>}k0yGfRs9fPJD z)kdSXx)IRyKe{gHE&Mn>xh?&)yUYkUjbHm?^J8kuQ(MSvlwdjrA<)$;#hW@}&b!E3 zBc9lL#93tJxIGRT zVYJ|bVxhv(EO)Z%7_)PS3r$?5+1Yn8QQ{Fb=XLE1?_8+W1noxk9|->Z7Sf4$bIVkl zO>d6B327biqes49B{SnW*e3&cm>yb65yKd)Q|H__t%(Vp# z7ucg|4qozW4pVP4cvE|^d=o-kPg>cgFD+Fy=_+Cp8fWy3ft-V1N8ciswRE~Iy68sf z`zDCciBHY8^KOqnUjryZJHhcp2L0uIRJ4HqR|U>6NfqFCOp-Ew=i{$$l%oUuFP)s>ku+kYM|F= Pombas.minBalance then + TriggerClientEvent("taxi:saldoVerificado", source, true) + else + TriggerClientEvent("taxi:saldoVerificado", source, false) + end +end) + +RegisterServerEvent("taxi:chargeFullPrice") +AddEventHandler("taxi:chargeFullPrice", function(preco) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + + if xPlayer.getAccount('bank').money >= preco then + xPlayer.removeAccountMoney('bank', preco) + TriggerClientEvent('esx:showNotification', _source, "Você foi cobrado pelo valor total da viagem: $" .. preco) + else + TriggerClientEvent('esx:showNotification', _source, "Você não tem dinheiro suficiente para pagar a viagem!") + end +end) +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/qbcore/client.lua b/pTaxi/qbcore/client.lua new file mode 100644 index 0000000..df76e79 --- /dev/null +++ b/pTaxi/qbcore/client.lua @@ -0,0 +1,208 @@ +-- Made with ❤️ by noahpombas.ch +local QBCore = exports['qb-core']:GetCoreObject() + +local lastTaxiCallTime = nil +local cooldownTime = Pombas.delay * 60 + +-- Command to call a taxi +RegisterCommand("chamarTaxi", function() + local currentTime = GetGameTimer() / 1000 + if lastTaxiCallTime and (currentTime - lastTaxiCallTime < cooldownTime) then + local remainingTime = cooldownTime - (currentTime - lastTaxiCallTime) + QBCore.Functions.Notify("Espere " .. math.floor(remainingTime / 60) .. " minutos para chamar outro táxi.", "error") + return + end + + lastTaxiCallTime = currentTime + TriggerServerEvent("taxi:verificarSaldo") +end) + +-- Handle balance verification +RegisterNetEvent("taxi:saldoVerificado") +AddEventHandler("taxi:saldoVerificado", function(hasBalance) + if not hasBalance then + QBCore.Functions.Notify("Você não tem dinheiro suficiente no banco.", "error") + return + end + + -- Spawn taxi and driver + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + local taxiModel = GetHashKey(Pombas.car) + local driverModel = GetHashKey(Pombas.driverModel) + + RequestModel(taxiModel) + RequestModel(driverModel) + while not HasModelLoaded(taxiModel) or not HasModelLoaded(driverModel) do + Wait(500) + end + + + local foundRoad, outPos1, outPos2 = GetClosestRoad(coords.x, coords.y, coords.z, 1.0, 1, false) + local spawnCoords = vector3(0.0, 0.0, 0.0) + + if foundRoad then + spawnCoords = (outPos1 + outPos2) / 2 + else + + spawnCoords = vector3(coords.x + 10, coords.y + 10, coords.z) + end + + local taxi = CreateVehicle(taxiModel, spawnCoords.x, spawnCoords.y, spawnCoords.z, GetEntityHeading(ped), true, false) + TriggerEvent('fuel:setFuel', taxi, 100.0) + + SetEntityAsMissionEntity(taxi, true, true) + SetVehicleHasBeenOwnedByPlayer(taxi, true) + SetVehicleDoorsLocked(taxi, 1) + SetVehicleDoorsLockedForAllPlayers(taxi, false) + TriggerEvent('vehiclekeys:client:SetOwner', GetVehicleNumberPlateText(taxi)) + + local driver = CreatePedInsideVehicle(taxi, 26, driverModel, -1, true, false) + SetBlockingOfNonTemporaryEvents(driver, true) + SetPedCanBeDraggedOut(driver, false) + SetDriverAbility(driver, 1.0) + SetDriverAggressiveness(driver, 0.0) + SetEntityInvincible(taxi, true) + SetEntityInvincible(driver, true) + SetEntityAsMissionEntity(driver, true, true) + SetPedCombatAttributes(driver, 46, true) + SetPedFleeAttributes(driver, 0, false) + SetBlockingOfNonTemporaryEvents(driver, true) + + + TaskVehicleDriveToCoord(driver, taxi, spawnCoords.x, spawnCoords.y, spawnCoords.z, 5000.0, 0, GetEntityModel(taxi), 786603, 1.0, true) + + -- Taxi Blip + local taxiBlip = AddBlipForEntity(taxi) + SetBlipSprite(taxiBlip, 198) + SetBlipColour(taxiBlip, 46) + SetBlipScale(taxiBlip, 1.0) + + -- wait player to enter taxi + local playerEntered = false + while not playerEntered do + local taxiCoords = GetEntityCoords(taxi) + local pedCoords = GetEntityCoords(ped) + + if #(pedCoords - taxiCoords) < 10.0 then + Wait(500) + TaskEnterVehicle(ped, taxi, -1, 1, 1.0, 1, 0) + playerEntered = true + end + Wait(500) + end + + + QBCore.Functions.Notify("Por favor, marque um destino no mapa!.", "warning") + + local destinoMarcado = false + local waypointCoords = nil + + while not destinoMarcado do + local isPassenger = GetPedInVehicleSeat(taxi, 1) + local waypointBlip = GetFirstBlipInfoId(8) -- 8 é o ID de waypoint + if DoesBlipExist(waypointBlip) then + print(isPassenger) + if isPassenger ~= 0 then + waypointCoords = GetBlipInfoIdCoord(waypointBlip) + destinoMarcado = true + end + end + Wait(500) + end + + local playerInside = false + + while not playerInside do + local pedCoords = GetEntityCoords(ped) + local taxiCoords = GetEntityCoords(taxi) + + if IsPedInVehicle(ped, taxi, false) then + playerInside = true + else + if #(pedCoords - taxiCoords) < 10.0 then + TaskEnterVehicle(ped, taxi, -1, 1, 1.0, 1, 0) + else + + QBCore.Functions.Notify("Aproxime-se do táxi para entrar!", "info") + Wait(1000) + end + end + + Wait(500) + end + + local foundRoad, outPos1, outPos2 = GetClosestRoad(waypointCoords.x, waypointCoords.y, waypointCoords.z, 1.0, 1, false) + if foundRoad then + spawnCoords = (outPos1 + outPos2) / 2 + else + spawnCoords = vector3(waypointCoords.x, waypointCoords.y, waypointCoords.z) + end + + -- create new Blip named Destination + local destinoBlip = AddBlipForCoord(spawnCoords.x, spawnCoords.y, spawnCoords.z) + SetBlipSprite(destinoBlip, 1) -- Ícone simples + SetBlipColour(destinoBlip, 5) -- Cor amarela + SetBlipScale(destinoBlip, 1.0) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Destination") + EndTextCommandSetBlipName(destinoBlip) + + -- calculate price in base of the distance + local playerCoords = GetEntityCoords(PlayerPedId()) + local distancia = #(playerCoords - spawnCoords) + local preco = math.floor(distancia * Pombas.price) + + QBCore.Functions.Notify("Destination marked! Estimated Price: $" .. preco, "error") + + + -- taxi drives to destination + TaskVehicleDriveToCoord(driver, taxi, spawnCoords.x, spawnCoords.y, spawnCoords.z, 5000.0, 0, GetEntityModel(taxi), 2883621, 1.0, true) + + local playerExited = 0 + local arrivedAtDestination = false + + + Citizen.CreateThread(function() + while DoesEntityExist(driver) do + if not IsPedInVehicle(driver, taxi, true) then + ClearPedTasks(driver) + end + Wait(500) + end + end) + + while true do + local playerCoords = GetEntityCoords(PlayerPedId()) + local distancia = #(playerCoords - spawnCoords) + local isPassenger = GetPedInVehicleSeat(taxi, 1) + + + if isPassenger == 0 then + if playerExited == 0 then + playerExited = 1 + QBCore.Functions.Notify("Destino cancelado!.", "error") + TriggerServerEvent("taxi:charge", preco) + Wait(3000) + DeleteVehicle(taxi) + DeletePed(driver) + RemoveBlip(destinoBlip) + end + end + + if distancia < 10.0 and not arrivedAtDestination then + arrivedAtDestination = true + playerExited = 1 + QBCore.Functions.Notify("Chegou ao seu Destino!", "error") + TriggerServerEvent("taxi:charge", preco) + TaskLeaveVehicle(PlayerPedId(), taxi, 0) + Wait(3000) + DeleteVehicle(taxi) + DeletePed(driver) + RemoveBlip(destinoBlip) + end + + Wait(1000) +end +end) +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/qbcore/config.lua b/pTaxi/qbcore/config.lua new file mode 100644 index 0000000..776899a --- /dev/null +++ b/pTaxi/qbcore/config.lua @@ -0,0 +1,16 @@ +-- ███╗ ██╗ ██████╗ █████╗ ██╗ ██╗██████╗ ██████╗ ███╗ ███╗██████╗ █████╗ ███████╗ ██████╗██╗ ██╗ +-- ████╗ ██║██╔═══██╗██╔══██╗██║ ██║██╔══██╗██╔═══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝ ██╔════╝██║ ██║ +-- ██╔██╗ ██║██║ ██║███████║███████║██████╔╝██║ ██║██╔████╔██║██████╔╝███████║███████╗ ██║ ███████║ +-- ██║╚██╗██║██║ ██║██╔══██║██╔══██║██╔═══╝ ██║ ██║██║╚██╔╝██║██╔══██╗██╔══██║╚════██║ ██║ ██╔══██║ +-- ██║ ╚████║╚██████╔╝██║ ██║██║ ██║██║ ╚██████╔╝██║ ╚═╝ ██║██████╔╝██║ ██║███████║ ██╗ ╚██████╗██║ ██║ +-- ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ + + +Pombas = { + car = "taxi", -- Car Model + driverModel = "s_m_m_movprem_01", -- Driver Model | https://docs.fivem.net/docs/game-references/ped-models/ + price = 0.2, -- Price per Meter + delay = 5, -- command cooldown in minutes + minBalance = 50 -- Minimum Balance to call a Taxi +} +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/qbcore/fxmanifest.lua b/pTaxi/qbcore/fxmanifest.lua new file mode 100644 index 0000000..d333520 --- /dev/null +++ b/pTaxi/qbcore/fxmanifest.lua @@ -0,0 +1,22 @@ +-- Made with ❤️ by noahpombas.ch +fx_version 'cerulean' +game 'gta5' + +author 'noahpombas.ch' +description 'pTaxi, made with ❤️ by noahpombas.ch' +version '1.0.0' + +client_scripts { + 'client.lua', +} + +server_scripts { + 'server.lua', +} + +shared_script 'config.lua' + +dependencies { + 'qb-core', +} +-- Made with ❤️ by noahpombas.ch \ No newline at end of file diff --git a/pTaxi/qbcore/pTaxi-qbcore.zip b/pTaxi/qbcore/pTaxi-qbcore.z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921d --- /dev/null +++ b/pTaxi/qbcore/server.lua @@ -0,0 +1,22 @@ +-- Made with ❤️ by noahpombas.ch +local QBCore = exports['qb-core']:GetCoreObject() + +RegisterNetEvent("taxi:verificarSaldo") +AddEventHandler("taxi:verificarSaldo", function() + local src = source + local Player = QBCore.Functions.GetPlayer(src) + if Player.Functions.GetMoney("bank") >= Pombas.minBalance then + TriggerClientEvent("taxi:saldoVerificado", src, true) + else + TriggerClientEvent("taxi:saldoVerificado", src, false) + end +end) + +RegisterNetEvent("taxi:charge") +AddEventHandler("taxi:charge", function(amount) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + Player.Functions.RemoveMoney("bank", amount, "Pagamento do Taxi") +end) + +-- Made with ❤️ by noahpombas.ch \ No newline at end of file