Postado Fevereiro 10, 2015 10 anos Autor Voce editou de novo foi? Pq eu testei o primeiro, mas ai quando eu falo /eventbag on, não acontece nada. Se tiver editado eu testo de novo. OK, posso espera ate amanha... Editado Fevereiro 10, 2015 10 anos por Storm Night (veja o histórico de edições) "O sucesso é uma consequência e não um objetivo. A persistência é o caminho do êxito".
Postado Fevereiro 10, 2015 10 anos Sim, eu editei e agora ele abre e fecha certinho, porém ainda falta arrumar a questão da storage, assim que voltar do almoço vou tentar . --[[ CRIADO POR xBlackWolf para duvida no TibiaKING ]]-- function onSay(cid, words, param, channel) if(param == "") then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true end local teleportPos = {x = 992, y = 1167, z = 7, stackpos = 1} -- onde vai criar tp local storageOn = 0000 -- storage que vai salvar se o evento está rolando ou não local q1 = getThingfromPos(teleportPos) local storageEnter = 0002 if(param == "on" and getGlobalStorageValue(storageOn) ~= 1) then broadcastMessage('Evento de Backpack começou! Entre no Teleport no templo, depois de entrar não poderá entrar nomante.', MESSAGE_STATUS_CONSOLE_RED) doSetItemActionId(doCreateItem(1387, 1, teleportPos), 0001) -- actionID que terá no teleport setGlobalStorageValue(storageOn,1) end if(param == "off" and getGlobalStorageValue(storageOn) == 1) then if(doRemoveItem(q1.uid, 1) == true) then broadcastMessage('Evento acabou!', MESSAGE_STATUS_CONSOLE_RED) setGlobalStorageValue(storageOn, 0) -- altere para o valor da storage que vai salvar se o player entrou ou não, deverá ser o mesmo que o movements db.executeQuery("UPDATE `player_storage` SET `value`='0' WHERE `key` = '0002';") end end return true end Seguinte, fiz um globalevent aqui, que se você desligar o evento e o player deslogar, ele vai perder a storage e qnd vc abrir o evento de novo, ele vai poder entrar no evento. Então, se você for fazer por exemplo esse evento a cada algumas horas, se o cara não morrer nem deslogar, ele não vai conseguir entrar de novo no evento, acho bem dificil alguem n deslogar em algumas horas, seja por morte, ou sei la... assim, se alguem reclamar que não consegue entrar é só você avisar para relogarem. =)) Em Globalevents\scripts adicione um arquivo.lua com nome a definir, e adicione dentro: --[[ CRIADO POR xBlackWolf para duvida no TibiaKING ]]-- function onThink(cid, interval, lastExecution) local storageEnter = 0002 local storageOn = 0000 if(getGlobalStorageValue(storageOn) == 0)then db.executeQuery("UPDATE `player_storage` SET `value`='0' WHERE `key` = '0002';") end return TRUE end Em globalevents.xml adicione: <globalevent name="bagevent" interval="300" script="arquivo.lua" /> O intervalo tem que ser pequeno mesmo, porque ai será praticamente no mesmo instante que o player deslogar. Espero que ajude, agora só falta o talkation para teleportar se estiver de longe. Te pergunto, posso colocar para teleportar para perto do TP, ao invez de ir direto para o evento ? Porque acho que vamos enfrentar o mesmo problema... Ja retorno com o outro evento. Editado Fevereiro 10, 2015 10 anos por xBlackWolf (veja o histórico de edições) xBlackWolf THX @Storm Night Best Avatar Ever
Postado Fevereiro 10, 2015 10 anos Autor Espero que ajude, agora só falta o talkation para teleportar se estiver de longe. Te pergunto, posso colocar para teleportar para perto do TP, ao invez de ir direto para o evento ? Porque acho que vamos enfrentar o mesmo problema... Ja retorno com o outro evento. Ss, o que for melhor para você ja esta muito bom... Se precisar de uma foto de perfil para imitar um pouco o xwhitewolf, eu posso tentar fazer... edit: Testei esse novo script, mas tem 3 erros. 1°: 2°: Aparece o portal no Templo mas ele não esta teleportando. 3° Quando eu falo /eventbag off, o evento e o portal não fecha e nem desaparece, na verdade não acontece nada e não da nenhum erro. Editado Fevereiro 10, 2015 10 anos por Storm Night (veja o histórico de edições) "O sucesso é uma consequência e não um objetivo. A persistência é o caminho do êxito".
Postado Fevereiro 10, 2015 10 anos Solução Talkaction: Tag: <talkaction words="/eventbag;/bag;/enceventbag" event="script" value="nome_do_arquivo.lua"/> Código: local config = { tp = { pos = {x = x, y = y, z = z}, --Onde o teleporte será criado. toPos = {x = x, y = y, z = z}, --Para onde jogador será teleportado ao usar o comando /bag. tpId = 1328, --Id do teleporte. aid = 91801, }, storages = { event_storage = 8591, storage = 9591, }, groupId = 6, --Group ID mínimo para abrir o evento. } function onSay(cid, words) if words == "/eventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) > -1 then return doPlayerSendCancel(cid, "The event is already openned.") end setGlobalStorageValue(config.storages.event_storage, 1) local item = doCreateItem(config.tp.tpId, 1, config.tp.pos) doItemSetAttribute(item, "aid", config.tp.aid) broadcastMessage("The bag event is open! You can enter only 1 time, then good luck!") elseif words == "/bag" then if getPlayerStorageValue(cid, config.storages.storage) > -1 then return doPlayerSendCancel(cid, "You already got into the event.") elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") doTeleportThing(cid, config.tp.toPos) setPlayerStorageValue(cid, config.storages.storage, 1) elseif words == "/enceventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end local teleport = getTileItemById(config.tp.pos, config.tp.tpId).uid if teleport and teleport > 0 then doRemoveItem(teleport) end for _, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, config.storages.storage) > -1 then setPlayerStorageValue(pid, config.storages.storage, -1) end end db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages.storage.." AND value > -1") setGlobalStorageValue(config.storages.event_storage, -1) broadcastMessage("The bag event is closed!") end return true end Movement: Tag: <movevent type="StepIn" actionid="91801" event="script" value="nome_do_arquivo.lua"/> Código: local config = { toPos = {x = x, y = y, z = z}, --Para onde o teleporte levará. event_storage = 8591, storage = 9591, } function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true elseif getGlobalStorageValue(config.event_storage) < 1 then return doPlayerSendCancel(cid, "The event is closed.") and doTeleportThing(cid, fromPosition) elseif getPlayerStorageValue(cid, config.storage) > -1 then return doPlayerSendCancel(cid, "You can't go to the event.") and doTeleportThing(cid, fromPosition) end doTeleportThing(cid, config.toPos) doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") setPlayerStorageValue(cid, config.storage, 1) return true end Editado Fevereiro 10, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Fevereiro 10, 2015 10 anos Autor Talkaction: Tag: <talkaction words="/eventbag;/bag;/enceventbag" event="script" value="nome_do_arquivo.lua"/> Código: local config = { tp = { pos = {x = x, y = y, z = z}, --Onde o teleporte será criado. toPos = {x = x, y = y, z = z}, --Para onde jogador será teleportado ao usar o comando /bag. tpId = 1328, --Id do teleporte. aid = 91801, }, storages = { event_storage = 8591, storage = 9591, }, groupId = 6, --Group ID mínimo para abrir o evento. } function onSay(cid, words) if words == "/eventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) > -1 then return doPlayerSendCancel(cid, "The event is already openned.") end setGlobalStorageValue(config.storages.event_storage, 1) local item = doCreateItem(config.tp.tpId, 1, config.tp.pos) doItemSetAttribute(item, "aid", config.tp.aid) broadcastMessage("The bag event is open! You can enter only 1 time, then good luck!") elseif words == "/bag" then if getPlayerStorageValue(cid, config.storages.storage) > -1 then return doPlayerSendCancel(cid, "You already got into the event.") elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") doTeleportThing(cid, config.tp.toPos) setPlayerStorageValue(cid, config.storages.storage, 1) elseif words == "/enceventbag" then if getPlayerGroupId(cid) < config.groupId then return false elseif getGlobalStorageValue(config.storages.event_storage) < 1 then return doPlayerSendCancel(cid, "The event isn't open.") end local teleport = getTileItemById(config.tp.pos, config.tp.tpId).uid if teleport and teleport > 0 then doRemoveItem(teleport) end for _, pid in pairs(getPlayersOnline()) do if getPlayerStorageValue(pid, config.storages.storage) > -1 then setPlayerStorageValue(pid, config.storages.storage, -1) end end db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages.storage.." AND value > -1") setGlobalStorageValue(config.storages.event_storage, -1) broadcastMessage("The bag event is closed!") end return true end Movement: Tag: <movevent type="StepIn" actionid="91801" event="script" value="nome_do_arquivo.lua"/> Código: local config = { toPos = {x = x, y = y, z = z}, --Para onde o teleporte levará. event_storage = 8591, storage = 9591, } function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return true elseif getGlobalStorageValue(config.event_storage) < 1 then return doPlayerSendCancel(cid, "The event is closed.") and doTeleportThing(cid, fromPosition) elseif getPlayerStorageValue(cid, config.storage) > -1 then return doPlayerSendCancel(cid, "You can't go to the event.") and doTeleportThing(cid, fromPosition) end doTeleportThing(cid, config.toPos) doPlayerSendTextMessage(cid, 27, "You were teleported to the event.") setPlayerStorageValue(cid, config.storage, 1) return true end Vlw amno tu é muito foda, fez certinho como eu queria sem nenhum erro. Poxaa tu é zikaaa!! @xBlackWolf Fiz uma foto de perfil para você: 200x350px 598x682px Se gostar avisa, se não falar por favor... "O sucesso é uma consequência e não um objetivo. A persistência é o caminho do êxito".
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.