Ir para conteúdo

Featured Replies

Postado

Aparentemente, seu servidor não tem o callback onTime. O jeito é fazer por onThink mesmo.

Troca o globalevent por esse:

local time = "19:30"        --Horário que o evento vai começar.
function onThink(interval, lastExecution)
    if isInArray(config.day, os.date("%A")) then
        if os.date("%X") == time..":00" then
            broadcastMessage("The survival event is open! You guys have "..config.time.." minutes to enter.")
            local item = doCreateItem(config.teleport.tpId, 1, config.teleport.createPos)
            doItemSetAttribute(item, "aid", config.aid)
            setGlobalStorageValue(config.storages.global, 1)
            addEvent(function()
                if getGlobalStorageValue(config.storages.global) == 1 then
                    local tp = getTileItemById(config.teleport.createPos, config.teleport.tpId).uid
                    if tp > 0 then
                        doRemoveItem(tp)
                    end
                    if #getPlayersOnEvent() < config.playerCount[1] then
                        broadcastMessage("Not enough players to start the survival event. :/")
                        setGlobalStorageValue(config.storages.global, -1)
                        for i = 1, #getPlayersOnEvent() do
                            setPlayerStorageValue(getPlayersOnEvent()[i], config.storages.storage, -1)
                        end
                        db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storages.storage.." AND value != -1")
                    else
                        broadcastMessage("The survival event will start in "..config.startTime.." seconds.")
                        addEvent(function()
                            broadcastMessage("The survival event started!!!")
                            setGlobalStorageValue(config.storages.global, 2)
                            for i = 1, #getPlayersOnEvent() do
                                doPlayerSetNoMove(getPlayersOnEvent()[i], false)
                            end
                        end, config.startTime * 1000)
                    end
                end
            end, config.time * 60 * 1000)
        end
    end
    return true
end
E a tag por essa:
<globalevent name="Survival" interval="1" event="script" value="nome_do_arquivo.lua"/>

Editado por zipter98 (veja o histórico de edições)

  • Respostas 26
  • Visualizações 32.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Obrigado. c: PS: Não testei. data/lib: config = {     day = {"Saturday"},                       --Dia(s) que ocorrerá o evento.     time = 5,                                 --Tempo de espera de p

  • Você colocou um nome no arquivo diferente do configurado na tag (creaturescript). ;/

Posted Images

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96k
  • Posts 512.7k

Informação Importante

Confirmação de Termo