• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Juice Squeezer

LUA:
local FRUIT = {2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2684, 2685, 5097, 8839, 8840, 8841}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInArray(FRUIT, itemEx.itemid) and doPlayerRemoveItem(cid, 2006, 1, 0) then
		doRemoveItem(itemEx.uid, 1)
		doPlayerAddItem(cid, 2006, itemEx.itemid == 2678 and 14 or 21)
		return true
	end
end
 
Last edited:
LUA:
doPlayerAddItem(cid, 2006, itemEx.itemid == 2678 and 14 or 21)

Wouldn't that create coconut milk and fruit juice randomly?
 
No. If player used item on a coconut (2678) it would create vial (2006) with subType 14 (coconut milk). If not, it will have subType 21 (fruit juice).
 
The script works perfectly except for that if the player has more than one of a fruit or coconut, it takes all of that fruit/coconut instead of just one.
 
The script works perfectly except for that if the player has more than one of a fruit or coconut, it takes all of that fruit/coconut instead of just one.
Code:
doRemoveItem(itemEx.uid)
to
Code:
doRemoveItem(itemEx.uid, 1)
 
Code:
local FRUIT = {2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2684, 2685, 5097, 8839, 8840, 8841}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInArray(FRUIT, itemEx.itemid) and [B][COLOR="red"]doPlayerRemoveItem(cid, 2006, 1, 0)[/COLOR][/B] then
		doRemoveItem(itemEx.uid, 1)
		doPlayerAddItem(cid, 2006, itemEx.itemid == 2678 and 14 or 21)
		return true
	end
end
This part is making TFS go infinite loop mode for me whenever it finds a non-empty vial before it finds an empty one. Can anyone else confirm?

qzl3W.jpg
 
Last edited:
If someone has two empty vials and uses the juice squeezer on one and then tries to use it again to fill up the other vial, the whole server freezes and crashes.
 
Yep, thanks for confirming it! It appears to be a TFS issue.

A temporary fix would be removing this parameter:
Code:
doPlayerRemoveItem(cid, 2006, 1[B], [COLOR="red"]0[/COLOR][/B])
 

Similar threads

Back
Top