So Im trying to do a weed harvesting loop by putting something like this but it doesnt work:
Citizen.CreateThread(function()
while xPlayer.canCarryItem('weed', 420) do
xPlayer.addInventoryItem('weed', 1)
Citizen.Wait(1500)
end
I already have a key when pressed the weed harvest starts.
Im also trying to add this code that stops the harvesting process when pressing certain keys but I dont know how to do it exactly:
if IsControlPressed(0,8) or
IsControlPressed(0,28) then
break
And finally a message warning the player his inventory limit when carrying weed:
if not xPlayer.canCarryItem('weed', weed.weight) then
xPlayer.showNotification(_U('inv_full_weed'))
end
That’s all I need, if anybodie can help me I’ll be gratefull. Thanks! (Sorry for my english btw)