• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Tool Gear (SGOG, SSOE & WDOF)

i dont know why but my players got the tool jammed for 18000 seconds. no errors in console.
 
Did you modify the script?

also get that, after you stay off for some time you'll get huge values on it...
and on real each pocket knife has it's own script so if one gets jammed you can use another one.
 
it..
No, it should only have a chance to get jammed if you use it on a valid item.

And what if I have two of these Items?
(If I have two and one does not work, the latter also can not use at that time)

:thumbup:
 
Last edited:
Simply copy the script and modify the item id's. To make it three different scripts, one for each item id..
 
Simply copy the script and modify the item id's. To make it three different scripts, one for each item id..

I think that man can better..

---
After a reboot the server, is a bug, the "value" must be "-1". Otherwise does not work while that tool jammed 564646165.. seconds :D
I improved in this way:

--- EDIT:
all of the code. Now only on bad items jammed! Like rl Tibia
Code:
local UPS = {384, 418, 8278}
local HOLES = {468, 481, 483, 7932}
local HOLEID = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
local REST = {7200} --  here all of items, which you do not want, that's jammed
local YOUR_FREE_STORAGE_ID = 1234
local JAMMED_TIME = 60

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local value = getPlayerStorageValue(cid, YOUR_FREE_STORAGE_ID)
	if value ~= -1 then
		if (os.clock()-value > JAMMED_TIME) then --when a server crashes
			setPlayerStorageValue(cid, YOUR_FREE_STORAGE_ID, -1)
		elseif (os.clock()-value < JAMMED_TIME) then
			doPlayerSay(cid, "The tool jammed. Please wait " .. JAMMED_TIME - math.floor(os.clock()-value) .. " seconds before using it again.", TALKTYPE_MONSTER)
			return true
		end
	end

	if not(isInArray(HOLEID, itemEx.itemid)) and not(isInArray(HOLES, itemEx.itemid)) and not(isInArray(UPS, itemEx.itemid)) and not(isInArray(REST, itemEx.itemid)) and (math.random(1, 10) == 1) then
		setPlayerStorageValue(cid, YOUR_FREE_STORAGE_ID, os.clock())
		doPlayerSay(cid, "The tool jammed. Please wait " ..JAMMED_TIME.. " seconds before using it again.", TALKTYPE_MONSTER)
		return true
	end
	-- Shovel
	if isInArray(HOLES, itemEx.itemid) == true then
		doTransformItem(itemEx.uid, itemEx.itemid + 1) 
		doDecayItem(itemEx.uid)
		return false
	-- Rope
	elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
		return false
	end

	local groundTile = getThingfromPos(toPosition)
	if isInArray(UPS, groundTile.itemid) then
		doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
	elseif isInArray(HOLEID, itemEx.itemid) == true then
		local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
		if hole.itemid > 0 then
			doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
		return false
	-- Pick
	elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		return true
	elseif(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		return true
	-- Machete
	elseif itemEx.itemid == 2782 then
		doTransformItem(itemEx.uid, 2781)
		doDecayItem(itemEx.uid)
		return true
	elseif itemEx.itemid == 1499 then
		doRemoveItem(itemEx.uid)
		return true
	-- Scythe
	elseif itemEx.itemid == 2739 then 
		doTransformItem(itemEx.uid, 2737)
		doCreateItem(2694, 1, toPosition)
		doDecayItem(itemEx.uid)
		return true
	end
	return destroyItem(cid, itemEx, toPosition)
end
well?
 
Last edited:
Back
Top