[PAID] Ox_inventory Custom Item Drops

You’re free to do whatever you want, friend!

it would be okay to interact with discarded items on the floor

Nice idea! I will implement it in the next update!

It’s exactly how it’s done, it works now with all my custom items/props

Nice! :heart:

[ script:aConfig] SCRIPT ERROR: @aConfig/server/inventaire.lua:9: bad argument #1 to ‘for iterator’ (table expected, got nil)
[ script:aConfig] > ref (@aConfig/server/inventaire.lua:9)
[ script:aConfig] > TriggerEventHooks (@ox_inventory/modules/hooks/server.lua:61)
[ script:aConfig] > dropItem (@ox_inventory/modules/inventory/server.lua:1496)
[ script:aConfig] > [global chunk] (@ox_inventory/modules/inventory/server.lua:1630)
[ script:aConfig] > handler (@ox_lib/imports/callback/server.lua:76)

I created a server.lua and I get this error.

A solution ?

The solution is in front of you :saluting_face:

Yes at 6€, I don’t want to spend 1st on something free sorry

If you think about it like this, all scripts are free. You can make all the scripts worth $100 without spending a single dollar, but what you pay for is the work and obviously you can try to imitate ours by looking for a way to do it.

I pay the script is worth it.
Basically I’m not particularly looking to have this system.

If I can do it for free I will.

Of course!

just put the code in any server side file
this code is exactly the same as the one linden sent above

local dropItems = {
    burger = `prop_cs_burger_01`,
    water = `prop_ld_flow_bottle`
}

exports.ox_inventory:registerHook("swapItems", function(payload)
    if payload.toInventory ~= "newdrop" then return end
    local item = payload.fromSlot
    local items = {{item.name, payload.count}}
    local dropId = exports.ox_inventory:CustomDrop(item.label, items, GetEntityCoords(GetPlayerPed(payload.source)), 50, 30000, nil, dropItems[item.name])
    if not dropId then return end
    CreateThread(function()
        exports.ox_inventory:RemoveItem(payload.source, item.name, item.count, nil, item.slot)
        Wait(0)
        exports.ox_inventory:forceOpenInventory(payload.source, "drop", dropId)
    end)
    return false
end, {
    itemFilter = dropItems,
    typeFilter = {player = true}
})
1 Like

I don’t see that two props are created when you drop two items in a single drop.

i didn’t see it in the video you made either

It’s working really good but you should change “item.count” to “payload.count” in the RemoveItem.

Because the video is a preview of the first version of the script, I will update the video soon.

