Postado Maio 27, 2015 9 anos galerinha estou fazendo um script para quando player tiver perdido utilizar comando !dp, fiz o script ta tudo certo só gostaria de por uma exhausted de 10 minutos para ser usado comando novamente alguém pode ajudar? creio eu que tenha que utilizar uma storage +ou- assim local STORAGE_IR = 12701 local delay = 1 * 10 local lastUse = getPlayerStorageValue(cid, STORAGE_IR) local ticks = os.time() - lastUse if ticks < delay then return true else setPlayerStorageValue(cid, STORAGE_IR, os.time()) script function onSay(cid, words, param, channel) local tmp = getCreaturePosition(cid) local pos = {x = 162, y = 49, z = 7} local minlevel = 8 local config = { battle = true, } if getPlayerLevel(cid) >= minlevel then if getPlayerSkullType(cid) >= 3 then elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao pode ir para templo com pk, nem com battle.") return true end doTeleportThing(cid, pos, true) doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(pos, CONST_ME_TELEPORT) else doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Você deve ter level ".. minlevel ..".") end return true end Editado Maio 27, 2015 9 anos por loreal (veja o histórico de edições) I like
Postado Maio 27, 2015 9 anos Aqui está: function onSay(cid, words, param, channel) local storage, temp = 343444, 1 -- Storage e tempo. local tmp = getCreaturePosition(cid) local pos = {x = 162, y = 49, z = 7} local minlevel = 8 local config = { battle = true, } if getPlayerStorageValue(cid, storage) < os.time() then if getPlayerLevel(cid) >= minlevel then if getPlayerSkullType(cid) >= 3 then elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao pode ir para templo com pk, nem com battle.") return true end setPlayerStorageValue(cid, storage, temp * 60 + os.time()) doTeleportThing(cid, pos, true) doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(pos, CONST_ME_TELEPORT) else doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Você deve ter level ".. minlevel ..".") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você precisa esperar "..math.ceil((getPlayerStorageValue(cid, storage) - os.time())/60).." minuto(s) para usar novamente.") end return true end ➥ Regras | Seções OTServ | Seções BOT
Postado Maio 28, 2015 9 anos pode ser feito sem storage. use isso para verificar exaust. if exhaustion.get(cid, 502) then doPlayerSendCancel(cid, 'You can use this command only once per 10 minuts.') return true end e ao ser teleportado use isso para adicionar o exaust. exhaustion.set(cid, 502, 600) obg: ja esta certo para os 10 minutos. www.pokemiw.com 24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
Postado Maio 28, 2015 9 anos Autor Em 27/05/2015 em 23:50, Wakon disse: Aqui está: function onSay(cid, words, param, channel) local storage, temp = 343444, 1 -- Storage e tempo. local tmp = getCreaturePosition(cid) local pos = {x = 162, y = 49, z = 7} local minlevel = 8 local config = { battle = true, } if getPlayerStorageValue(cid, storage) < os.time() then if getPlayerLevel(cid) >= minlevel then if getPlayerSkullType(cid) >= 3 then elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Voce nao pode ir para templo com pk, nem com battle.") return true end setPlayerStorageValue(cid, storage, temp * 60 + os.time()) doTeleportThing(cid, pos, true) doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(pos, CONST_ME_TELEPORT) else doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE, "Você deve ter level ".. minlevel ..".") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você precisa esperar "..math.ceil((getPlayerStorageValue(cid, storage) - os.time())/60).." minuto(s) para usar novamente.") end return true end não ta te teletransportando só fica com a mensagem Voce nao pode ir para templo com pk, nem com battle. mesmo eu sem battle I like
Postado Maio 28, 2015 9 anos function onSay(cid, words, param) pos = {x=162, y=49, z=7} local config = { battle = true } if getPlayerLevel(cid) <= 8 then doPlayerSendCancel(cid, 'Você deve ter level 8.') return true end if exhaustion.get(cid, 502) then doPlayerSendCancel(cid, 'Você precisa esperar 10 minutos para usar novamente.') return true end if config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then doPlayerSendCancel(cid, "Voce nao pode ir para templo com pk, nem com battle.") return true end doTeleportThing(cid,pos) exhaustion.set(cid, 502, 600) return true end Editado Maio 28, 2015 9 anos por klipstyle (veja o histórico de edições) www.pokemiw.com 24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
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.