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

Solved Pick system

bzium1994

New Member
Joined
Mar 31, 2013
Messages
5
Reaction score
0
pick.lua
PHP:
local aID = 777
local ticks = 30
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}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local toPositions = {x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=0}
 
    if itemEx.actionid == aID then
		if isInArray(GRASS, itemEx.itemid) then
			doTransformItem(itemEx.uid,470)
			doDecayItemTo(toPositions, itemEx.itemid, ticks)
		elseif isInArray(DIRT, itemEx.itemid) then
			doTransformItem(itemEx.uid,392)
			doDecayItemTo(toPositions, itemEx.itemid, ticks)
		elseif itemEx.itemid == 231 then
			doTransformItem(itemEx.uid,482)
			doDecayItemTo(toPositions, itemEx.itemid, ticks)
		elseif isInArray(SNOW, itemEx.itemid) then
			doTransformItem(itemEx.uid,485)
			doDecayItemTo(toPositions, itemEx.itemid, ticks)
		else
			doCreateItem(3324, 1, toPosition)
			doDecayItemTo({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}, 0, ticks)
		end
	elseif itemEx.itemid == 7200 then
		doTransformItem(itemEx.uid,7236)
	end
	return true
end

actions.lua
PHP:
function decayItem(itempos, toitem)
	local item = getThingFromPos(itempos)
	if (not toitem) or toitem == 0 then
		doRemoveItem(item.uid,1)
	else
		doTransformItem(item.uid,toitem)
	end
end
 
function doDecayItemTo(itempos, toitem, timer)
	addEvent(decayItem, timer*1000, itempos, toitem)
	return true
end

action.xml
PHP:
<action itemid="2553" script="tools/pick.lua"/>

The problem is that when the ground is uncovered, there is a hole. After "[color = # FF0000] timer * 1000 [/ color]" hole does not clog the engine and get the error:

57438031.png


If someone can help me?
 
If you are using an old client server, try to change
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
for
Lua:
function onUse(cid, item, frompos, item2, topos)
and in the rest of the script
Lua:
toPosition
for
Lua:
topos

And itemEx for item2.
 
Last edited:
If you are using an old client server, try to change
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
for
Lua:
function onUse(cid, item, frompos, item2, topos)
and in the rest of the script
Lua:
toPosition
for
Lua:
topos

And itemEx for item2.

Hi, parameters name does not matter. You can even name them by genitals.
 
Back
Top