Kar

Single Player AI (Like GTA Online AI)

Recommended Posts

Posted (edited)
/* Place in client side scripts */

mp.game.ped.removeScenarioBlockingArea();
mp.game.streaming.setPedPopulationBudget(3);
mp.game.ped.setCreateRandomCops(true);
mp.game.vehicle.setRandomBoats(true);
mp.game.vehicle.setRandomTrains(true);
mp.game.vehicle.setGarbageTrucks(true);
mp.game.streaming.setVehiclePopulationBudget(3);
mp.game.invoke('0x34AD89078831A4BC'); // SET_ALL_VEHICLE_GENERATORS_ACTIVE
mp.game.vehicle.setAllLowPriorityVehicleGeneratorsActive(true);
mp.game.vehicle.setNumberOfParkedVehicles(-1);
mp.game.vehicle.displayDistantVehicles(true);
mp.game.graphics.disableVehicleDistantlights(false);

IT'S NOT SYNCED

unknown.png

 

unknown.png

 

Enjoy lmfao, also it's not synced!

Edited by Kar
  • Like 1

Share this post


Link to post
Share on other sites

How come I can't steal a car? Is there a setting I need to configure to do this?

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, toruk said:

How come I can't steal a car? Is there a setting I need to configure to do this?

Never mind found the solution. Hope this helps if anyone else runs into this issue.

mp.events.add('render', () => {
    const controls = mp.game.controls

    controls.enableControlAction(0, 23, true)
    controls.disableControlAction(0, 58, true)

    if (controls.isDisabledControlJustPressed(0, 58)) {
        let position = mp.players.local.position
        let vehHandle = mp.game.vehicle.getClosestVehicle(position.x, position.y, position.z, 5, 0, 70)

        let vehicle = mp.vehicles.atHandle(vehHandle)

        if (vehicle
			&& vehicle.isAnySeatEmpty()
			&& vehicle.getSpeed() < 5) {
            mp.players.local.taskEnterVehicle(vehicle.handle, 5000, 0, 2, 1, 0)
        }
    }
})

 

Edited by toruk
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

OMG very nice, thank you!!!

But my game is getting random crashs. Any tip what could be, please?

ty!!

Edited by joew

Share this post


Link to post
Share on other sites
2 hours ago, toruk said:

I was suffering from random crashes. No idea what was causing them.

me too =(

And did u find any train? I drive all subway and didn't find none =( I really want them spawn too ^^

and IT'S NOT SYNCED  so it isn't useful if players don't see the same things =P

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.