I only found this type of script:
auto(200)
local depotSpearBackpack = 'brown backpack'
if itemcount(getuseroption('spear')) >= 1 and $rhand.count < 7 then
moveitems(getuseroption('spear'), 'rhand', depotSpearBackpack, 1)
wait(200,500)
end
but it's only for equipping spears and it doesn't work, I want my char to fight with his weapon and when he loots spears then he equips them and when they break he'll use his weapon back.