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

Lever

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
I need script when you put two items on x2062 y1972 z8 and x2064 y1972 z8 and use lever
you will obtain new item on x2063 y1972 z8
 
PHP:
local itemi = 2086
local pos1 = {x=2034, y=340, z=7}
local itemi2 = 2090
local pos2 = {x=2035, y=340, z=7}
local queststatus = getPlayerStorageValue(cid,49506)
function onUse(cid, item, frompos, item2, topos)
	local targetItem = getTileItemById(pos1, itemi).uid
		local targetItem2 = getTileItemById(pos2, itemi2).uid
		if queststatus == -1 then
if targetitem > 0 and targetitem2 > 0 then
doRemoveItem(targetItem)
doRemoveItem(targetItem2)
setPlayerStorageValue(cid,49506,1)
doPlayerAddItem(cid, 2087, 1)
doSendMagicEffect(pos1, CONST_ME_FIREAREA)
doSendMagicEffect(pos2, CONST_ME_FIREAREA)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
else
doCreatureSay(cid, "You have to put "..getItemNameById(itemi).." and "..getItemNameById(itemi2).." to the right places!", TALKTYPE_ORANGE_1)
end
else
doCreatureSay(cid, "You have already done this!", TALKTYPE_ORANGE_1)
end
return 1
end

Credits : Sonical, rep him not me ;<
 
Last edited:
[13/08/2010 15:14:58] [Error - Action Interface]
[13/08/2010 15:14:58] data/actions/scripts/worki.lua
[13/08/2010 15:14:58] Description:
[13/08/2010 15:14:58] (luaGetCreatureStorage) Creature not found

and line to .xml <action uniqueid="14555" event="script" value="worki.lua" /> is good?
 
ofc lol
, try this :
LUA:
local itemi = 2086
local pos1 = {x=2034, y=340, z=7}
local itemi2 = 2090
local pos2 = {x=2035, y=340, z=7}
local storage = 9129  -- quest storage
function onUse(cid, item, frompos, item2, topos)
local queststatus = getPlayerStorageValue(cid,storage)
    local targetItem = getTileItemById(pos1, itemi).uid
        local targetItem2 = getTileItemById(pos2, itemi2).uid
        if queststatus == -1 then
if targetitem > 0 and targetitem2 > 0 then
doRemoveItem(targetItem)
doRemoveItem(targetItem2)
setPlayerStorageValue(cid,49506,1)
doPlayerAddItem(cid, 2087, 1)
doSendMagicEffect(pos1, CONST_ME_FIREAREA)
doSendMagicEffect(pos2, CONST_ME_FIREAREA)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
else
doCreatureSay(cid, "You have to put "..getItemNameById(itemi).." and "..getItemNameById(itemi2).." to the right places!", TALKTYPE_ORANGE_1)
end
else
doCreatureSay(cid, "You have already done this!", TALKTYPE_ORANGE_1)
end
return 1
end
 
Tfs 3.6pl1
[13/08/2010 19:30:06] [Error - Action Interface]
[13/08/2010 19:30:06] data/actions/scripts/worki.lua:onUse
[13/08/2010 19:30:06] Description:
[13/08/2010 19:30:06] data/actions/scripts/worki.lua:11: attempt to compare number with nil
[13/08/2010 19:30:06] stack traceback:
[13/08/2010 19:30:06] data/actions/scripts/worki.lua:11: in function <data/actions/scripts/worki.lua:6>
;/
 
Code:
local item1 = 2086
local pos1 = {x=2034, y=340, z=7}
local item2 = 2090
local pos2 = {x=2035, y=340, z=7}
local storage = 9129 -- quest storage

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) == -1 then
		local a, b = getTileItemById(pos1, item1).uid, getTileItemById(pos2, item2).uid
		if a > 0 and b > 0 then
			doRemoveItem(a)
			doRemoveItem(b)
			setPlayerStorageValue(cid, storage, 1)
			doPlayerAddItem(cid, 2087, 1)
			doSendMagicEffect(pos1, CONST_ME_FIREAREA)
			doSendMagicEffect(pos2, CONST_ME_FIREAREA)
			doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
		else
			doCreatureSay(cid, "You have to put "..getItemNameById(item1).." and "..getItemNameById(item2).." to the right places!", TALKTYPE_ORANGE_1, false, cid)
		end
	else
		doCreatureSay(cid, "You have already done this!", TALKTYPE_ORANGE_1, false, cid)
	end
	return true
end
 
Back
Top