[ESX] Creating Items while server is started

Hey, Im wondering if its possible to create an item (add it to the database) while the server is started, and somehow make that item to be recognized by ESX and usable, WITHOUT RESTARTING THE SERVER.

I want to create an item for car keys when a player buys a car in the vehicle shop

Thanks for your time!

1 Like

The simple answer is yes and no.

As long as you restart the resources that reads the database, the ones that will “see” this item (read it from the database) then as far as the database is concerned, you should be fine. The good thing about a MySQL database is it’s live all the time. So once you add the item, the rows in the table should be readable by any program.

But it isn’t that simple with ESX. I am sure you are aware that just putting an item into the database does not mean it’s usable by ESX. In many cases, there are other things you need to do. Such as a Lua table of shop items, the various steps to make an item “usable” in ESX, that sort of thing. Now, once you do that, and restart those resources affected by the edited files, then it should work.

I have discovered that there are more resources in ESX that read static Lua tables than there are resources that read the MySQL database. Or these items are listed in both places. I am sure this is due to so many different resource developers all doing it the way they do it because they feel it’s “better.”

Hooray for Open Source!

Well, I think that the resource who reads the items its es_extended right? And i think if you restart that everything else has to be started again, so it will break…