Prerequisites:
RCON Password: To utilize hot reloading, you'll need to configure an RCON password for your server. Edit your server's server.cfg file and add the following line, replacing [YOUR_PASSWORD] with a secure password of your choice:
rcon_password [YOUR_PASSWORD]
THE YOU WILL SEE CONNECT IN THE STATUS BAR OF YOUR VSCODE CLICK IT THEN YOU WILL PROMPTED TO ENTER YOUR RCON PASSWORD YOU HAVE JUST SET IN THE SERVER.CFG
Usage:
Open your resource folder within VS Code.
Right-click on the specific resource file you want to hot reload.
Select "Set Current Resource (Bridge)" from the context menu.
Start your server (FiveM or RedM).
Open a file within the resource you designated as the current bridge.
Subsequent changes you make and save to this file will be automatically reflected in the server console. This allows you to observe the effects of your modifications instantaneously, without the need for manual server restarts. This streamlined approach significantly enhances your development experience.
Switching Between Server Types:
If you're actively working on both FiveM and RedM servers and desire hot reloading functionality for both, follow these steps:
Press Ctrl+Shift+P to access the Command Palette.
Type "REDM" in the Command Palette.
Select "REDM or FiveM Server Connect" from the list.
Enter the distinct RCON password you configured for your RedM server.
Once connected, establish the current bridge resource and enjoy the benefits of hot reloading for your RedM server.
Important Considerations:
Unique RCON Passwords: It's imperative that the RCON passwords for FiveM and RedM servers are different to prevent any potential conflicts.
Auto-Save Recommendation: While convenient, it's advisable to disable auto-save in VS Code for resource files. Auto-save might introduce unintended server crashes, particularly when working with code constructs like "while true do" loops. Manual saving provides greater control and mitigates the risk of crashes.