local dropItems = {
burger=prop_cs_burger_01,
weapon_unarmed=v_res_d_dildo_a,
weapon_dagger=v_ret_gc_knifehold2,
weapon_bat=w_me_bat,
weapon_bottle=prop_water_bottle,
weapon_crowbar=w_me_crowbar,
weapon_flashlight=w_me_flashlight,
weapon_golfclub=prop_cs_walking_stick,
weapon_hammer=w_me_hammer,
weapon_hatchet=w_me_hatchet,
weapon_knuckle=w_me_knuckle_bg,
weapon_knife=prop_cs_bowie_knife,
weapon_machete=ch_prop_ch_bloodymachete_01a,
weapon_switchblade=w_me_switchblade,
weapon_nightstick=w_me_nightstick,
weapon_wrench=w_me_wrench,
weapon_battleaxe=w_me_battleaxe,
weapon_poolcue=w_me_poolcue,
weapon_briefcase=hei_p_attache_case_shut_s,
weapon_briefcase_02=w_am_brfcase,
weapon_garbagebag=prop_rub_binbag_01,
weapon_handcuffs=h4_prop_battle_cuffs,
weapon_bread=v_ret_247_bread1,
weapon_stone_hatchet=w_me_stonehatchet,
weapon_pistol=xm3_prop_xm3_pistol_xm3,
weapon_pistol_mk2=w_pi_pistol_luxe,
weapon_combatpistol=w_pi_sns_pistol_luxe,
weapon_appistol=xm3_prop_xm3_pistol_xm3,
weapon_stungun=xm3_prop_xm3_pistol_xm3,
weapon_pistol50=xm3_prop_xm3_pistol_xm3,
weapon_snspistol=xm3_prop_xm3_pistol_xm3,
weapon_heavypistol=w_pi_heavypistol_luxe,
weapon_vintagepistol=w_pi_vintage_pistol,
weapon_flaregun=w_pi_singleshot,
weapon_marksmanpistol=xm3_prop_xm3_pistol_xm3,
weapon_revolver=w_pi_heavypistol_luxe,
weapon_revolver_mk2=w_pi_heavypistol_luxe,
weapon_doubleaction=xm3_prop_xm3_pistol_xm3,
weapon_snspistol_mk2=xm3_prop_xm3_pistol_xm3,
weapon_raypistol=xm3_prop_xm3_pistol_xm3,
weapon_ceramicpistol=xm3_prop_xm3_pistol_xm3,
weapon_navyrevolver=xm3_prop_xm3_pistol_xm3,
weapon_gadgetpistol=w_pi_heavypistol_luxe,
weapon_microsmg=w_sb_smg,
weapon_smg=w_sb_smg,
weapon_smg_mk2=w_sb_smg,
weapon_assaultsmg=w_sb_smg,
weapon_combatpdw=w_sb_smg,
weapon_machinepistol=w_sb_smg,
weapon_minismg=w_sb_smg,
weapon_raycarbine=w_sb_smg,
weapon_pumpshotgun=w_sg_pumpshotgun_xm3,
weapon_sawnoffshotgun=w_sg_pumpshotgun_xm3,
weapon_assaultshotgun=w_sg_pumpshotgun_xm3,
weapon_bullpupshotgun=w_sg_pumpshotgun_xm3,
weapon_musket=w_sg_pumpshotgun_xm3,
weapon_heavyshotgun=w_sg_pumpshotgun_xm3,
weapon_dbshotgun=w_sg_pumpshotgun_xm3,
weapon_autoshotgun=w_sg_pumpshotgun_xm3,
weapon_pumpshotgun_mk2=w_sg_pumpshotgun_xm3,
weapon_combatshotgun=w_sg_pumpshotgun_xm3,
weapon_assaultrifle=w_ar_assaultrifle_luxe,
weapon_assaultrifle_mk2=w_ar_assaultrifle_luxe,
weapon_carbinerifle=w_ar_assaultrifle_luxe,
weapon_carbinerifle_mk2=w_ar_assaultrifle_luxe,
weapon_advancedrifle=w_ar_assaultrifle_luxe,
weapon_specialcarbine=w_ar_assaultrifle_luxe,
weapon_bullpuprifle=w_ar_assaultrifle_luxe,
weapon_compactrifle=w_ar_assaultrifle_luxe,
weapon_specialcarbine_mk2=w_ar_assaultrifle_luxe,
weapon_bullpuprifle_mk2=w_ar_assaultrifle_luxe,
weapon_militaryrifle=w_ar_assaultrifle_luxe,
weapon_mg=w_sb_assaultsmg_luxe,
weapon_combatmg=w_sb_assaultsmg_luxe,
weapon_gusenberg=w_sb_assaultsmg_luxe,
weapon_combatmg_mk2=w_sb_assaultsmg_luxe,
weapon_sniperrifle=w_sr_sniperrifle_luxe,
weapon_heavysniper=w_sr_heavysniper_m32,
weapon_marksmanrifle=w_sr_sniperrifle_luxe,
weapon_remotesniper=w_sr_sniperrifle_luxe,
weapon_heavysniper_mk2=w_sr_heavysniper_m32,
weapon_marksmanrifle_mk2=w_sr_sniperrifle_luxe,
weapon_rpg=w_lr_rpg_m31,
weapon_grenadelauncher=w_lr_rpg_m31,
weapon_grenadelauncher_smoke=w_lr_rpg_m31,
weapon_minigun=prop_minigun_01,
weapon_firework=w_lr_firework_rocket,
weapon_railgun=prop_minigun_01,
weapon_hominglauncher=prop_minigun_01,
weapon_compactlauncher=prop_minigun_01,
weapon_rayminigun=prop_minigun_01,
weapon_grenade=w_ex_grenadefrag,
weapon_bzgas=prop_gas_grenade,
weapon_molotov=vw_prop_casino_art_grenade_01c,
weapon_stickybomb=vw_prop_casino_art_grenade_01c,
weapon_proxmine=vw_prop_casino_art_grenade_01a,
weapon_snowball=vw_prop_casino_art_grenade_01a,
weapon_pipebomb=vw_prop_casino_art_grenade_01a,
weapon_ball=vw_prop_casino_art_grenade_01a,
weapon_smokegrenade=w_ex_grenadesmoke,
weapon_flare=vw_prop_casino_art_grenade_01a,
weapon_petrolcan=prop_cs_petrol_can,
weapon_fireextinguisher=prop_air_fireexting,
weapon_hazardcan=sm_prop_smug_crate_s_hazard,
pistol_defaultclip=prop_box_ammo07b,
pistol_extendedclip=prop_box_ammo07b,
pistol_flashlight=prop_box_ammo07b,
pistol_suppressor=prop_box_ammo07b,
pistol_luxuryfinish=prop_box_ammo07b,
combatpistol_defaultclip=prop_box_ammo07b,
combatpistol_extendedclip=prop_box_ammo07b,
combatpistol_luxuryfinish=prop_box_ammo07b,
appistol_defaultclip=prop_box_ammo07b,
appistol_extendedclip=prop_box_ammo07b,
appistol_luxuryfinish=prop_box_ammo07b,
pistol50_defaultclip=prop_box_ammo07b,
pistol50_extendedclip=prop_box_ammo07b,
pistol50_luxuryfinish=prop_box_ammo07b,
revolver_defaultclip=prop_box_ammo07b,
revolver_vipvariant=prop_box_ammo07b,
revolver_bodyguardvariant=prop_box_ammo07b,
snspistol_defaultclip=prop_box_ammo07b,
snspistol_extendedclip=prop_box_ammo07b,
snspistol_grip=prop_box_ammo07b,
heavypistol_defaultclip=prop_box_ammo07b,
heavypistol_extendedclip=prop_box_ammo07b,
heavypistol_grip=prop_box_ammo07b,
vintagepistol_defaultclip=prop_box_ammo07b,
vintagepistol_extendedclip=prop_box_ammo07b,
microsmg_defaultclip=v_ret_gc_ammo1,
microsmg_extendedclip=v_ret_gc_ammo1,
microsmg_scope=v_ret_gc_ammo1,
microsmg_luxuryfinish=v_ret_gc_ammo1,
smg_defaultclip=v_ret_gc_ammo1,
smg_extendedclip=v_ret_gc_ammo1,
smg_scope=v_ret_gc_ammo1,
smg_luxuryfinish=v_ret_gc_ammo1,
assaultsmg_defaultclip=v_ret_gc_ammo1,
assaultsmg_extendedclip=v_ret_gc_ammo1,
assaultsmg_luxuryfinish=v_ret_gc_ammo1,
minismg_defaultclip=v_ret_gc_ammo1,
minismg_extendedclip=v_ret_gc_ammo1,
machinepistol_defaultclip=v_ret_gc_ammo1,
machinepistol_extendedclip=v_ret_gc_ammo1,
machinepistol_drum=v_ret_gc_ammo1,
combatpdw_defaultclip=v_ret_gc_ammo1,
combatpdw_extendedclip=v_ret_gc_ammo1,
combatpdw_drum=v_ret_gc_ammo1,
combatpdw_grip=v_ret_gc_ammo1,
combatpdw_scope=v_ret_gc_ammo1,
shotgun_suppressor=prop_ld_ammo_pack_02,
pumpshotgun_luxuryfinish=prop_ld_ammo_pack_02,
sawnoffshotgun_luxuryfinish=prop_ld_ammo_pack_02,
assaultshotgun_defaultclip=prop_ld_ammo_pack_02,
assaultshotgun_extendedclip=prop_ld_ammo_pack_02,
heavyshotgun_defaultclip=prop_ld_ammo_pack_02,
heavyshotgun_extendedclip=prop_ld_ammo_pack_02,
heavyshotgun_drum=prop_ld_ammo_pack_02,
assaultrifle_defaultclip=prop_ld_ammo_pack_02,
assaultrifle_extendedclip=prop_ld_ammo_pack_02,
assaultrifle_drum=prop_ld_ammo_pack_02,
rifle_flashlight=prop_ld_ammo_pack_02,
rifle_grip=prop_ld_ammo_pack_02,
rifle_suppressor=prop_ld_ammo_pack_02,
assaultrifle_luxuryfinish=prop_ld_ammo_pack_02,
carbinerifle_defaultclip=prop_ld_ammo_pack_02,
carbinerifle_extendedclip=prop_ld_ammo_pack_02,
carbinerifle_drum=prop_ld_ammo_pack_02,
carbinerifle_scope=prop_ld_ammo_pack_02,
carbinerifle_luxuryfinish=prop_ld_ammo_pack_02,
advancedrifle_defaultclip=prop_ld_ammo_pack_02,
advancedrifle_extendedclip=prop_ld_ammo_pack_02,
advancedrifle_luxuryfinish=prop_ld_ammo_pack_02,
specialcarbine_defaultclip=prop_ld_ammo_pack_02,
specialcarbine_extendedclip=prop_ld_ammo_pack_02,
specialcarbine_drum=prop_ld_ammo_pack_02,
specialcarbine_luxuryfinish=prop_ld_ammo_pack_02,
bullpuprifle_defaultclip=prop_ld_ammo_pack_02,
bullpuprifle_extendedclip=prop_ld_ammo_pack_02,
bullpuprifle_luxuryfinish=prop_ld_ammo_pack_02,
compactrifle_defaultclip=prop_ld_ammo_pack_02,
compactrifle_extendedclip=prop_ld_ammo_pack_02,
compactrifle_drum=prop_ld_ammo_pack_02,
gusenberg_defaultclip=prop_ld_ammo_pack_02,
gusenberg_extendedclip=prop_ld_ammo_pack_02,
sniperrifle_defaultclip=prop_ld_ammo_pack_02,
sniper_scope=prop_ld_ammo_pack_02,
snipermax_scope=prop_ld_ammo_pack_02,
sniper_grip=prop_ld_ammo_pack_02,
heavysniper_defaultclip=prop_ld_ammo_pack_02,
marksmanrifle_defaultclip=prop_ld_ammo_pack_02,
marksmanrifle_extendedclip=prop_ld_ammo_pack_02,
marksmanrifle_scope=prop_ld_ammo_pack_02,
marksmanrifle_luxuryfinish=prop_ld_ammo_pack_02,
weapontint_black=w_pi_pistolmk2_camo_sl_ind1,
weapontint_green=w_pi_pistolmk2_camo_sl_ind1,
weapontint_gold=w_pi_pistolmk2_camo_sl_ind1,
weapontint_pink=w_pi_pistolmk2_camo_sl_ind1,
weapontint_army=w_pi_pistolmk2_camo_sl_ind1,
weapontint_lspd=w_pi_pistolmk2_camo_sl_ind1,
weapontint_orange=w_pi_pistolmk2_camo_sl_ind1,
weapontint_plat=w_pi_pistolmk2_camo_sl_ind1,
pistol_ammo=v_ret_gc_bullet,
water=prop_ld_flow_bottle
}

