Adds a bus driver job to drive NPCs around, with a few default routes.
Any help welcome, as I have not been able to recreate the error.
cd resources
git clone https://github.com/propstg/esx-blarglebus.git [esx]/esx-blarglebus
[esx]
directoryserver.cfg
:start esx-blarglebus
If you use FrFuel or LegacyFuel, set the appropriate option in config.lua to true to set the bus fuel level to 100% on spawn.
Custom vehicles can be added by editing config/busType.lua and adding a bus object to the BusType table.
CityBus = { -- This is the name that you will use in your route configs (BusType.CityBus)
BusModel = 'bus',
Capacity = 15,
Doors = {0, 1, 2, 3},
FirstSeat = 1
},
:warning: IMPORTANT: Doors
must be updated to reflect the doors on the bus. If the game tries to open a door that doesn't exist on the model you are using, there is a good chance it will cause your player's game to crash. Possibly with an error message like florida-fanta-snake
. See #3, below.
{}
) is acceptable, if you don't want to be bothered figuring out the doors and are okay with the NPCs opening them by themselves.Routes can be customized with your own stops. A route can also consist of one or more "lines", which can be randomly or directly selected.
To create a new route:
config/routes
. Example, with details:
AirportRoute = { -- The name of the route (what you add to Config.Routes)
Name = 'airport_route', -- The key to look up the display name in the localization file. A corresponding entry should be added to locales/*.lua.
Bus = BusType.Shuttle, -- The default bus type to use for the route.
SpawnPoint = {x = -923.7001, y = -2283.8886, z = 6.7090, heading = 333.65}, -- The spawn point for the bus.
BusReturnPoint = {x = -923.7001, y = -2283.8886, z = 6.7090, heading = 333.65}, -- The place to go to return the bus at the end of a route.
Payment = 8000,
PaymentPerPassenger = 10,
Lines = {...} -- A list of all the stops
}
config/config.lua
to reference the new route that you addedFor an example of how to have more than one line, take a look at the metro config.
The following properties can be set in a line to override the defaults for the route:
Lines = {
{
BusOverride = BusType.Shuttle,
BusReturnPointOverride = {x = 280.416, y = -1230.68, z = 29.138, heading = 265.05},
...
Routes use a table of stop objects. Each has the coordinates, a key for the display name, and an unload type.
{x = 424.7632, y = -638.9176, z = 28.5001, name = 'stop_dashound', unloadType = UnloadType.All},
For routes that have no overlapping stops, it might be easiest to just have the table inline (airport and scenic). For routes that have many lines with overlapping stops, pulling the stops out into a common table and then just referencing them might save you some time if you ever need to make any changes to a commonly used stop (metro).
name
is a key to look up the display name in the localization file. A corresponding entry should be added to locales/*.lua.esx-blarglebus - bus driver job
Copyright (C) 2019 Gregory Propst
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.
This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.
You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/.