Postado Fevereiro 4, 2015 10 anos Ola galera, eu estou usando o script do Mount System by Matheus, mas tenho o seguinte problema, se o player usa a montaria, desloga, e da o tempo de sair da montaria, aparece um erro no distro falando que não tem um player ou uma criatura para poder executar o script para sair da montaria. Eu queria o seguinte, que se o player usar a montaria, e deslogar, ai ele loga de novo no server, ele ainda fica na montaria, ele só sai dela quando acabar o tempo mesmo. Aqui está a tag do action.xml <action itemid="11191" event="script" value="mount.lua"/> E aqui está o script da mount -- [( Mount System 1.4 created by Matheus for TibiaKing.com )] -- function onUse(cid, item) local outfit = {lookType = 342} -- Outfit da montaria! local exhaust = 30 -- Tempo para player poder usar o item novamente! (tempo em segundos) local time = 60 -- Tempo para ficar na montaria! (tempo em segundos) local speed = 500 -- Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) local mana = 0 -- Quantidade de mana que o player necessita para usar o sistema! local premium = "yes" -- Apenas players premium accounts "yes" or "no"!? local storage = 9393 -- Não mexa aqui! if premium == "yes" and not isPremium(cid) then return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.") end if(getCreatureMana(cid) < mana) then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA) end if (getPlayerStorageValue(cid, storage) <= os.time()) then doCreatureSay(cid, "Yeeeah!!!\nYou went up on his ride.", 19) doSetCreatureOutfit(cid, outfit, time*1000) doChangeSpeed(cid, speed) doSendMagicEffect(getCreaturePosition(cid), 34) setPlayerStorageValue(cid, storage, os.time()+exhaust) doPlayerAddMana(cid, -mana) addEvent(doChangeSpeed, time*1000+40, cid, -speed) addEvent(doPlayerSendTextMessage, time*1000+45, cid, 23, "Mount System is time out!") addEvent(doSendMagicEffect, time*1000+50, getCreaturePosition(cid), 2) else doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") end return TRUE end Por favor me ajudem! Eu só quero que mesmo o player usando a mount, e deslogando, ele não sai ainda da mount. GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Fevereiro 4, 2015 10 anos Solução Troque seu código por esse: -- [( Mount System 1.4 created by Matheus for TibiaKing.com )] -- function onUse(cid, item) local outfit = 342 -- Outfit da montaria! local exhaust = 30 -- Tempo para player poder usar o item novamente! (tempo em segundos) local time = 60 -- Tempo para ficar na montaria! (tempo em segundos) local speed = 500 -- Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) local mana = 0 -- Quantidade de mana que o player necessita para usar o sistema! local premium = true -- Apenas players premium accounts true (sim) ou false (não)!? local storage, storage_time = 9393, 9394 --Não mexa aqui! if premium and not isPremium(cid) then return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.") elseif getCreatureMana(cid) < mana then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA) elseif getPlayerStorageValue(cid, storage) > os.time() then return doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") else doCreatureSay(cid, "Yeeeah!!!\nYou went up on his ride.", 19) doSetCreatureOutfit(cid, {lookType = outfit}, -1) doChangeSpeed(cid, speed) doSendMagicEffect(getCreaturePosition(cid), 34) setPlayerStorageValue(cid, storage, os.time() + exhaust) setPlayerStorageValue(cid, storage_time, os.time() + time) doPlayerAddMana(cid, -mana) addEvent(function() if isPlayer(cid) then doChangeSpeed(cid, -speed) doPlayerSendTextMessage(cid, 23, "Mount System is time out!") doSendMagicEffect(getCreaturePosition(cid), 2) doRemoveCondition(cid, CONDITION_OUTFIT) end end, time * 1000) end return true end Em data/creaturescripts/scripts, crie um arquivo com extensão .lua e adicione o seguinte conteúdo: local cfg = { storage = 9394, speed = 500, --Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) outfit = 342, --Outfit da montaria! } function onLogin(cid) if getPlayerStorageValue(cid, cfg.storage) > os.time() then doSetCreatureOutfit(cid, {lookType = cfg.outfit}, -1) doChangeSpeed(cid, cfg.speed) end return true end Sabe fazer a tag? PS: Não precisa registrar nada em login.lua. Editado Fevereiro 4, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Fevereiro 4, 2015 10 anos O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Scripting → Geral" Para: "OTServ → Suporte OTServ → Suporte de Scripts" Ot Design: https://discord.gg/VgtVRNmCD7
Postado Fevereiro 4, 2015 10 anos Autor Troque seu código por esse: -- [( Mount System 1.4 created by Matheus for TibiaKing.com )] -- function onUse(cid, item) local outfit = 342 -- Outfit da montaria! local exhaust = 30 -- Tempo para player poder usar o item novamente! (tempo em segundos) local time = 60 -- Tempo para ficar na montaria! (tempo em segundos) local speed = 500 -- Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) local mana = 0 -- Quantidade de mana que o player necessita para usar o sistema! local premium = true -- Apenas players premium accounts true (sim) ou false (não)!? local storage, storage_time = 9393, 9394 --Não mexa aqui! if premium and not isPremium(cid) then return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.") elseif getCreatureMana(cid) < mana then return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA) elseif getPlayerStorageValue(cid, storage) > os.time() then return doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") else doCreatureSay(cid, "Yeeeah!!!\nYou went up on his ride.", 19) doSetCreatureOutfit(cid, {lookType = outfit}, -1) doChangeSpeed(cid, speed) doSendMagicEffect(getCreaturePosition(cid), 34) setPlayerStorageValue(cid, storage, os.time() + exhaust) setPlayerStorageValue(cid, storage_time, os.time() + time) doPlayerAddMana(cid, -mana) addEvent(function() if isPlayer(cid) then doChangeSpeed(cid, -speed) doPlayerSendTextMessage(cid, 23, "Mount System is time out!") doSendMagicEffect(getCreaturePosition(cid), 2) doRemoveCondition(cid, CONDITION_OUTFIT) end end, time * 1000) end return true end Em data/creaturescripts/scripts, crie um arquivo com extensão .lua e adicione o seguinte conteúdo: local cfg = { storage = 9394, speed = 500, --Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...) outfit = 342, --Outfit da montaria! } function onLogin(cid) if getPlayerStorageValue(cid, cfg.storage) > os.time() then doSetCreatureOutfit(cid, {lookType = cfg.outfit}, -1) doChangeSpeed(cid, cfg.speed) end return true end Sabe fazer a tag? PS: Não precisa registrar nada em login.lua. Desculpe, não sei qual tag usar... GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Fevereiro 4, 2015 10 anos Sem problemas. Use esta tag: <event type="login" name="mountLogin" event="script" value="xxx.lua"/> Em xxx.lua, você coloca o nome do arquivo.lua. não respondo pms solicitando suporte em programação/scripting
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.