[PAID][ESX] Bus Driver Job

can other players get on the bus as well

Yes, why couldn’t they?

You could add it when the bus is created but sure we can add another function to the config so you should be able to add your events and functions on bus repair

other bus jobs i have used did not let players get on the bus and npcs, so had to ask

If you dont have other scripts that block you from entering it should work fine

I checked to add it but I believe its encrypted.

Download the newest version from Tebex. I said its in the Config and Config is not encrypted. There is a event on bus creating, but we will also add on repair as you wanted. There will be update in a few days.

whan you we do the qbus ??

No support available? edit : good support !

There is support, you need to write to me on direct message :mascot:

Realy great script and fast support. Thanks Sandacz for helping me, i love this “bus simulator” like :wink:

1 Like

Can you answer private message , thank you!

1 Like

Yo’ please answer private message?

New version has been released. This is a minor change requested by @ChewYTHESTR

v1.4.1 - 07.02.2023

  • Allow getting ESX shared object via export
  • New config options:
    • Config.sharedObjectUseExportSv (default false) (server) Specify if ESX shared object should be requested via event or export
    • Config.sharedObjectUseExportCl (default false) (client) Specify if ESX shared object should be requested via event or export
    • Config.sharedObjectResourceNameSv (default 'es_extended') (server) Resource name of ESX shared object (usually ‘es_extended’)
    • Config.sharedObjectResourceNameCl (default 'es_extended') (client) Resource name of ESX shared object (usually ‘es_extended’)
2 Likes

local function BusIsBeingTaken(x, y, z, head)
–[[
if something then --perhaps check if the player is under influence of alcohol or something? maybe he does not have the bus license?
– the original function will not be called, only this one will be called
print(json.encode({x, y, z, head}))
else
– the original function will be called, as well as the code here
print(json.encode({x, y, z, head}))
TriggerEvent(‘nl_autobus:busIsBeingTakenDone’, x,y,z,head)
end
]]
TriggerEvent(‘nl_autobus:busIsBeingTakenDone’, x,y,z,head)
end

how to add security deposit in this because no source please provide discord link

This is very easy, however you need to implement this yourself:

Attached below, you can see example code that you NEED to MODIFY yourself!!

replace this function

BusIsBeingTaken code
    local function BusIsBeingTaken(x, y, z, head)
        local p = promise.new()
        ESX.TriggerServerCallback('nl_autobus:tryPayDeposit', function(ok)
            p:resolve(ok)
        end)
        local canTake = Citizen.Await(p)
        if canTake then
            ClientShowPlayerNotification("Security deposit has been taken from your account")
            TriggerEvent('nl_autobus:busIsBeingTakenDone', x,y,z,head)
        else
            ClientShowPlayerNotification("You don't have enough money to pay the security deposit")
        end
    end

replace this function too

BusIsBeingReturned code
    local function BusIsBeingReturned(bus)
        TriggerServerEvent('nl_autobus:tryToReturnDeposit')
        TriggerEvent('nl_autobus:busIsBeingReturnedDone', bus)
    end

add this at the end of the config.lua - this is EXAMPLE INCOMPLETE CODE - you have to write your own code

example security deposit code
if IsDuplicityVersion() then
    -- this code will run only on the server because it's inside of a IsDuplicityVersion() check
    local playersWithDeposits = {}
    ESX.RegisterServerCallback('nl_autobus:tryPayDeposit', function(source, cb)
        if playersWithDeposits[source] ~= true then
            playersWithDeposits[source] = true

            -- todo: take money away from the player
            print('you need to implement a function to take money away from the player')

            cb(true)
            return
        end
        cb(false)
    end)

    RegisterNetEvent('nl_autobus:tryToReturnDeposit', function()
        if playersWithDeposits[source] == true then
            playersWithDeposits[source] = nil

            -- todo: give the money back to player
            print('you need to implement a function to give money back to the player')

        end
    end)

end

hpw to get some extra pedestrians ? the ppl drive this bus and the most time they get no pedestrians a wanna add some in bus stop info bit cant see what trigger is used from you for it

v1.5.0 - 17.03.2023

  • Config.sharedObjectUseExportSv and Config.sharedObjectUseExportCl are now true by default
  • Ensured compatibility with latest ESX 1.9.x
  • fix FoundNextBusStop method not being triggered

hello, you can use FoundNextBusStop method in the config, it’s been fixed in the latest version (1.5.0) so make sure you update your resource from keymaster. the method is called when the bus departs from stop, or when the bus is spawned, the passed coordinates are the coordinates of the NEXT bus stop, you can then trigger an event to spawn some peds, but make sure you figure out a way to delete unnecessary peds later on.

Can you adjust the time it takes between each stop?