Ir para conteúdo
  • 0
Entre para seguir isso  
bitoca1995

Scripting [TFS 0.4 (8.6)] Zombie Event automático

Pergunta

bitoca1995    0
bitoca1995

Boa noite,

Tenho o zombie event em meu servidor funcionando normal, porem ele funciona através da talkaction: /zombiestart, eu queria que esse evento fosse automatico, que começasse todo dia as 18:00 automaticamente, para isso eu sei que precisa de uma globalevent, tentei de tudo e não consegui configurar, será que precisa alterar o script do sistema inteiro para isso? segue o script da talkaction para iniciar o sistema:

Spoiler

function onSay(cid, words, param, channel)
	if(getStorage(ZE_STATUS) ~= 2) then
		local players_on_arena_count = #getZombiesEventPlayers()
		if(param == 'force') then
			if(players_on_arena_count > 0) then
				setZombiesEventPlayersLimit(players_on_arena_count  )
				addZombiesEventBlockEnterPosition()
				doSetStorage(ZE_STATUS, 2)
				doBroadcastMessage("Zombie Arena Event started.")
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event started.")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot start Zombies event. There is no players on arena.")
			end
		else
			if(param ~= '' and tonumber(param) > 0) then
				setZombiesEventPlayersLimit(tonumber(param))
			end
			removeZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Event started.")
			doPlayerBroadcastMessage(cid, "Zombie Arena Event teleport is opened. We are waiting for " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players to start.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event is already running.")
	end
	return true
end

 

e o globalevent: 

Spoiler

function onThink(interval, lastExecution, thinkInterval)
    if(getStorage(ZE_STATUS) == 2) then
        setZombiesToSpawnCount(getZombiesToSpawnCount()+1)
        local players = getZombiesEventPlayers()
        for i=1, getZombiesToSpawnCount() * 2 do
            if(getZombiesToSpawnCount() > 0 and spawnNewZombie()) then
                setZombiesToSpawnCount(getZombiesToSpawnCount()-1)
            end
        end
    end
    return true
end

 

Alguém pode me ajudar por favor?

-Edit

modifiquei a talkaction do evento para globalevent com a função onTime no arquivo ontime.lua e tá funcionando, ele executa na hora certa o evento, porem eu gostaria se possivel que ele avisasse vamos supor as 19:00 que o evento vai começar e as 19:01 ele retirasse a barreira para o evento começar, onde adiciono isso no script:

Spoiler

function onTime()
	if(getStorage(ZE_STATUS) ~= 2) then
		local players_on_arena_count = #getZombiesEventPlayers()
		if (players_on_arena_count > 0) then
			if(players_on_arena_count > 0) then
			removeZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doBroadcastMessage("Zombie Arena Event started.")
			else
			end
		else
			removeZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doBroadcastMessage("Zombie Arena Event started.")
		end
	else
	end
	return true
end

 

Obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

2 respostass a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

@bitoca1995

Não utilizo TFS 0.4 (8.6) e nem qualquer outra versão antiga.

Este é o sistema zombie event que você utiliza né:

https://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/

Tente modificar o talkaction, transforme em globalevent com a função onTime e modifique/retire as funções de talkaction.

Depois em data/globalevents/globalevents.xml:

Adicione:

  <globalevent name="ZombieGlobalOnTime" time= "18:00:00" event="script" value="zombie/ontime.lua"/>

Tem também esse tópico com o sistema:

https://otland.net/threads/zombie-event-without-bugs-work-on-all-tfs.144357/

Dá pra observar os códigos e adaptar para o sistema que está utilizando.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Majesty    1755
Majesty

A questão principal neste tópico de suporte foi respondida e o autor do tópico resolveu a questão. Este tópico está fechado agora. Se você tiver outras perguntas, crie um novo tópico.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×