Merging scripts

Hey guys. I am looking for a way to have multiple scripts run in one folder. So in my config file I would load one .lua file in a folder containing multiple scripts.

In a way to expand my server and have more scripts running. I know there is a way to do it for .meta files for cars. Curious if there is a way to implement multiple scripts into one start folder command?

Thanks

1 Like

Yes, in your __resource.lua file you can load as much as you want script files:

I thought fivem had a script limit…

What if I want to do it for cleanliness and instead of having for example 10 jobs that all start individually. I could put all 10 in one folder and only start that one folder ?

You can, but take care about your variables. A global variable will be available in all scripts of the same resource, so, you can have conflicts.

How would I go about trying it ?

I tried making a folder. I made a simple __resource.lua file in the folder stating to go in another folder to grab the resource file. I.e.

folder

Jobs

inside Jobs folder

Mining job

Mail delivery job

__resource.lua

__resource.lua file inside Jobs folder

Mining job/__resource.lua

Mail delivery job/__resource.lua

There is a line of coding at the top I just dont have it in front of me to write it down…

And of course in config file

Start Jobs

Resource.lua should have…

client_script ‘whatevertheclientnameis.lua’,

OR

client_scripts {

'client1.lua,
‘client2.lua’,

}


server_script ‘whatevertheservernameis.lua’,

OR

server_scripts {

‘server1.lua’,
‘server2.lua’,

}


I don’t know how to merge HTML, or those kind of files yet so you might have to do testing

I will have a look when I get home and post screenshots. Thanks for the help !

1 Like

This is what I have in my __resource.lua file. When I started my server it said couldn’t load main folder with scripts in it

resource_manifest_version ‘44febabe-d386-4d18-afbe-5e627f4af937’

description ‘Chat’

version ‘1.3.0’

server_scripts {
‘hrc-resource/__resource.lua’
‘maildelivery/__resource.lua’
}

No, it’s not that way.

In your __resource.lua, you need to specify scripts not other __resource.lua.

By example, you have your resource named ‘main’ and inside you have 2 folders: ‘chat’ and ‘weather’, in each folder you have ‘client.lua’ and ‘server.lua’. So your __resource.lua should be:

server_scripts {
'chat/server.lua',
'weather/server.lua'
}

client_scripts {
'chat/client.lua',
'weather/client.lua'
}

A little delayed but Thank you for the help guys. After a little bit of testing with the latest script provided. I created a “main” folder with scripts, so far I have 11 in there and they all work perfectly.

I need a bit of assistance on other stuff as well if any of you are familiar.

esx_properties - Can purchase a house and have it show as I own it both on the map and in my database, although other players can go to my house and purchase it for themselves too. Not sure if there is a fix to that or it is how it is scripted. Also if it is possible to add more houses, I have played a bit with the apartment script and kinda tried to simply replicate all the coordinates from an existing house, replace the coordinates that show in front of the door and set up a new house. Unsure if that would be the right way.

esx_identity - New players have to create their identity which is how it works. Although the RP name does not show in chat, the steam ID shows in chat. It could be with the rpchat script. I’ve looked into it and have replaced the script to a post on it working and it still won’t work.

esx_shops - Nothing… Interaction shows up, menu shows up but just says shop. I read that you need to have the same items in your shop list as your item list “which I do”, although there is more in the item list, they are not identical to each other as in the item list also contains items related to jobs i.e. miners job, and I don’t want to clear the item list in the database and risk screwing up any jobs script.

v Menu - I set up the permissions and put myself as Owner/admin. Although some settings in the menu are not showing up, some are. example…**


