- Removal of unnecessary scripts: A good server admin/scripter, always performs scheduled maintenance to review the existing infrastructure, look for optimization and remove unused code.
One of the most neglected things that lead to poor performance is the execution of old scripts: they may negatively impact the Resource monitor parameters such as CPU msec and memory usage. (It can be enabled by typing resmon true)
- Remove Draw3DText calls and use the NUI interface: drawing text using Draw3DText causes additional resource consumption. You can achieve the same result by rendering the text client-side using the NUI interface. Learn more here: https://docs.fivem.net/docs/scripting-manual/nui-development/
- Reducing the lines of code on the Client Side: not all users have a powerful computer at their disposal, so the script may not behave the same on their computer. Reducing the line of codes by avoiding blocking functions and unnecessary looping constructs such as for and while will help increase performance.
Bonus tip: Use the profiler: it’s an embedded tool that will allow you to record and detect CPU spikes when your scripts are running. This way you’ll be able to identify what script is causing the FPS drop/loss. Learn more here: https://docs.fivem.net/docs/scripting-manual/debugging/using-profiler/
Need Help Fixing Bugs?
Find a developer that can get the job done for you: