Advanced Public Transport AI

f474f315f6d66be59d86195a3f6b793d3395cc31_2_690x484

What’s this

This resource will make public transport aviable managed by the game AI.

No more out of scope entity management

If one or more players are close enough to a bus, you will see a bus driving around.
When no players are close enough to a bus, the server will simulate its position based on the baked data.

No requirements

Completely standalone, no framework or resources needed

Add custom routes

  1. Open config.lua and create a new route like in the example.
    IMPORTANT NOTES:
    • always add the route at the end of the Config.Routes table
    • when adding a new stop in the busStops array, avoid to get the position in the middle of a crossroad
  2. Once you’ve done it, restart the resource and use the command /bake routeId, where routeId is the position of the route in the Config.Routes table.
  3. As soon as the bake is done (check client console for errors), you will see on the map some blips indicating the route just calculated (for few seconds) and a file will be saved in /bake_data/baked_routes/.
  4. Do a /refresh since there are a new files, and /restart publictransprot.
  5. You are done. Everything should start working fine.

Tip: once you have done baking the new routes, remove from the fxmanifest.lua file 'client/bake.lua' line, so no one will be able to run the /bake

DOWNLOAD HERE

OTHER RESOURCES

[FREE][ESX] Scratch card
[ESX] Hitman (PvP)
[ESX] Pet Store

18 Likes

Wonderful!

2 Likes

Awesome ! Thank you mate :slight_smile:

its look sick, but i cant get in ? there is a reason ? could be my look door doing that>

For sure another resource locking them. If you are using a framework check the config file, or if you have a resource for locking vehicles doors, you should be able to add to the config the vehicle hash

Very nice resource :heart:

2 Likes

What a cool script, any way to enter locked buses?

this looks really cool, so, when are you updating it with metro trains? XD

Awesome script. Thanks for sharing.

1 Like

Nice idea, maybe in the future I will add that

1 Like

Check your others resources that lock cars

qb-doorlocks

Config.NoLockVehicles = {
‘bus’,
}

2 Likes

does not seem to work properly. we get a lot of bugs like the bus wants to turn around for no reason in the middle of the road.

Error: couldn’t create ped in vehicle, source: 2

Sadly so many problem with it, randomly spawns buses to same position etc…

some problems we got fixed. but we cant make it slower
the bus has everytime the same speed. we want to make it slower at 50 kmh

we dont get this :confused:

Were you using 2 clients on the same machine with -cl2?

Change the 70.0 of TaskVehicleDriveToCoordLongrange to 13.8. Should slow to 50 km/h

1 Like
		TaskVehicleDriveToCoordLongrange(ped, vehicle, coords, 13.0, Config.DriveStyle, 50.0)

and

Config.BakeStepUnits = 70.0

Config.AverageSpeed = 20.0 ?

nothign happen. sometime he ios slow and then he raiseup his speed

and sometimes he ignore stops with stop = false why ? its not to easy that the bus stops correct on the busstop

Try using SetEntityMaxSpeed when creating the vehicle in SetupPedAndVehicle function, like this the bus won’t exceed the speed you want! :grin:

1 Like

what u mean ?