• 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!

Pick tool issue

Blasphemy

Well-Known Member
Joined
Jan 5, 2012
Messages
387
Reaction score
71
Hello everyone, I have the next issue:

When I use pick on a tile with actions "55555" or "55556" It creates the hole id "5024" that decays to "0" on 10 seconds, but the item never decays, so I think that there's another function I'm missing, someone can help me?
Thanks everyone <3

"items.xml":
Code:
    <item id="5024" article="a" name="pickhole">
        <attribute key="decayTo" value="0"/>
        <attribute key="duration" value="10"/>
        <attribute key="floorchange" value="down"/>
    </item>

"Pick.lua"

Code:
function onUse(cid, item, frompos, item2, topos)

aID = 55556 --Action Id the ground tile must have to turn into a hole.
aID2 = 55555
ticks = 20
topos = {x=topos.x, y=topos.y, z=topos.z}
GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
DIRT = {351, 352, 353, 354, 355}
SNOW = {671, 6683, 6684, 6685, 6686, 7002}
SAND = {231}
DENY = {383, 384, 385, 392, 418, 469, 470, 482, 484, 485, 489}

if item2.actionid == aID or item2.actionid == aID2 then
    if isInArray(GRASS, item2.itemid) == 1 then
        doCreateItem(5024, 1, topos)
    elseif isInArray(DIRT, item2.itemid) == 1 then
        doCreateItem(5024, 1, topos)
    elseif isInArray(SAND, item2.itemid) == 1 then
        doCreateItem(5024, 1, topos)
    elseif isInArray(SNOW, item2.itemid) == 1 then
        doCreateItem(5024, 1, topos)
    elseif isInArray(DENY, item2.itemid) == 1 then
        doPlayerSendTextMessage(cid,23,"Sorry! not possible.")
    else
        doCreateItem(5024, 1, topos)
    end
end
return true
end
 
Solution
Don't feel like rewriting the entire thing, so just very basic improvement + the fix to your issue

LUA:
local aID = 55556 --Action Id the ground tile must have to turn into a hole.
local aID2 = 55555
local ticks = 20
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
local DIRT = {351, 352, 353, 354, 355}
local SNOW = {671, 6683, 6684, 6685, 6686, 7002}
local SAND = {231}
local DENY = {383, 384, 385, 392, 418, 469, 470, 482, 484, 485, 489}

function onUse(cid, item, frompos, item2, topos)
	if item2.actionid == aID or item2.actionid == aID2 then
		if isInArray(GRASS, item2.itemid) == 1 then
			doDecayItem(doCreateItem(5024, 1, topos))
		elseif...
how can i add it, i´ve tried it lot of ways :(

doDecayItemTo(topos, item2.itemid, ticks)

is it right?

LUA:
local deniedItems = { 383, 384, 385, 392, 418, 469, 470, 482, 484, 485, 489 }
local acceptableItems = { 4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535,
4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756, 351, 352, 353, 354,
355, 671, 6683, 6684, 6685, 6686, 7002, 231 }

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isInArray({55555, 55556}, itemEx.actionid)then
        if isInArray(acceptableItems, itemEx.itemid) then
            doDecayItem(doCreateItem(5024, 1, toPosition))
        elseif isInArray(deniedItems, itemEx.itemid) then
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Sorry! not possible.")
        else
            doCreateItem(5024, 1, toPosition)
        end
    end
    return true
end

Should work.
 
Don't feel like rewriting the entire thing, so just very basic improvement + the fix to your issue

LUA:
local aID = 55556 --Action Id the ground tile must have to turn into a hole.
local aID2 = 55555
local ticks = 20
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
local DIRT = {351, 352, 353, 354, 355}
local SNOW = {671, 6683, 6684, 6685, 6686, 7002}
local SAND = {231}
local DENY = {383, 384, 385, 392, 418, 469, 470, 482, 484, 485, 489}

function onUse(cid, item, frompos, item2, topos)
	if item2.actionid == aID or item2.actionid == aID2 then
		if isInArray(GRASS, item2.itemid) == 1 then
			doDecayItem(doCreateItem(5024, 1, topos))
		elseif isInArray(DIRT, item2.itemid) == 1 then
			doDecayItem(doCreateItem(5024, 1, topos))
		elseif isInArray(SAND, item2.itemid) == 1 then
			doDecayItem(doCreateItem(5024, 1, topos))
		elseif isInArray(SNOW, item2.itemid) == 1 then
			doDecayItem(doCreateItem(5024, 1, topos))
		elseif isInArray(DENY, item2.itemid) == 1 then
			doPlayerSendTextMessage(cid,23,"Sorry! not possible.")
		else
			doDecayItem(doCreateItem(5024, 1, topos))
		end
	end
	return true
end
 
Solution
Don't feel like rewriting the entire thing, so just very basic improvement + the fix to your issue

LUA:
local aID = 55556 --Action Id the ground tile must have to turn into a hole.
local aID2 = 55555
local ticks = 20
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
local DIRT = {351, 352, 353, 354, 355}
local SNOW = {671, 6683, 6684, 6685, 6686, 7002}
local SAND = {231}
local DENY = {383, 384, 385, 392, 418, 469, 470, 482, 484, 485, 489}

function onUse(cid, item, frompos, item2, topos)
    if item2.actionid == aID or item2.actionid == aID2 then
        if isInArray(GRASS, item2.itemid) == 1 then
            doDecayItem(doCreateItem(5024, 1, topos))
        elseif isInArray(DIRT, item2.itemid) == 1 then
            doDecayItem(doCreateItem(5024, 1, topos))
        elseif isInArray(SAND, item2.itemid) == 1 then
            doDecayItem(doCreateItem(5024, 1, topos))
        elseif isInArray(SNOW, item2.itemid) == 1 then
            doDecayItem(doCreateItem(5024, 1, topos))
        elseif isInArray(DENY, item2.itemid) == 1 then
            doPlayerSendTextMessage(cid,23,"Sorry! not possible.")
        else
            doDecayItem(doCreateItem(5024, 1, topos))
        end
    end
    return true
end
solved with this!

thank youuuuuu <3
 
Back
Top