Postado Fevereiro 6, 2015 10 anos Ae galera blz. To com um erro aqui no meu server que é o seguinte, o Player uma uma spell "Hiraishin Seal", nessa spell, cria um item no chao que fica la por 11 segundos, e se o player usa essa spell de novo dentro destes 11 segundos, ele volta na posição que o item fico.. Porem se o Player usa a spell marca o item no chao e morrer, a posição dele fica salva, ou seja ele sempre volta neste local e nao tem como ele usa a spell para criar o item novamnete, ele vai fica teleportando para o local... Segue o script = local config = { storage = 49607, tempo = 11 } local positions = {} function onCastSpell(cid, var) local itemid = math.random (118, 118) if getPlayerStorageValue(cid, config.storage) <= 0 then table.insert(positions, getThingPos(cid)) doPlayerSetStorageValue(cid, config.storage, #positions) doDecayItem(doCreateItem(itemid, getThingPos(cid))) doSendMagicEffect(getThingPos(cid), 3) addEvent(function() if isCreature(cid) then doPlayerSendTextMessage(cid, 22, "Expiro A Hiraishin Kunai.") doPlayerSetStorageValue(cid, config.storage, 0) table.remove(positions, getPlayerStorageValue(cid, config.storage)) end end, 1000*config.tempo) elseif getPlayerStorageValue (cid, config.storage) > 0 then doTeleportThing(cid, positions[getPlayerStorageValue(cid, config.storage)]) doSendMagicEffect(getThingPos(cid), 82) end return true end
Postado Fevereiro 6, 2015 10 anos Cria um arquivo em creaturescripts/scripts e poe dentro: local config = { [1] = {49607} } function onDeath(cid, corpse, deathList) setPlayerStorageValue(cid, config[1], 0) return true end No login.lua: registerCreatureEvent(cid, "onDeathSkill") Em creaturescripts.xml : <event type="death" name="onDeathSkill" event="script" value="arquivo.lua"/> Modifica o arquivo.lua para o nome do arquivo que vc colocou o primeiro código. Imagino que isso vá funcionar, se não funcionar me avisa. xBlackWolf THX @Storm Night Best Avatar Ever
Postado Fevereiro 6, 2015 10 anos Autor Não funcionou Amigo, ele teleporta pa posição mesmo depois de morrer..
Postado Fevereiro 6, 2015 10 anos Ok, vou modificar aguarde Pronto vamos tentar agora rsrs : local config = { storage = 49607, storage2 = 49608, tempo = 11, } local positions = {} function onCastSpell(cid, var) local itemid = math.random (118, 118) if getPlayerStorageValue(cid, config.storage) <= 0 then if(getPlayerStorageValue(cid, config.storage2) == 1)then setPlayerStorageValue(cid, config.storage, 0) table.remove(positions, getPlayerStorageValue(cid, config.storage)) setPlayerStorageValue(cid, config.storage2,0) end if getPlayerStorageValue(cid, config.storage2) == 0 then table.insert(positions, getThingPos(cid)) setPlayerStorageValue(cid, config.storage, #positions) doDecayItem(doCreateItem(itemid, getThingPos(cid))) doSendMagicEffect(getThingPos(cid), 3) setPlayerStorageValue(cid, config.storage2,1) addEvent(function() if isCreature(cid) then doPlayerSendTextMessage(cid, 22, "Expiro A Hiraishin Kunai.") setPlayerStorageValue(cid, config.storage, 0) table.remove(positions, getPlayerStorageValue(cid, config.storage)) setPlayerStorageValue(cid, config.storage2,0) end end, 1000*config.tempo) elseif getPlayerStorageValue (cid, config.storage) > 0 and getPlayerStorageValue(cid, config.storage2) == 1 then doTeleportThing(cid, positions[getPlayerStorageValue(cid, config.storage)]) doSendMagicEffect(getThingPos(cid), 82) setPlayerStorageValue(cid, config.storage2, 0) setPlayerStorageValue(cid, config.storage, 0) table.remove(positions, getPlayerStorageValue(cid, config.storage)) end end return true end local config = { [1] = {49607} , [2] = {49608} } function onDeath(cid, corpse, deathList) setPlayerStorageValue(cid, config[1], 0) setPlayerStorageValue(cid, config[2], 1) return true end Editado Fevereiro 6, 2015 10 anos por xBlackWolf (veja o histórico de edições) xBlackWolf THX @Storm Night Best Avatar Ever
Postado Fevereiro 6, 2015 10 anos @xBlackWolf seria config[1][1] já que você colocou o storage em outra table @Topic vai em creaturescripts/scripts/login.lua e abaixo de: if(accountManager == MANAGER_NONE) then coloca: setPlayerStorageValue(cid,49607, -1)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.