Skip to content

Tools ​

Your tools can be inventory items or the GTA weapons you already carry. A farming step never asks for one exact item. It asks for a tool type (cutting, digging, bashing, …), and anything of that type works: a sickle in your pockets, a machete in your loadout, a knife in your hand. Holding the tool makes the step faster. Item tools wear out; loadout weapons do not.

The Tools screen: what you carry, what each step needs, how the check works

/farmtools, using a tool item, or the Tools item on np_menu's radial wheel (on foot) opens the Tools screen. It lists what you carry right now (weapons in the loadout, items in the inventory, the one in your hand), what each step needs with a tick or a cross, the check order, and every weapon that works as a tool. The Harvest app's almanac shows the same for one crop ("Harvest tool · Cutting · You have one").

Nothing that fits
Tools, nothing fits When a step finds no tool, the toast names the options: "You need a tool for bashing: bat, golf club or wrench works."

The check order ​

The server decides, never the client. For a step that needs tool type T, np_farming looks in this order and takes the first match:

  1. The weapon in your hand. The server reads GetSelectedPedWeapon on your ped. If that weapon is in T's list (and you own it, verifyHand), it is used and the step gets the in-hand bonus: +20 % work speed by default, so a 6-second harvest takes 5 seconds.
  2. A weapon in your loadout. A weapon of T's list that you carry but do not hold: the ESX loadout (xPlayer.getLoadout()), or a weapon item in the pockets of np_inventory (items with weapon.hash, also in the equipment slots), ox_inventory (WEAPON_* items) or qb-inventory (weapon_* items). Normal speed.
  3. An item in your inventory. An item of T's list with durability left, the most worn first. Normal speed.

A weapon that is in no list (a pistol) is never a tool. The check runs again when the step finishes, so dropping the tool halfway fails the step.

Source Speed Wear
hand (weapon held) × (1 + inHandBonus) = × 1.2 weaponWear if it is an inventory weapon item (default 0); ESX loadout weapons never
loadout (weapon carried) × 1.0 The same
item × 1.0 itemWear durability per use (default 2 of 100); broken at 0

The work speed stays within Config.Actions.workSpeed (0.5 to 2.0).

Weapon → tool map ​

Tool type Items GTA weapons Used for
cutting sickle, pruning_shears WEAPON_KNIFE, WEAPON_MACHETE, WEAPON_SWITCHBLADE, WEAPON_DAGGER, WEAPON_BOTTLE Harvesting tomato, wheat, corn, lettuce, pumpkin, grapes, chili, limes
chopping pruning_saw WEAPON_HATCHET, WEAPON_STONE_HATCHET, WEAPON_BATTLEAXE Pruning or felling orchard trees
bashing rake WEAPON_BAT, WEAPON_GOLFCLUB, WEAPON_WRENCH, WEAPON_HAMMER, WEAPON_CROWBAR, WEAPON_POOLCUE Shaking walnuts loose
digging garden_trowel, shovel – Carrots and potatoes
watering watering_can – Watering plants, filling troughs, putting out fires. The can empties (metadata.water) instead of wearing out
light (utility) – WEAPON_FLASHLIGHT Harvesting outdoors at night (21:00 to 05:00)
fuel (utility) – WEAPON_PETROLCAN Refuelling a tractor in the field (np_fuel's jerry can item counts too)
extinguish (utility) – WEAPON_FIREEXTINGUISHER Putting out field fires

Strawberries and apples are picked by hand (tool = false). Utility types have no in-hand bonus and no harvest step asks for them.

Weapon labels come from the inventory when it has one, else Config.Tools.weaponLabels; a locale key weapon.<name> wins over both.

Addon weapons ​

Weapons are GTA names, hashed when the registry is built, so addon weapons work the same way. A weapon pack with a sickle:

lua
Config.Tools.types.cutting.weapons[#Config.Tools.types.cutting.weapons + 1] = 'WEAPON_SICKLE'
Config.Tools.weaponLabels.WEAPON_SICKLE = 'Sickle'

Config ​

shared/config/tools.lua:

lua
Config.Tools = {
  inHandBonus = 0.2,       -- holding the weapon: +20 % work speed (per type: types.<t>.inHandBonus)
  itemWear = 2,            -- durability points an item tool loses per use (metadata.durability, 0..100)
  weaponWear = 0,          -- durability points a weapon item loses per use (np / ox weapon items); 0 = never
  verifyHand = true,       -- a weapon in the hand must also be owned, wherever ownership can be read
  standaloneReport = true, -- standalone: trust the client's report of which tool weapons its ped has
  command = 'farmtools',   -- opens the tools screen (false: no command)
  radial = true,           -- with np_menu: a "Tools" item on its radial wheel (on foot)

  types = {
    cutting = {
      label = 'Cutting', icon = 'scissors',
      items = { 'sickle', 'pruning_shears' },
      weapons = { 'WEAPON_KNIFE', 'WEAPON_MACHETE', 'WEAPON_SWITCHBLADE', 'WEAPON_DAGGER', 'WEAPON_BOTTLE' },
    },
    -- chopping, bashing, digging, watering (wear = 0), and the utility types fuel, light, extinguish
  },
  weaponLabels = { WEAPON_KNIFE = 'Knife', WEAPON_MACHETE = 'Machete', … },
}
Option Default Description
inHandBonus 0.2 Speed bonus for a weapon held in the hand; a type may set its own
itemWear 2 Durability an item tool loses per finished step; a type may set its own wear
weaponWear 0 Durability a weapon item loses per step (np_inventory / ox_inventory weapon items). ESX loadout weapons never wear
verifyHand true The weapon in the hand must also be owned, where ownership can be read
standaloneReport true Standalone has no server-side loadout: the client reports which tool weapons its ped has (HasPedGotWeapon), checked against the server's view of the hand. The weakest path; false counts hand-held weapons only
command 'farmtools' The command that opens the Tools screen (false = none)
radial true With np_menu: a Tools item on its radial wheel (on foot)
types.<id> see the map label, icon, items, weapons, inHandBonus?, wear?, utility?
weaponLabels GTA names Labels shown when the inventory has none

Tools.inHandBonus, itemWear, weaponWear, verifyHand and standaloneReport are editable live in np_admin (Configuration → Editable in np_admin).

Durability ​

Item tools get metadata.durability = 100 (or their durability) when they are created. Each finished step lowers it by itemWear after the produce is in your pockets; at 0 the tool is broken and no longer counts. On the ESX inventory, which has no metadata, wear is counted in np_farming's own store per character and item. np_inventory shows the durability bar on the item.

By framework and inventory ​

Hand Loadout Items
es_extended Server ped xPlayer.getLoadout() Inventory items
qbx_core / qb-core Server ped Weapon items of the inventory Inventory items
np_inventory / ox_inventory / qb-inventory Server ped Their weapon items (np_inventory: pockets and equipment slots) Their items
standalone Server ped The client's report (standaloneReport) Inventory items, if any

From another resource ​

lua
local found, options = exports.np_farming:FindTool(src, 'cutting')
if found then
  print(found.source, found.name, found.speedMult)   -- 'hand', 'WEAPON_MACHETE', 1.2
else
  for _, o in ipairs(options) do print(o.kind, o.label) end   -- every way to satisfy it, items first
end

See Exports → FindTool and GetTools().