Ola galera estou com um problema neste script, o comando de teleporte não esta respondendo as variações da variável i, ou seja, quando uso o item ele sempre me teleporta para a ultima coordenada da variável positions, de resto o script esta todo ok, agradeço a atenção dos que me ajudarem.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local positions = {
{x=160, y=54, z=7},
{x=161, y=54, z=7},
{x=162, y=54, z=7},
{x=163, y=54, z=7},
{x=164, y=54, z=7},
{x=165, y=54, z=7},
{x=166, y=54, z=7},
{x=167, y=54, z=7},
{x=168, y=54, z=7},
{x=169, y=54, z=7}
}
local i = 0
local storage = 159158
local storage1 = 159157
local tempo = 0
if getPlayerStorageValue(cid,storage) >= 1 then
else
setPlayerStorageValue(cid,storage,0)
setPlayerStorageValue(cid,storage1,0)
end
if getPlayerStorageValue(cid,storage) == 0 then
if doPlayerRemoveItem(cid,12689,1) == true then
setPlayerStorageValue(cid,storage,1)
setPlayerStorageValue(cid,storage1,1)
doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, 20*1000))
doCreatureSay(cid, "Humm, esta pérola não parece estar danificada.",1)
doSendMagicEffect(getThingPos(cid), 2)
while i ~= 10 do
tempo = tempo + 2000
i = i + 1
addEvent(function ()
if getPlayerStorageValue(cid,storage) == 1 then
doTeleportThing(cid,positions[i])
doSendMagicEffect(getThingPos(cid), 29)
else
if getPlayerStorageValue(cid,storage1) == 1 then
setPlayerStorageValue(cid,storage1,0)
doRemoveCondition(cid, CONDITION_INFIGHT)
end
end
end
,tempo)
end
addEvent(function()
if getPlayerStorageValue(cid,storage1) == 1 then
setPlayerStorageValue(cid,storage1,0)
setPlayerStorageValue(cid,storage,0)
doRemoveCondition(cid, CONDITION_INFIGHT)
end
end
,tempo)
end
end
end
Sei que o código não esta bem indentado, desculpas.
info
Grupo: Campones
Registrado: 27/08/08
Posts: 57
Reputação: +6
Ola galera estou com um problema neste script, o comando de teleporte não esta respondendo as variações da variável i, ou seja, quando uso o item ele sempre me teleporta para a ultima coordenada da variável positions, de resto o script esta todo ok, agradeço a atenção dos que me ajudarem.
function onUse(cid, item, fromPosition, itemEx, toPosition) local positions = { {x=160, y=54, z=7}, {x=161, y=54, z=7}, {x=162, y=54, z=7}, {x=163, y=54, z=7}, {x=164, y=54, z=7}, {x=165, y=54, z=7}, {x=166, y=54, z=7}, {x=167, y=54, z=7}, {x=168, y=54, z=7}, {x=169, y=54, z=7} } local i = 0 local storage = 159158 local storage1 = 159157 local tempo = 0 if getPlayerStorageValue(cid,storage) >= 1 then else setPlayerStorageValue(cid,storage,0) setPlayerStorageValue(cid,storage1,0) end if getPlayerStorageValue(cid,storage) == 0 then if doPlayerRemoveItem(cid,12689,1) == true then setPlayerStorageValue(cid,storage,1) setPlayerStorageValue(cid,storage1,1) doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, 20*1000)) doCreatureSay(cid, "Humm, esta pérola não parece estar danificada.",1) doSendMagicEffect(getThingPos(cid), 2) while i ~= 10 do tempo = tempo + 2000 i = i + 1 addEvent(function () if getPlayerStorageValue(cid,storage) == 1 then doTeleportThing(cid,positions[i]) doSendMagicEffect(getThingPos(cid), 29) else if getPlayerStorageValue(cid,storage1) == 1 then setPlayerStorageValue(cid,storage1,0) doRemoveCondition(cid, CONDITION_INFIGHT) end end end ,tempo) end addEvent(function() if getPlayerStorageValue(cid,storage1) == 1 then setPlayerStorageValue(cid,storage1,0) setPlayerStorageValue(cid,storage,0) doRemoveCondition(cid, CONDITION_INFIGHT) end end ,tempo) end end endSei que o código não esta bem indentado, desculpas.
Editado Abril 27 por gabisaoo