####################################
# VEHICLE OPTIONS MENU #
####################################
add_ace builtin.everyone “vMenu.VehicleOptions.Menu” allow
#add_ace builtin.everyone “vMenu.VehicleOptions.All” allow
add_ace builtin.owner “vMenu.VehicleOptions.God” allow
add_ace builtin.owner “vMenu.VehicleOptions.SpecialGod” allow
add_ace builtin.groups “vMenu.VehicleOptions.Repair” allow
add_ace builtin.groups “vMenu.VehicleOptions.Wash” allow
add_ace builtin.everyone “vMenu.VehicleOptions.Engine” allow
add_ace builtin.groups “vMenu.VehicleOptions.ChangePlate” allow
add_ace builtin.groups “vMenu.VehicleOptions.Mod” allow
add_ace builtin.groups “vMenu.VehicleOptions.Colors” allow
add_ace builtin.groups “vMenu.VehicleOptions.Liveries” allow
add_ace builtin.owner “vMenu.VehicleOptions.Components” allow
add_ace builtin.everyone “vMenu.VehicleOptions.Doors” allow
add_ace builtin.everyone “vMenu.VehicleOptions.Windows” allow
add_ace builtin.owner “vMenu.VehicleOptions.Freeze” allow
add_ace builtin.owner “vMenu.VehicleOptions.TorqueMultiplier” allow
add_ace builtin.owner “vMenu.VehicleOptions.PowerMultiplier” allow
add_ace builtin.groups “vMenu.VehicleOptions.Flip” allow
add_ace builtin.everyone “vMenu.VehicleOptions.Alarm” allow
#add_ace builtin.everyone “vMenu.VehicleOptions.CycleSeats” allow
add_ace builtin.everyone “vMenu.VehicleOptions.EngineAlwaysOn” allow
add_ace builtin.owner “vMenu.VehicleOptions.NoSiren” allow
#add_ace builtin.everyone “vMenu.VehicleOptions.NoHelmet” allow
add_ace builtin.everyone “vMenu.VehicleOptions.Lights” allow
add_ace builtin.owner “vMenu.VehicleOptions.Delete” allow
#add_ace builtin.everyone “vMenu.VehicleOptions.Underglow” allow
#add_ace builtin.everyone “vMenu.VehicleOptions.FlashHighbeamsOnHonk” false
------------------------------------------------------------------------------
whatever it set to owner will not show up in game. only all that is set to everyone. but…
####################################

WEATHER OPTIONS MENU

####################################

Also restricted to moderators/admins by default.

add_ace group.owner “vMenu.WeatherOptions.Menu” allow
add_ace group.owner “vMenu.WeatherOptions.All” allow
#add_ace group.owner “vMenu.WeatherOptions.Dynamic” allow
#add_ace group.owner “vMenu.WeatherOptions.Blackout” allow
#add_ace group.owner “vMenu.WeatherOptions.SetWeather” allow
#add_ace group.owner “vMenu.WeatherOptions.RemoveClouds” allow
#add_ace group.owner “vMenu.WeatherOptions.RandomizeClouds” allow


this all works perfectly

I can be added on discord @ ComboHivemind #6002 , Steam @ Combo Hivemind.

Thanks in advance from any help from the community !

Okay I know it’s been awhile since someone posted on this topic but I’m trying to merge car resources into one and I tried to follow this guide but my server won’t start. My resource.lua looks like this:

resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
 
files {
    '20camaro/vehicles.meta',
    '20camaro/carvariations.meta',
    '20camaro/carcols.meta',
    '2016-chp-megapack/data/carcols.meta',
    '2016-chp-megapack/data/carvariations.meta',
    '2016-chp-megapack/data/vehicles.meta',
    'ab/data/carcols.meta',
    'ab/data/carvariations.meta',
    'ab/data/vehicles.meta',
    '2016-chp-megapack/data/vehicle_names.lua',
}

data_file 'HANDLING_FILE' 'handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'vehicles.meta'
data_file 'CARCOLS_FILE' 'carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'carvariations.meta'
data_file 'VEHICLE_LAYOUTS_FILE' 'vehiclelayouts.meta'
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

:wink:

@fauconjona
Can you share more information regarding this to marge ESX into vRP. Because we are getting the same problem regarding this.
now we success add esx into our custom server but after that we are not able to use our commands, i mean our command is not found in game.
i think it links to esx.

anyone here merger MLO resource still with each folder? may i look your fxmanifest/__resource.lua ?

resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’

files {
‘data/HondaCRF1000L/vehicles.meta’,
‘data/HondaCRF1000L/carvariations.meta’,
‘data/HondaCRF1000L/carcols.meta’,
‘data/HondaCRF1000L/handling.meta’,
‘data/HondaCRF1000L/vehiclelayouts.meta’,
}

