Make 'localGame' more accessible

I find this feature so useful for making singleplayer gamemodes or testing resources without hosting a server, but mainly for solo singleplayer custom gamemodes. And just having to type ‘localGame resource_name’ is just annoying, plus localRestart doesn’t reset everything, so i have to add checks to reset some stuff back and remove persistent vehicles/peds/objects which i would’ve expect localRestart would restart the current gamemode and remove everything in the world.

Altrough this might be leftover and i am supposed to use Routing Buckets instead, i still like localGame more, especially you can pause the game and have the singleplayer stuff still exist like it does in a regular Story Mode session which hosting a server wouldn’t provide.

I wish a menu option existed for starting a resource using localGame command, perhaps you can even select multiple resources to include similar to MTA host game feature except that instead of hosting a local multiplayer session, it just launches singleplayer game but with the resources you choose.

Also perhaps one of the built-in resources could be a ‘story-mode’ resource, which just loads you into a recent save game or starts from Prologue, allowing for quick tests altrough i don’t think there is a native to call YSC scripts trough Lua, and we already have Load into Story Mode already and i’d much more prefer to manually remove loading screen and manage where the player spawns myself anyway.

I do am concerned if this can be exploited aswell, what if a client was already in a server prior calling ‘localGame resource_name’? Would that allow for remote-code execution or would that kick them out and start a new singleplayer game with the resource they inputted?

Regardless it would be cool if FiveM expanded upon the ‘localGame’ command

EDIT:
I wonder why FiveM doesn’t add a “host LAN game” feature similar to MTA, where you can select some resources and click start and it will launch a solo session (not singleplayer) but it will allow you to play a multiplayer game on LAN without hosting a dedicated server.

I think the only reason this might not be possible is that the P2P functions R* uses work very differently, and the fact that host-migration is forced and you don’t want non-host player to become the new host when the LAN host disconnects, ofc this can be circumvented by just forcing OneSync to be on on LAN games and implementing a internal disconnect every player if the host player leaves

1 Like

Hey, I have started something similar to this proposal, but I couldn’t finish it because of a lack of time. Perhaps I’ll pick it up again, finish it and submit a PR soon.
My idea was to add the following:

  • a command storymode <resource> that allows you to start resources together with Story Mode.
  • a command localStart <resource> that allows you to start additional resources after loading into Local Game/Story Mode
  • I also fixed two bugs, one relating to localRestart crashing with certain map resources and one related to localGame not properly loading data_file entries from your fxmanifest.lua

I did try making localGame take an arbitrary amount of arguments but got stuck in the template mess that the console commands use. Maybe I can try again or leave this for later.
A menu option for these would also be good but it might require the above (localGame with many arguments) to be completed first.

Another idea I had was to make localGame and localStart load recursively through sub-folders, similar to how normal resources work but I think I didn’t even start working on that.

2 Likes

Also should localGame start the default story mode scripts or start a blank map with nothing? Perhaps have it “host” a multiplayer game similar to the Creator mode’s playtest mode which also hosts a session that no one can join but it just acts as a multiplayer game.

EDIT: The way it works now is fine, i mean it isn’t difficult to piece together a spawn script for just 1 player lmao