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

Learning lua and need some help..

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
Okey i have script here that doesn't wan't to work properly.
On both step in and out i got an error like this..
(luaDoRemoveItem) Item not found.

Code:
function onStepIn(cid, item, frompos, item2, topos) 
	ground1 = {x=32225, y=32282, z=9, stackpos=1}
	getground1 = getThingfromPos(ground1)

	if item.uid == 64132 then
		doTransformItem(item.uid, item.itemid - 1)
		doRemoveItem(getground1.uid,1)
		doCreateItem(433,1,ground1)
end
end

function onStepOut(cid, item, frompos, item2, topos)
	ground1 = {x=32225, y=32282, z=9, stackpos=1}
	getground1 = getThingfromPos(ground1)

	if item.uid == 64132 then
		doTransformItem(item.uid, item.itemid + 1)
		doRemoveItem(getground1.uid,1)

	end

	return 1
end


Since i wan't to learn, please explain why it don't work.. :)

Thanks in advance!
 
You can't remove a ground tile.
Code:
local config = {
	itemid = {433, 406},
	pos = {x=32225, y=32282, z=9}
}

function onStepIn(cid, item, position, fromPosition)
	doTransformItem(item.uid, item.itemid - 1)
	doTransformItem(getTileItemById(config.pos, config.itemid[2]).uid, config.itemid[1])
end

function onStepOut(cid, item, position, fromPosition)
	doTransformItem(item.uid, item.itemid + 1)
	doTransformItem(getTileItemById(config.pos, config.itemid[1]).uid, config.itemid[2])
end
 
Thanks Cykotitan!

I did like this and it worked. Probaly use your script insteed :)
Code:
function onStepIn(cid, item, frompos, item2, topos) 
	ground1 = {x=32225, y=32282, z=9, stackpos=1}

	if item.uid == 64132 then
		doTransformItem(item.uid, item.itemid - 1)
	doRemoveItem(getTileItemById(ground1, 424).uid)
		doCreateItem(433,1,ground1)
end
end

function onStepOut(cid, item, frompos, item2, topos)
	ground1 = {x=32225, y=32282, z=9, stackpos=1}

	if item.uid == 64132 then
		doTransformItem(item.uid, item.itemid + 1)
	doRemoveItem(getTileItemById(ground1, 433).uid)
		doCreateItem(424,1,ground1)

	end

	return 1
end
 
Back
Top