bpm91
Well-Known Member
hello, I'm trying to make the second seal, but I'm having some problems, when trying to enter the seal without having storage, it says I already have it, and when I go to make the levers the fires disappear. in tfs 0.4 work 100% :/

Lua:
function onStepIn(cid, item, fromPosition, toPosition)
local positionCurrent = {x=32261, y=31856, z=15} -- Posicao para onde o player vai se estiver correto a sequencia
local positionFail = {x=32311, y=31977, z=13} -- Posicao que o player vai se estiver errada a combinacao
--#--Posicões das alavancas--#--
switch1 = {x=32310, y=31975, z=13, stackpos=1}
switch2 = {x=32310, y=31976, z=13, stackpos=1}
switch3 = {x=32312, y=31975, z=13, stackpos=1}
switch4 = {x=32312, y=31976, z=13, stackpos=1}
switch5 = {x=32314, y=31975, z=13, stackpos=1}
switch6 = {x=32314, y=31976, z=13, stackpos=1}
getswitch1 = getThingfromPos(switch1)
getswitch2 = getThingfromPos(switch2)
getswitch3 = getThingfromPos(switch3)
getswitch4 = getThingfromPos(switch4)
getswitch5 = getThingfromPos(switch5)
getswitch6 = getThingfromPos(switch6)
--#--------------------------#--
if isPlayer(cid) then
if getPlayerStorageValue(cid,42500) <= -1 and getswitch1.itemid == 1946 and getswitch2.itemid == 1946 and getswitch3.itemid == 1946 and getswitch4.itemid == 1946 and getswitch5.itemid == 1945 and getswitch6.itemid == 1945 then
doTeleportThing(cid, positionCurrent)
doSendMagicEffect(getThingPos(cid), 11)
setPlayerStorageValue(cid,42500,1)
else
doTeleportThing(cid, positionFail)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already did this seal.")
end
end
return 0
end
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local campfireOn = 1423 -- ID do CampFire Aceso
local campfireOff = 1421 -- ID do CampFire Apagado
local time = 300 -- 60 = 1min -- Tempo para acender denovo
local campfires =
{
-- [UNIQUEID DA ALAVANCA] = {pos = {POSITION DOS FOGOS}}
[42998] = {pos = {x=32309,y=31975,z=13,stackpos=1}}, -- CAMP 1
[42997] = {pos = {x=32309,y=31976,z=13,stackpos=1}}, -- CAMP 2
[42996] = {pos = {x=32311,y=31975,z=13,stackpos=1}}, -- CAMP 3
[42995] = {pos = {x=32311,y=31976,z=13,stackpos=1}}, -- CAMP 4
[42994] = {pos = {x=32313,y=31975,z=13,stackpos=1}}, -- CAMP 5
[42993] = {pos = {x=32313,y=31976,z=13,stackpos=1}} -- CAMP 6
}
local f = function(p)
local alavancaID = getTileItemById(p, 1946).uid
if (alavancaID > 0) then
doTransformItem(getTileItemById(p, 1946).uid, 1945)
doCreateItem(campfireOn, campfires[item.uid].pos)
end
end
if item.itemid == 1946 and campfires[item.uid] and getTileItemById(campfires[item.uid].pos, campfireOff).uid > 0 then
setPlayerStorageValue(cid,32957,1)
doRemoveItem(getTileItemById(campfires[item.uid].pos, campfireOff).uid)
doCreateItem(campfireOn, campfires[item.uid].pos)
doTransformItem(item.uid, item.itemid-1)
stopEvent(e)
else if item.itemid == 1945 and campfires[item.uid] and getTileItemById(campfires[item.uid].pos, campfireOn).uid > 0 then
doRemoveItem(getTileItemById(campfires[item.uid].pos, campfireOn).uid)
doCreateItem(campfireOff, campfires[item.uid].pos)
doTransformItem(item.uid, item.itemid+1)
local e = addEvent(f, time * 1000, fromPosition)
end
end
return 1
end
