CH
pedido

Mandar MSG até level 50

Por chaduka, 11 de mar. de 2014 em Scripts

msg
mandar msg até level 50
script
6
1.1k
chadukaC
11 de março de 2014 às 15:21

Olá, alguem poderia me ajudar com um script para mandar mensagem para o player a cada 1 minuto, até ele atingir o level 50!?

11 de março de 2014 às 16:17

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 .

Editado Março 11 por DuuhCarvalho

zipter98Z
11 de março de 2014 às 19:25

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
chadukaC
12 de março de 2014 às 16:40

O do Duuh funcionou, mas como faço para configurar o tempo?

12 de março de 2014 às 16:49
Melhor resposta

é 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
3 semanas depois...
28 de março de 2014 às 21:43

Tópico movido para Pedidos e dúvidas resolvidos.