How to combine scripts

Hay Just wanted to make a quick tutorial on how to combine scripts

cl= client
sv=serverr

You grab the files and separate the server and client files and rename them, cl_name.lua/sv_name.lua
make a folder called server and one called client put the client ones in the client and the server in the server then you want to make a fxmanifest.lua and put the code below in it

fx_version 'adamant'
game 'gta5'

client_scripts {
'client/*.lua'
}

server_scripts {
'server/*.lua'
}



Here is my folder of scripts if you want to use them
OCRP.rar (24.3 KB)

join the discord if you need anyhelp https://discord.gg/t2zhAdxbMa
or dm me LordShivering#0001

5 Likes

thanks for this great tutorial . i just wonder how to combine script that have config.lua ?

make a config.lua and put all the config text in there and it should work sorry for the late response

can i have a preview ? i try and i think it’s not working for my side haha

Make sure you added config.lua to the fxmanifest

like this ?

config_scripts {
‘config/*.lua’
}

and how about script that have locales inside ?
and somescript that have ‘@es_extended/locale.lua’ and ‘@mysql-async/lib/MySQL.lua’ . how to implant ? sorry sir cause i newbie :frowning:

Screenshot_4

Help me

You just combine everything into a manifest making sure you don’t have duplicates and keep server separated from client and you should good to go.

2 Likes

i already try but always error global config

You should provide more details

This is fxmanifest

fx_version 'adamant'
game 'gta5'

client_scripts {
'client/*.lua',
'config.lua'
}

server_scripts {
'server/*.lua'
}

1 Like

fxmanifest.lua

> ```
> -- [remember other things like manifest version etc!] --
> shared_script 'config.lua' -- our config
> server_script 'server.lua'
> client_script 'client.lua'
> ```

If you have issues with setting up your resource, check out the FiveM documentation for help!

1 Like

tq will try :slight_smile:

Im getting this error when I join the game, But its starting in the console

I have attempted this before and got them all running as one resource however the resource started running very high in ms like at least 1.X ms in console

1 Like

This isn’t a proper way to merge configs.

Likely the resources themselves seperate have optimisation issues that need resolved before thinking of combining. :desktop_computer: :desktop_computer:

1 Like

I do not suggest doing this, as it will get so messy you will find it incredibly hard to work anymore in any of the combined scripts :confused:

It is easier to have resources separated into different folders and just include shared resources using @resource/clien.lua or @resource/server.lua in the fxmanifest.lua file, without having “dependencies” between them.

how to merge scripts with config and html/other files ?