Olá, alguem poderia me ajudar com um script para mandar mensagem para o player a cada 1 minuto, até ele atingir o level 50!?
Postado em março 11, 2014
Olá, alguem poderia me ajudar com um script para mandar mensagem para o player a cada 1 minuto, até ele atingir o level 50!?
explica mais por favor ...
function onThink(cid, interval) if getPlayerLevel(cid) < 50 then if getPlayerStorageValue(cid, 10203040) - os.time() <= 0 then doPlayerSendTextMessage(cid, 22, "Mensagem aqui.") setPlayerStorageValue(cid, 10203040, os.time()+1*1*60) end end return true end
login.lua :
registerCreatureEvent(cid, "Nome do Evento")
creaturescripts.xml :
<event type="think" name="Nome do Evento" event="script" value="Nome do Arquivo.lua"/>
não conseguir pensar em outra maneira já que a função onThink é executada a cada 500ms .
Ou:
local message = "Mensagem que será enviada ao jogar de 1 em 1 minuto." local function sendMsg(cid) if not isCreature(cid) then return true end doPlayerSendTextMessage(cid, 27, message) addEvent(sendMsg, 1000 * 60, cid) end function onLogin(cid) if getPlayerLevel(cid) < 50 then sendMsg(cid) end return true end
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
O do Duuh funcionou, mas como faço para configurar o tempo?
é o mesmo script só deixei mais fácil pra configurar .
function onThink(cid, interval) local time = 1 -- tempo em minutos if getPlayerLevel(cid) < 50 then if getPlayerStorageValue(cid, 10203040) - os.time() <= 0 then doPlayerSendTextMessage(cid, 22, "Mensagem aqui.") setPlayerStorageValue(cid, 10203040, os.time()+time*1*60) end end return true end
Tópico movido para Pedidos e dúvidas resolvidos.