Hallo guys, i have seen a lot of tutorials how to setup Online servers and script with c# for them. But i want to create singleplayer mods with c# and fivem. How can i set it up ?. Also i tried downloading scripthookdotnet i thew it inside plugings folder but the script did not work at all…
There’s the localGame
system for creating single resources for singleplayer - I think @TheIndra is most experienced with regards to this.
so should i message him ? Or should i wait for his response here ?
The @-tag should have summoned him and hopefully he’ll be responding here shortly.
If you are experienced with creating a C# resource already you can use the same knowledge to create a resource for localGame, to load these you need to put them into usermaps\resources
in your FiveM Application Data and it will load any client_script(s)
entries (NUI works too)
After opening FiveM you can press F8 to open the Console, and type localGame yourresourcename
to load it, if you want to restart your resource type localRestart
.
However when using localGame you need to manually shutdown the loadingscreen and fadein the screen + spawning the player somewhere not at 0,0,0
Here’s a minimal snippet for that:
[Tick]
public async Task RunTick()
{
if (!m_firstTick)
{
if (!IsScreenFadedIn() || GetIsLoadingScreenActive())
{
LocalPlayer.Character.Position = new Vector3(-2243.810f, 264.048f, 173.615f);
ShutdownLoadingScreen();
ShutdownLoadingScreenNui();
DoScreenFadeIn(0);
}
m_firstTick = true;
and it should be emphasized you’ll have to do this in the main FiveM, not the blue SP mode
I am a bit confused with this tick Task… i copied it i changed LocalPlayer to Game.player. i also changed shutDownLoadingScreen(); to API.ShutdownLoadingScreen(); etc in order to not have any errors … but i also put were my bodyguard funciont starts “await RunTick();” but it was giving me error in vs2019
Don’t await on the RunTick()
it would be better to have the bodyguard()
method run after API.DoScreenFadeIn(0);
Sorry for the ultra dump of this post, can we launch multiples resources with localGame
something like localGame res1 res2
? Thanks
EDIT: Or maybe dynamic loading through one resource?
EDIT 2: Can’t we use story mode with this ?
EDIT 3: What about exiting localGame
to main menu ? Can we ?
EDIT 4: Can we launch the localGame
with resource and shortcut?
@TheIndra sorry for the tag, but, up someone said it can summon you up and it look like you are the god of localGame mode
I do not have the directory for usermaps/resources anywhere within the FiveM Application Data file folder. The command ‘localGame’ in the console is also showing an ‘access denied’ error. I have managed to successfully set up and run a server, but want to use this alternative instead.
Any help with this would be much appreciated. I can only find this thread and one from reddit regarding the local game.