Postado Agosto 15, 2019 5 anos @leozincorsair Teste --[[ Tag:Desbugar -- Kyyah Silva ]]-- local STORAGE_EXAUSTED = 91812 local exausted = 120 --Minutos. function onSay(cid, words) local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED) local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or "")) if storage > os.time() then return retorno end local time = 4 -- em segundos 1 = 1 segundo 2 = 2 segundos... local say_events = {} function SayText(cid) if isPlayer(cid) then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) doCreatureSetNoMove(cid, true) end end return true end function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.") return true end if param == "on" then if isPlayer(cid) then doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.") doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off") setPlayerStorageValue(cid, STORAGE_EXAUSTED, os.time()+exausted) else stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.") doCreatureSetNoMove(cid, false) end return true end return true end
Postado Agosto 16, 2019 5 anos Autor 22 horas atrás, ADM Marshmello disse: @leozincorsair Teste --[[ Tag:Desbugar -- Kyyah Silva ]]-- local STORAGE_EXAUSTED = 91812 local exausted = 120 --Minutos. function onSay(cid, words) local storage = getPlayerStorageValue(cid, STORAGE_EXAUSTED) local retorno = doPlayerSendCancel(cid, string.format("Aguarde %d segundo%s para usar este comando novamente.", storage - os.time(), storage - os.time() > 1 and "s" or "")) if storage > os.time() then return retorno end local time = 4 -- em segundos 1 = 1 segundo 2 = 2 segundos... local say_events = {} function SayText(cid) if isPlayer(cid) then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) doCreatureSetNoMove(cid, true) end end return true end function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.") return true end if param == "on" then if isPlayer(cid) then doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.") doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off") setPlayerStorageValue(cid, STORAGE_EXAUSTED, os.time()+exausted) else stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.") doCreatureSetNoMove(cid, false) end return true end return true end mesmo problema, nao funciona diz que tem que esperar tantos tempos .
Postado Agosto 16, 2019 5 anos Solução Quando for um script meu pode me marcar que ajudo na questão. Tem como fazer dessa maneira: Spoiler -- Créditos para Yan Liima - Night criador da script. local time = 4 -- em segundos 1 = 1 segundo 2 = 2 segundos.. local say_events = {} local function SayText(cid) if isPlayer(cid) == TRUE then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) doCreatureSetNoMove(cid, true) end end return TRUE end function onSay(cid, words, param, channel) if exhaustion.check(cid, 15055) == true then doPlayerSendCancel(cid, "Espere alguns segundos para usar esse comando novamente.") return true end if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.") return true end if param == "on" then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.") doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off") elseif param == "off" then stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.") doCreatureSetNoMove(cid, false) end exhaustion.set(cid, 15055, 120) -- storage e segundos return TRUE end Ou assim: -- Créditos para Yan Liima - Night criador da script. local time = 4 -- em segundos 1 = 1 segundo 2 = 2 segundos... local config = { storage = 2193, str_seconds = 120, -- storage e segundos } local say_events = {} local function SayText(cid) if isPlayer(cid) == TRUE then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) doCreatureSetNoMove(cid, true) end end return TRUE end function onSay(cid, words, param, channel) if getPlayerStorageValue(cid, config.storage) > os.time() then return doPlayerSendCancel(cid, "Espere " .. getPlayerStorageValue(cid, config.storage) - os.time() .. " segundos.") end if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Utilize '".. words .. " on' para ligar e '".. words .. " off' para desligar.") return true end if param == "on" then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Treinando", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você está em modo 'Training'.") doPlayerSendTextMessage(cid,20,"Para sair do modo 'training' diga ".. words .. " off") setPlayerStorageValue(cid, config.storage, os.time() + config.str_seconds) -- LINHA QUE ADC A O EXAUSTED, SÓ COPIAR PARA OUTRO LOCAL SE NECESSARIO elseif param == "off" then stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Você não está mais em modo 'Training'.") doCreatureSetNoMove(cid, false) end return TRUE end
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.