gpt-4.1-mini-2025-04-14· OpenAI
WildChat-4.8M (AI2)
Can you Create FiveM Qbcore Taxi Job Script ?
- User
Can you Create FiveM Qbcore Taxi Job Script ?
- Assistant
Certainly! Below is a basic example of a FiveM QBCore Taxi Job Script to get you started. This script allows a player to toggle on/off their taxi duty, pick up and drop off passengers, and earn money via a simple fare system.
Features:
- Players can toggle taxi duty with
/taxicommand. - When on duty, players can "start job" and "end job".
- Passengers can request a taxi via an NPC or marker (simple example: interact with "taxi stand" to request a taxi).
- Drivers earn money per passenger transported.
- Basic notifications and job checks.
How to use this script?
- Save as
taxijob.luain your qb-core resources folder (e.g.,resources/[jobs]/taxi/). - Add
start taxito your resource manifest (fxmanifest.lua). - Ensure qb-core is referenced properly.
- Customize as needed (pricing, markers, animations, etc.).
Script Code
fxmanifest.lua
fx_version 'cerulean' game 'gta5' author 'YourName' description 'QBCore Taxi Job Script' version '1.0.0' shared_script '@qb-core/shared/locale.lua' shared_script 'config.lua' client_scripts { 'client.lua', } server_scripts { '@qb-core/shared/locale.lua', 'server.lua', 'config.lua', }
config.lua
Config = {} Config.TaxiDutyPay = 100 -- Amount paid per passenger delivered Config.TaxiVehicle = 'taxi' -- Taxi vehicle model Config.TaxiStandCoords = vector3(895.27, -179.52, 74.70) -- Location Taxi drivers spawn/get requests Config.TaxiStandRadius = 10.0
server.lua
local QBCore = exports['qb-core']:GetCoreObject() local OnDutyPlayers = {} QBCore.Commands.Add('taxi', 'Toggle Taxi Duty', {}, false, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) if not Player then return end if OnDutyPlayers[src] then OnDutyPlayers[src] = nil TriggerClientEvent('QBCore:Notify', src, 'You are now off duty.', 'error') else OnDutyPlayers[src] = true TriggerClientEvent('QBCore:Notify', src, 'You are now on duty. Ready to pick passengers!', 'success') end TriggerClientEvent('taxi:client:setDuty', src, OnDutyPlayers[src] == true) end) QBCore.Functions.CreateCallback('taxi:server:isOnDuty', function(source, cb) cb(OnDutyPlayers[source] == true) end) RegisterNetEvent('taxi:server:completeJob') AddEventHandler('taxi:server:completeJob', function() local src = source local Player = QBCore.Functions.GetPlayer(src) if Player and OnDutyPlayers[src] then Player.Functions.AddMoney('cash', Config.TaxiDutyPay, "taxi-payment") TriggerClientEvent('QBCore:Notify', src, 'Fare Received: $' .. Config.TaxiDutyPay, 'success') else TriggerClientEvent('QBCore:Notify', src, 'You must be on duty to earn money.', 'error') end end)
client.lua
local QBCore = exports['qb-core']:GetCoreObject() local onDuty = false local taxiBlip = nil local inTaxiVehicle = false -- Toggle Duty from server event RegisterNetEvent('taxi:client:setDuty', function(duty) onDuty = duty if duty then CreateTaxiBlip() else RemoveTaxiBlip() end end) -- Check when player enters vehicle Citizen.CreateThread(function() while true do Citizen.Wait(1000) local ped = PlayerPedId() local veh = GetVehiclePedIsIn(ped, false) if veh ~= 0 then local model = GetEntityModel(veh) if model == GetHashKey(Config.TaxiVehicle) then inTaxiVehicle = true else inTaxiVehicle = false end else inTaxiVehicle = false end end end) -- Main Taxi Stand marker & interaction Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = PlayerPedId() local coords = GetEntityCoords(ped) if Vdist(coords, Config.TaxiStandCoords) < Config.TaxiStandRadius then DrawMarker(2, Config.TaxiStandCoords.x, Config.TaxiStandCoords.y, Config.TaxiStandCoords.z, 0, 0, 0, 0, 0, 0, 0.4, 0.4, 0.4, 255, 255, 0, 150, 0, 0, 0, 0) if Vdist(coords, Config.TaxiStandCoords) < 1.0 then QBCore.Functions.DrawText3D(Config.TaxiStandCoords.x, Config.TaxiStandCoords.y, Config.TaxiStandCoords.z + 0.5, '[E] Request Taxi') if IsControlJustReleased(0, 38) then -- E key if not onDuty then QBCore.Functions.Notify('You are not on taxi duty.', 'error') elseif inTaxiVehicle then RequestPassenger() else QBCore.Functions.Notify('You need to be in a taxi vehicle.', 'error') end end end end end end) function RequestPassenger() -- For simplicity, just simulate passenger request and completion QBCore.Functions.Notify('Passenger picked up. Drive to destination.') -- Destination could be random or fixed, here just increased distance away local dest = vector3(Config.TaxiStandCoords.x + math.random(-50, 50), Config.TaxiStandCoords.y + math.random(-50, 50), Config.TaxiStandCoords.z) DrawDestinationMarker(dest) WaitForDropoff(dest) end function DrawDestinationMarker(coords) Citizen.CreateThread(function() while true do Citizen.Wait(0) local pedCoords = GetEntityCoords(PlayerPedId()) if Vdist(pedCoords, coords) < 20.0 then DrawMarker(1, coords.x, coords.y, coords.z - 1.0, 0, 0, 0, 0, 0, 0, 1.5, 1.5, 1.5, 0, 255, 0, 150, 0, 0, 0, 0) if Vdist(pedCoords, coords) < 3.0 then QBCore.Functions.DrawText3D(coords.x, coords.y, coords.z, '[E] Dropoff Passenger') if IsControlJustReleased(0, 38) then -- E key CompleteJob() break end end end end end) end function WaitForDropoff(dest) -- This is part of the same thread with DrawDestinationMarker, might be better structure in full script end function CompleteJob() QBCore.Functions.Notify('Passenger dropped off. Payment incoming...') TriggerServerEvent('taxi:server:completeJob') end function CreateTaxiBlip() if taxiBlip ~= nil then return end taxiBlip = AddBlipForCoord(Config.TaxiStandCoords) SetBlipSprite(taxiBlip, 198) -- Taxi icon SetBlipColour(taxiBlip, 5) SetBlipScale(taxiBlip, 0.8) SetBlipAsShortRange(taxiBlip, true) BeginTextCommandSetBlipName("STRING") AddTextComponentString("Taxi Stand") EndTextCommandSetBlipName(taxiBlip) end function RemoveTaxiBlip() if taxiBlip ~= nil then RemoveBlip(taxiBlip) taxiBlip = nil end end
Notes and suggestions
- This is a basic template — you can expand upon this with features like:
- More realistic passenger NPCs requesting rides.
- Different fares according to distance or ride type.
- Taxi vehicle spawning/despawning.
- Job vehicle storage and management.
- Use of animations for passengers entering/exiting vehicle.
- Integration with radio/job chat.
- Adjust the coordinates and amounts to your server's map and economy.
If you want, I can also help you build more advanced features or integrate with your existing systems! Let me know.
- Players can toggle taxi duty with