Postado Janeiro 8, 2015 10 anos Pessoal, eu tenho um script de teleport (fly) que ele tem uma contagem regressiva para teletransportar. Espertinhos do meu servidor, soltam o comando (SemBattle), vao pra trap e pegam a battle, então são teleportados (O Script demora 4 segundos para teleportar) eu gostaria de saber, se tem algum modo, de quando o jogador pegar o battle e o Systema ja foi iniciado, a contagem parasse. Script: function onSay(cid, words, param) if getPlayerStorageValue(cid, 822066) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui.") end if getPlayerStorageValue(cid, 1236664) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui.") end if getPlayerStorageValue(cid, 9988124) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui") end local config = { pz = false, -- players precisam estar em protection zone para usar? (true or false) battle = true, -- players deve estar sem battle (true or false) custo = false, -- se os teleport irão custa (true or false) need_level = false, -- se os teleport irão precisar de level (true or false) vip = false, -- somente vip players poderam usar o comando? ("yes" or "no") tempo = 5, storage = 13500 -- Storage Id da sua vip account caso for usar somente vips } --[[ Config lugares]]-- local lugar = { ["depot"] = { -- nome do lugar pos = {x=129, y=53, z=6},level = 8,price = 0}, ["templo"] = { -- nome do lugar pos = {x=160, y=54, z=7},level = 8, price = 0}, ["vip1"] ={ -- nome do lugar pos = {x=1028, y=1034, z=7},level = 8,price = 0}, ["hunts"] ={ -- nome do lugar pos = {x=308, y=196, z=8},level = 8,price = 0}, ["eventos"] ={ -- nome do lugar pos = {x=93, y=184, z=7},level = 8,price = 0}, ["trainer"] ={ -- nome do lugar pos = {x=161, y=49, z=8},level = 8,price = 0} } if (param == "lista") then local str = "" str = str .. "Lista de Lugares :\nDepot\nTemplo\nHunts\nEventos\nTrainer" doShowTextDialog(cid, 6579, str) return TRUE end local a = lugar[param] if not(a) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Desculpe, este lugar não está na lista. Para ver a lista diga !tp lista") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"{Teleport System} Você precisa estar em protection zone pra poder teleportar.") return TRUE elseif config.premium == true and not isPremium(cid) then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Apenas players com premium account podem teleportar.") return TRUE elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "{Teleport System} Você precisa estar sem pz lock para poder se teleportar.") return TRUE elseif config.need_level == true and getPlayerLevel(cid) < a.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.vip == true and getPlayerStorageValue(cid, tonumber(config.storage)) - os.time() <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,voce nao e Player vip Para Usar o !fly!.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE end if os.time() - getPlayerStorageValue(cid, config.storage) >= config.tempo then doPlayerSetStorageValue(cid, config.storage, os.time()) else doPlayerSendCancel(cid, "{Teleport System} Você possui um teleport em andamento.") return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} System Ativado!.") addEvent(doPlayerSendTextMessage, 1000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 3") addEvent(doPlayerSendTextMessage, 2000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 2") addEvent(doPlayerSendTextMessage, 3000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 1") addEvent(doPlayerSendTextMessage, 4000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Teleportado!") addEvent(doTeleportThing, 4000, cid, a.pos) addEvent(doSendMagicEffect, 4000, a.pos, CONST_ME_TELEPORT) return TRUE end [progress=green]50[/progress]
Postado Janeiro 8, 2015 10 anos function onSay(cid, words, param) if getPlayerStorageValue(cid, 822066) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui.") end if getPlayerStorageValue(cid, 1236664) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui.") end if getPlayerStorageValue(cid, 9988124) == 1 then return doPlayerSendCancel(cid, "{Teleport System} O comando não funciona aqui") end local config = { pz = false, -- players precisam estar em protection zone para usar? (true or false) battle = true, -- players deve estar sem battle (true or false) custo = false, -- se os teleport irão custa (true or false) need_level = false, -- se os teleport irão precisar de level (true or false) vip = false, -- somente vip players poderam usar o comando? ("yes" or "no") tempo = 5, storage = 13500 -- Storage Id da sua vip account caso for usar somente vips } --[[ Config lugares]]-- local lugar = { ["depot"] = { -- nome do lugar pos = {x=129, y=53, z=6},level = 8,price = 0}, ["templo"] = { -- nome do lugar pos = {x=160, y=54, z=7},level = 8, price = 0}, ["vip1"] ={ -- nome do lugar pos = {x=1028, y=1034, z=7},level = 8,price = 0}, ["hunts"] ={ -- nome do lugar pos = {x=308, y=196, z=8},level = 8,price = 0}, ["eventos"] ={ -- nome do lugar pos = {x=93, y=184, z=7},level = 8,price = 0}, ["trainer"] ={ -- nome do lugar pos = {x=161, y=49, z=8},level = 8,price = 0} } if (param == "lista") then local str = "" str = str .. "Lista de Lugares :\nDepot\nTemplo\nHunts\nEventos\nTrainer" doShowTextDialog(cid, 6579, str) return TRUE end local a = lugar[param] if not(a) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Desculpe, este lugar não está na lista. Para ver a lista diga !tp lista") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"{Teleport System} Você precisa estar em protection zone pra poder teleportar.") return TRUE elseif config.premium == true and not isPremium(cid) then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Apenas players com premium account podem teleportar.") return TRUE elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "{Teleport System} Você precisa estar sem pz lock para poder se teleportar.") return TRUE elseif config.need_level == true and getPlayerLevel(cid) < a.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE elseif config.vip == true and getPlayerStorageValue(cid, tonumber(config.storage)) - os.time() <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe,voce nao e Player vip Para Usar o !fly!.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return TRUE end if os.time() - getPlayerStorageValue(cid, config.storage) >= config.tempo then doPlayerSetStorageValue(cid, config.storage, os.time()) else doPlayerSendCancel(cid, "{Teleport System} Você possui um teleport em andamento.") return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} System Ativado!.") addEvent(doPlayerSendTextMessage, 1000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 3") addEvent(doPlayerSendTextMessage, 2000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 2") addEvent(doPlayerSendTextMessage, 3000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} 1") addEvent(doPlayerSendTextMessage, 4000, cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Teleportado!") addEvent(function() if getCreatureCondition(cid, CONDITION_INFIGHT) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Cancelado!") doSendMagicEffect(a.pos, CONST_ME_POFF) else doTeleportThing(cid, a.pos) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport System} Teleportado!") doSendMagicEffect(a.pos, CONST_ME_TELEPORT) end end, 4000) return TRUE end Att. Featzen.
Postado Janeiro 8, 2015 10 anos Só umas dicas, que eu vi que estavam faltando. Dentro da array config, não tem a variável "premium", que está regrada nesta parte: elseif config.premium == true and not isPremium(cid) then linha 54 E também nessa parte: if os.time() - getPlayerStorageValue(cid, config.storage) >= config.tempo then doPlayerSetStorageValue(cid, config.storage, os.time()) else doPlayerSendCancel(cid, "{Teleport System} Você possui um teleport em andamento.") return TRUE end Neste caso, ele está usando a mesma storage do sistema vip, com certeza vai dar um conflito entre os sistemas. Procure adicionar uma outra storage só para esta condição. Espero ter ajudado. Editado Janeiro 8, 2015 10 anos por Bruno Minervino (veja o histórico de edições) Atenciosamente, Bruno Minervino
Postado Janeiro 8, 2015 10 anos Amigo, o título do seu tópico estava inadequado. Sem oferecer nenhuma ideia do que ele se trata, poucos vão se interessar em te ajudar. Na próxima vez, crie um tópico com um título que descreva o assunto dele. • 2.3 - Use títulos e ícones adequados: Ao criar um novo tópico no fórum, dê a ele um título que esteja relacionado ao conteúdo do tópico. Títulos como "Ajudaaa!" ou "Entrem aqui!" só pioram as coisas: ninguém vai saber do que se trata, e menos pessoas irão entrar para olhar o que você postou e também evite de usar o CAPSLOCK ao criar seu título. Leia e se preciso, releia as Regras Gerais do fórum. The corrupt fear us. The honest support us. The heroic join us.
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.