• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[HELP] Snowball Event TFS 1.2

luciano01

New Member
Joined
Aug 6, 2017
Messages
33
Reaction score
1
Snowball Event is giving an error at globalevents when it starts, can someone help me?

I'm using this snowball event

Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/globalevents/scripts/SnowBall_Event.lua:12: bad argument #2 to 'random' (interval is empty)
stack traceback:
[C]: in ?
[C]: in function 'random'
data/globalevents/scripts/SnowBall_Event.lua:12: in function

globalevents/scripts/SnowBall_Event.lua
Lua:
function startGame(rounds)
    if rounds == 0 then
        if #CACHE_GAMEPLAYERS < SnowBall_Configurations.Event_MinPlayers then
            for _, players in ipairs(CACHE_GAMEPLAYERS) do
                Player(players):teleportTo(Player(players):getTown():getTemplePosition())
            end
            broadcastMessage("[Snowball Event]: O evento foi cancelado por conta de não ter no minimo ".. SnowBall_Configurations.Event_MinPlayers.." jogadores.", MESSAGE_EVENT_ADVANCE)
        else
            for _, players in ipairs(CACHE_GAMEPLAYERS) do
                Player(players):setStorageValue(10109, 0)
                Player(players):setStorageValue(10108, SnowBall_Configurations.Ammo_Configurations.Ammo_Start)
                Player(players):teleportTo(CACHE_GAMEAREAPOSITIONS[math.random(1, #CACHE_GAMEAREAPOSITIONS)])
            end
            broadcastMessage("[Snowball Event]: O evento foi fechado. O jogo começou.", MESSAGE_EVENT_ADVANCE)
            addEvent(Event_endGame, SnowBall_Configurations.Event_Duration * 60 * 1000)
        end

        Item(getTileItemById(SnowBall_Configurations.Area_Configurations.Position_EventTeleport, 1387).uid):remove(1)
        Item(getTileItemById(SnowBall_Configurations.Area_Configurations.Position_ExitWaitRoom, 1387).uid):remove(1)
        return true
    end

    if #CACHE_GAMEPLAYERS < SnowBall_Configurations.Event_MinPlayers then
        broadcastMessage("[Snowball Event]: Faltam ".. rounds .. " minuto(s) e " .. SnowBall_Configurations.Event_MinPlayers - #CACHE_GAMEPLAYERS .." jogador(es) para o jogo começar.", MESSAGE_EVENT_ADVANCE)
    else
        broadcastMessage("[Snowball Event]: Faltam ".. rounds .. " minuto(s) para o jogo começar.", MESSAGE_EVENT_ADVANCE)
    end
    return addEvent(startGame, 60 * 1000, rounds - 1)
end

function onTime(interval)
    if not SnowBall_Configurations.Event_Days[os.date("%w") + 1] then
        return true
    end

    CACHE_GAMEPLAYERS = {}

    local EventTeleport = Game.createItem(1387, 1, SnowBall_Configurations.Area_Configurations.Position_EventTeleport)
    EventTeleport:setActionId(10101)

    local ExitWaitRoom = Game.createItem(1387, 1, SnowBall_Configurations.Area_Configurations.Position_ExitWaitRoom)
    ExitWaitRoom:setActionId(10102)

    broadcastMessage("[Snowball Event]: O evento foi aberto, vá até o EVENT ROOM no Dp de Thais para participar.", MESSAGE_EVENT_ADVANCE)
    addEvent(startGame, 60 * 1000, SnowBall_Configurations.Event_WaitGame)
    
    return true
end

Can I change this "math.random" for some other code?
 
Back
Top