[HELP] How to refresh resources by using a function?

Hi all.

Cant seem to be able to refresh resources from my own resource.
I know its possible by using rcon and the command refresh, but can I trigger that from a resource?

Thanks :wink:

You can use restart on RCON or in your serverā€™s window if you are on Windows

Thanks but that was not what I was asking for.
I am trying to make a way so that I ingame can do /refresh command and then it refreshs all the resources, and I cant find the function to refresh the resources.

Were a few players using the same server for scripting, and its easier for us if we dont need to use rcon for refreshing.

Ohhh sorry, I misunderstood.
I donā€™t think you can do that.

And why do you want to refresh a resource ?

If I add a new folder in the resources folder I need todo the refresh in rcon but it would be easier if I could do that from an ingame command.

No you canā€™t, because server have to index the resource, so you have to restart the whole server when you add a new resource (at least I think, I never try to add a resource in runtime)

1 Like

That is wrong. It is possible to issue the refresh command in RCON and that will find new resources you added.

But I want to be able todo that from ingame.

2 Likes

Ohh ok, thanks for the tip then :smiley:
But I donā€™t think it is possible in game.

Maybe this but Iā€™m not sure : [Release] SS-RunCode - Run Code Locally or Server-Side Via Chat!

1 Like

Nah, this is something different

I am not sure, but I think I read somewhere, that it is not possible to restart resources ingame, just through RCON

1 Like

Well I can restart, start and stop resources from ingame. But I cant find a way to refresh the resources folder.

1 Like

lol, really? how is this possible?

1 Like

Its easy.

Use https://wiki.fivem.net/wiki/StartResource
and https://wiki.fivem.net/wiki/StopResource

then I made authentication based on SteamID

1 Like

I guess its not possible then?

A bit of an old replyā€¦ But this is most certainly possible using ExecuteCommand(ā€œrefreshā€). Thought Iā€™d bump this if any other people are running into this issue.

5 Likes

Simple:

  • Add your new script in the resources folder
  • Start the script in the server.cfg, save.
  • Type refresh in the console or via rcon, you should see written ā€œFound new resource scriptā€
  • In the console start script

Done. Dunno if itā€™s possilbe using a chat command.

Dude did u even read the question? He wanted to use refresh in a FUNCTION. Dealman had the right answer.