Ir para conteúdo

Featured Replies

Postado

Se alguém poder me ajudar, mostrando qual função que falta o end eu agradeço muito !

 

Globalevents - SnowBall_event.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.")
		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.")
			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.")
	else
		broadcastMessage("[Snowball Event]: Faltam ".. rounds .. " minuto(s) para o jogo começar.")
	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 templo para participar.")
	addEvent(startGame, 60 * 1000, SnowBall_Configurations.Event_WaitGame)
	return true
	loadEvent() -- SnowBall event loader
end

 

Postado

@kuasenada tente assim:

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.")
        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.")
            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.")
    else
        broadcastMessage("[Snowball Event]: Faltam ".. rounds .. " minuto(s) para o jogo começar.")
    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 templo para participar.")
    addEvent(startGame, 60 * 1000, SnowBall_Configurations.Event_WaitGame)
    return true
end

Postado
  • Autor
1 hour ago, igorcano1 said:

@kuasenada tente assim:

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.")
        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.")
            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.")
    else
        broadcastMessage("[Snowball Event]: Faltam ".. rounds .. " minuto(s) para o jogo começar.")
    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 templo para participar.")
    addEvent(startGame, 60 * 1000, SnowBall_Configurations.Event_WaitGame)
    return true
end

Deu certo aqui amigo, vlw !!! você só tirou os espaços né ?

 

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

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 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo