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

Lua Problem with lever script, help! screenshots

Adi69

Active Member
Joined
Mar 14, 2008
Messages
161
Reaction score
35
Location
Poland
Hello again!
I need to fix this script, i try to fix it and nothing happens :(

Sytuation look's that:


But i have errors in console:



lever is working, but stone don't want to delete...
13:25 You removed a Stone.
13:25 You added a Stone.

Here is code, what's wrong? Use tfs 3.6.0pl1

Code:
-- Script by Ates, Add/Remove Stone!
function onUse(cid, item, fromPosition, itemEx, toPosition)
         local pos = {x=1203, y=199, z=11, stackpos=1}
         local stone = 1304
         local stoneFromPos = getThingfromPos(pos)

if item.itemid == 1945 and item.uid == 6025 then
         doRemoveItem(stoneFromPos.uid, 1,)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed a Stone.")
         doTransformItem(item.uid,item.id+1)
elseif item.itemid == 1946 and item.uid == 6025 then
         doCreateItem(stone, 1, pos)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added a Stone.")
         doTransformItem(item.uid,item.id-1)
     end
end

REP++ OTlanders! :)
 
Lua:
-- Script by Ates, Add/Remove Stone!
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local pos = {x = 1203, y = 199, z = 11, stackpos = 1}
	local stone = 1304

	if item.itemid == 1945 and item.uid == 6025 then
		doRemoveItem(getThingFromPos(pos).uid, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed a Stone.")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 6025 then
		doCreateItem(stone, 1, pos)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added a Stone.")
		doTransformItem(item.uid, item.itemid - 1)
	end
end

Else
Lua:
-- Script by Ates, Add/Remove Stone!
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local pos = {x = 1203, y = 199, z = 11, stackpos = 1}
	local stone = 1304

	if item.itemid == 1945 and item.uid == 6025 then
		doRemoveItem(getThingFromPos(pos), 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed a Stone.")
		doTransformItem(item.uid, item.itemid + 1)
	elseif item.itemid == 1946 and item.uid == 6025 then
		doCreateItem(stone, 1, pos)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added a Stone.")
		doTransformItem(item.uid, item.itemid - 1)
	end
end
:thumbup:
 
Lua:
local t = {
	pos = {x=1203, y=199, z=11},
	id = 1304
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(t.pos, t.id).uid)
	else
		local moveTo = {x=t.pos.x, y=t.pos.y+1, z=t.pos.z}
		doRelocate(t.pos, moveTo)
		doCreateItem(t.id, 1, t.pos)
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You ' .. (item.itemid == 1945 and 'remov' or 'add') .. 'ed a Stone.')
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top