RedEM-RP / redemrp_shops

A shops system for RedEM:RP
GNU General Public License v3.0
3 stars 6 forks source link

Item dupe #3

Open draobrehtom opened 1 year ago

draobrehtom commented 1 year ago

Hello,

I've encountered a potential 'item duplication' issue while attempting to make a purchase at the shop. To put it simply, I tried to buy an item but was unsuccessful due to reaching the inventory item limit (not the weight limit). However, even though I didn't receive the item in my inventory, it appeared on the ground, and the shop didn't deduct my money for the item. Consequently, I ended up obtaining the item for free.

Could you please review the code example I used:

RegisterCommand('buyitem', function()
    TriggerServerEvent('redemrp_shops:BuyItem', 'beartrap', 1 , 'Basic')
end)

Here's the item definition:

    ["beartrap"] = {
        label = "Beartrap",
        description = "nice item",
        weight = 0.01,
        canBeDropped = true,
        canBeUsed = true,
        limit = 1,
        imgsrc = "items/beartrap.png",
        type = "item_standard"
    },

Here's the shop definition:

Config.Zones = {
    Basic = {
        Items = {
            {item = 'beartrap', price = 1},
        },
        Legal = true,
        Pos = {
            {x = -324.28,   y = 801.51, z = 117.88},                
        },
        Spawn = {
            {x = -323.18,   y = 802.81, z = 117.94},                
        },
    },
}

Some additional information that might be useful:

Thank you for looking into this issue. Your efforts are greatly appreciated!

Zer0Cool0 commented 1 year ago

This is a fundamental problem with the inventory. Weight works but not properly, best course of action I can suggest is to check if they have x free and if they do allow them to go into the store menu.