> For the complete documentation index, see [llms.txt](https://docs.dolajiscripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dolajiscripts.com/resources/ds-fruitpicker.md).

# ds-fruitpicker

<div align="center"><img src="/files/7ClYOy2pqpa5l481zr89" alt=""></div>

[<mark style="color:purple;">**View on Tebex**</mark>](https://dolajiscripts.com/package/5128611) <mark style="color:purple;">**| CFX Fourm Post |**</mark> [<mark style="color:purple;">**Youtube Video**</mark>](https://youtu.be/cjgSVUB858c) <mark style="color:purple;">**|**</mark> [<mark style="color:purple;">**Discord**</mark>](https://discord.gg/vhF9ke3hJG)

## Installaction

### Dependencies

| Dependency           | Download                                                                                   | Description                                                       |
| -------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| orangeprop           | [Link](https://drive.google.com/file/d/1UCeepX2Hh2EDVn7f9sScnxr5QIrjEsRS/view?usp=sharing) | Custom orange prop                                                |
| qb-input (Optional)  | [Link](https://github.com/qbcore-framework/qb-input)                                       | qb-input for add input option on sell oranges and pickup oranges. |
| qb-target (Optional) | [Link](https://github.com/qbcore-framework/qb-target)                                      | you need eye target script if you don't want to use drawtext      |

### Start

1. Extract `ds-fruitpicker.zip` and place it into your resource folder.
2. Install and ensure [dependencies](#dependencies) for the resource.
3. Setup`config.lua` (⚠️see [#CONFIGURATION](#configuration) for instructions).&#x20;
4. Add`ensure ds-fruitpicker`to your server start config (place it anywhere below the dependency & framework resources).

### Configuration

{% hint style="warning" %}
Please go through **all** configurable options & settings in `config.lua` and configure them to your server's preferences.

Also please read the comments at the end of each line, for a brief information on what the option does.&#x20;
{% endhint %}

### Add Items

#### Open `qb-core/shared/items.lua`and add this lines

{% tabs %}
{% tab title="Items" %}

```lua
orange = {
    ["name"] = "orange",
    ["label"] = "Orange",
    ["weight"] = 1000,
    ["type"] = "item",
    ["image"] = "orange.png",
    ["unique"] = false,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "This is Orange you can eat this"
},
fruit_basket = {
    ["name"] = "fruit_basket",
    ["label"] = "Fruit Basket",
    ["weight"] = 1000,
    ["type"] = "item",
    ["image"] = "fruit_basket.png",
    ["unique"] = true,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Fruit Basket"
},
```

{% endtab %}

{% tab title="Inventory Images" %}
![](/files/DR9xYpRn9qbw9PYEdzKS) ![](/files/06s5Sifjogoh6nT1P97k)
{% endtab %}
{% endtabs %}

### Add In `qb-radialmenu`

replace below code in `qb-radialmenu\client\main.lua` in SetupRadialMenu function.

{% tabs %}
{% tab title="Code" %}

```lua
local function SetupRadialMenu()
    FinalMenuItems = {}
    if (IsDowned() and IsPoliceOrEMS()) then
        FinalMenuItems = {
            [1] = {
                id = 'emergencybutton2',
                title = Lang:t("options.emergency_button"),
                icon = 'circle-exclamation',
                type = 'client',
                event = 'police:client:SendPoliceEmergencyAlert',
                shouldClose = true,
            },
        }
    else
        SetupSubItems()
        FinalMenuItems = deepcopy(Config.MenuItems)
        for _, v in pairs(DynamicMenuItems) do
            FinalMenuItems[#FinalMenuItems + 1] = v
        end

        local basket = exports['ds-fruitpicker']:Checkbasket()
        if basket == "drop" then
            FinalMenuItems[#FinalMenuItems + 1] = {
                id = "basket",
                title = "Drop Basket",
                icon = "basket-shopping",
                type = 'client',
                event = 'dropbasket',
                shouldClose = true,
            }
        elseif basket == "pickup" then
            FinalMenuItems[#FinalMenuItems + 1] = {
                id = "basket2",
                title = "Pickup Basket",
                icon = "basket-shopping",
                type = 'client',
                event = 'dropbasket',
                shouldClose = true,
            }
        end
    end
end
```

{% endtab %}
{% endtabs %}

### Add in `qb-core`

Add below code or replace function in `qb-inventory\server\main.lua.`

{% tabs %}
{% tab title="Replace Function (recommended)" %}
replace `RemoveItem` function.

```lua
local function RemoveItem(source, item, amount, slot)
	local Player = QBCore.Functions.GetPlayer(source)

	if not Player then return false end

	amount = tonumber(amount) or 1
	slot = tonumber(slot)

	if slot then
		if not Player.PlayerData.items[slot] then
			DropPlayer(source, 'Failed to remove item, most likely cheating')
			return false
		end
		if Player.PlayerData.items[slot].amount > amount then
			Player.PlayerData.items[slot].amount = Player.PlayerData.items[slot].amount - amount
			Player.Functions.SetPlayerData('items', Player.PlayerData.items)

			if item == 'fruit_basket' then
                TriggerClientEvent("ds-fruitpicker:removebasket", source)
            end

			if not Player.Offline then
				TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. slot .. '], itemname: ' .. Player.PlayerData.items[slot].name .. ', removed amount: ' .. amount .. ', new total amount: ' .. Player.PlayerData.items[slot].amount)
			end



			return true
		elseif Player.PlayerData.items[slot].amount == amount then
			Player.PlayerData.items[slot] = nil
			Player.Functions.SetPlayerData('items', Player.PlayerData.items)

			if item == 'fruit_basket' then
                TriggerClientEvent("ds-fruitpicker:removebasket", source)
            end

			if Player.Offline then return true end

			TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. slot .. '], itemname: ' .. item .. ', removed amount: ' .. amount .. ', item removed')

			return true
		end
	else
		local slots = GetSlotsByItem(Player.PlayerData.items, item)
		local amountToRemove = amount

		if not slots then return false end

		for _, _slot in pairs(slots) do
			if not Player.PlayerData.items[_slot] then
				DropPlayer(source, 'Failed to remove item, most likely cheating')
				return false
			end
			if Player.PlayerData.items[_slot].amount > amountToRemove then
				Player.PlayerData.items[_slot].amount = Player.PlayerData.items[_slot].amount - amountToRemove
				Player.Functions.SetPlayerData('items', Player.PlayerData.items)

				if item == 'fruit_basket' then
					TriggerClientEvent("ds-fruitpicker:removebasket", source)
				end

				if not Player.Offline then
					TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. _slot .. '], itemname: ' .. Player.PlayerData.items[_slot].name .. ', removed amount: ' .. amount .. ', new total amount: ' .. Player.PlayerData.items[_slot].amount)
				end

				return true
			elseif Player.PlayerData.items[_slot].amount == amountToRemove then
				Player.PlayerData.items[_slot] = nil
				Player.Functions.SetPlayerData('items', Player.PlayerData.items)

				if item == 'fruit_basket' then
					TriggerClientEvent("ds-fruitpicker:removebasket", source)
				end

				if Player.Offline then return true end

				TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. _slot .. '], itemname: ' .. item .. ', removed amount: ' .. amount .. ', item removed')

				return true
			end
		end
	end
	return false
end
```

{% endtab %}

{% tab title="add Code" %}
add this three lines after&#x20;

```lua
Player.Functions.SetPlayerData('items', Player.PlayerData.items) 

in RemoveItem function.
```

```lua
 if item == 'fruit_basket' then
     TriggerClientEvent("ds-fruitpicker:removebasket", source)
 end
```

![](/files/W1HwjuL0VL1ebLPC6DSC)
{% endtab %}
{% endtabs %}