exports.ox_inventory:registerHook(“swapItems”, function(payload)
if payload.toInventory ~= “newdrop” then return end
local item = payload.fromSlot
local items = {{item.name, payload.count}}
local dropId = exports.ox_inventory:CustomDrop(item.label, items, GetEntityCoords(GetPlayerPed(payload.source)), 50, 30000, nil, dropItems[item.name])
if not dropId then return end
CreateThread(function()
exports.ox_inventory:RemoveItem(payload.source, item.name, item.count, nil, item.slot)
Wait(0)
exports.ox_inventory:forceOpenInventory(payload.source, “drop”, dropId)
end)
return false
end, {
itemFilter = dropItems,
typeFilter = {player = true}
})

Maybe its too many items, since it stopped working :confused:

In your system the metadata is lost :confused:

Can i have ur discord i bought it and props not show

Use this instead to keep the metadata

local dropItems = {
    burger = `prop_cs_burger_01`,
    water = `prop_ld_flow_bottle`,
}

exports.ox_inventory:registerHook('swapItems', function(payload)
    if payload.toInventory ~= 'newdrop' then return end

    local item = payload.fromSlot
    local items = { { item.name, payload.count, item.metadata } }
    local dropId = exports.ox_inventory:CustomDrop(item.label, items,
        GetEntityCoords(GetPlayerPed(payload.source)), 1, item.weight, nil, dropItems[item.name])

    if not dropId then return end

    CreateThread(function()
        exports.ox_inventory:RemoveItem(payload.source, item.name, item.count, nil, item.slot)
        Wait(0)
        exports.ox_inventory:forceOpenInventory(payload.source, 'drop', dropId)
    end)

    return false
end, {
    itemFilter = dropItems,
    typeFilter = { player = true }
})