This resource based on esx_shops, I just changed the UI:
screenshot:
You can download this resource from
github
How to add your items in the shop
- Add items to the database:
INSERT INTO
items (
name,
label,
limit) VALUES ('banana', 'Banana', 10);
INSERT INTO
shops (store, item, price) VALUES ('TwentyFourSeven','banana',50);
- Add an image for your item in
html/img
folder
- Add path to the image into
__resource.lua
file like other images
- Restart the resource:
refresh
restart esx_supermarket
51 Likes
Do i need to delete esx_shops for this to work? How do i install it?
3 Likes
yeah do i need to remove anything?
Error resuming coroutine: @esx_magaza/server/main.lua:40: table index is nil
stack traceback:
@esx_magaza/server/main.lua:40: in function 'LoadShop'
@esx_magaza/server/main.lua:10: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function <citizen:/scripting/lua/scheduler.lua:218>
Script not starting.
Very nice ! I love the idea !
I suggest you only use 1 button to buy, instead of 1 by item. and then get the number + price of the whole shopping list. You can also change the line-height of the item quantity to make it vertically centered.
1 Like
Your error explain itself… You have nothing in the SHOPS table in your DB.
You just need to stop esx_shops and start esx_supermarket,
Both resources use the same table in database.
1 Like
Its just the beginning i will improve it! thanks for your feedback!
1 Like
You should import the mysql file into your database!
If you want to change resource name, you should change these lines in script.js too:
$.post('http://esx_supermarket/quit', JSON.stringify({}));
$.post('http://esx_supermarket/purchase', JSON.stringify({
or it wont work!
1 Like
If you have esx_shops, just stop esx_shops and start esx_supermarket, no further action required!
1 Like
I have scripts that use esx_shops, will that affect anything?
1 Like
Do you know How those resources use esx_shops?
If those resources trigger esx_shops events like esx_shops:buyItem
those scripts wont work!
Can you tell me those scripts name so i can check them?
1 Like
I do not wish to share my server’s list of resources and the loadorder, but i do use many resources that use that event which will cause them not to work. Could you make it compatible?
1 Like
How could he make it compatible when you aint going share the list of resources it requires? Lol
1 Like
lol no, I know java script codes
I changed js and purchase and quit functions is working for me.
and I have database :
Error resuming coroutine: @esx_magaza/server/main.lua:40: table index is nil
stack traceback:
@esx_magaza/server/main.lua:40: in function 'LoadShop'
@esx_magaza/server/main.lua:10: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function <citizen:/scripting/lua/scheduler.lua:218>
but this script have bug.
1 Like
Easy way to change script name :
$(".close").click(function(){
$.post(‘http://esx_magaza/quit’, JSON.stringify({}));
});
$(".home").on(“click”, “.buy”, function() {
var $button = $(this);
var $name = $button.attr(‘name’)
var $count = parseFloat($button.parent().parent().find(".number").text());
$.post(‘http://esx_magaza/purchase’, JSON.stringify({
item: $name,
count: $count,
loc: zone
}));
});
2 Likes
well, i don’t see the banana in the 24/7 ?!
1 Like