data_file ‘HANDLING_FILE’ ‘data/HondaCRF1000L/handling.meta’
data_file ‘VEHICLE_METADATA_FILE’ ‘data/HondaCRF1000L/vehicles.meta’
data_file ‘CARCOLS_FILE’ ‘data/HondaCRF1000L/carcols.meta’
data_file ‘VEHICLE_VARIATION_FILE’ ‘data/HondaCRF1000L/carvariations.meta’
data_file ‘VEHICLE_LAYOUTS_FILE’ ‘data/HondaCRF1000L/vehiclelayouts.meta’

files {
‘data/rnine/vehicles.meta’,
‘data/rnine/carvariations.meta’,
‘data/rnine/carcols.meta’,
‘data/rnine/handling.meta’,
‘data/rnine/vehiclelayouts.meta’,
}

data_file ‘HANDLING_FILE’ ‘data/rnine/handling.meta’
data_file ‘VEHICLE_METADATA_FILE’ ‘data/rnine/vehicles.meta’
data_file ‘CARCOLS_FILE’ ‘data/rnine/carcols.meta’
data_file ‘VEHICLE_VARIATION_FILE’ ‘data/rnine/carvariations.meta’
data_file ‘VEHICLE_LAYOUTS_FILE’ ‘data/rnine/vehiclelayouts.meta’

can please someone show me how to merge my mafias scripts into 1 script please? its important!
thnx in advance!

what am i doing false ?

resource_manifest_version ‘44febabe-d386-4d18-afbe-5e627f4af937’

description ‘Xatz Mafia Jobs Merged’

author ‘Xaatzzz’

version ‘1.3.0’

server_scripts {

'@async/async.lua',

'@mysql-async/lib/MySQL.lua',

'ballas/locales/br.lua',

'ballas/locales/de.lua',

'ballas/locales/en.lua',

'ballas/locales/pl.lua',

'ballas/locales/fr.lua',

'ballas/locales/fi.lua',

'ballas/locales/es.lua',

'ballas/locales/sv.lua',

'ballas/config.lua',

'ballas/server/main.lua',

'pinkpanthers/locales/br.lua',

'pinkpanthers/locales/de.lua',

'pinkpanthers/locales/en.lua',

'pinkpanthers/locales/pl.lua',

'pinkpanthers/locales/fr.lua',

'pinkpanthers/locales/fi.lua',

'pinkpanthers/locales/es.lua',

'pinkpanthers/locales/sv.lua',

'pinkpanthers/config.lua',

'pinkpanthers/server/main.lua',

'families/locales/br.lua',

'families/locales/de.lua',

'families/locales/en.lua',

'families/locales/pl.lua',

'families/locales/fr.lua',

'families/locales/fi.lua',

'families/locales/es.lua',

'families/locales/sv.lua',

'families/config.lua',

'families/server/main.lua',

}

client_scripts {

'@es_extended/locale.lua',

'ballas/locales/br.lua',

'ballas/locales/de.lua',

'ballas/locales/en.lua',

'ballas/locales/pl.lua',

'ballas/locales/fr.lua',

'ballas/locales/fi.lua',

'ballas/locales/es.lua',

'ballas/locales/sv.lua',

'ballas/config.lua',

'ballas/client/main.lua',

'pinkpanthers/locales/br.lua',

'pinkpanthers/locales/de.lua',

'pinkpanthers/locales/en.lua',

'pinkpanthers/locales/pl.lua',

'pinkpanthers/locales/fr.lua',

'pinkpanthers/locales/fi.lua',

'pinkpanthers/locales/es.lua',

'pinkpanthers/locales/sv.lua',

'pinkpanthers/config.lua',

'pinkpanthers/client/main.lua',

'families/locales/br.lua',

'families/locales/de.lua',

'families/locales/en.lua',

'families/locales/pl.lua',

'families/locales/fr.lua',

'families/locales/fi.lua',

'families/locales/es.lua',

'families/locales/sv.lua',

'families/config.lua',

'families/client/main.lua',

}

dependencies {

'es_extended',

'mysql-async',

'esx_billing',

'async',

}

could you help me i want to merge 10 mafia jobs

how to merge config.lua too?

Just put all configs from your scripts into one config.lua