quest evento_pvp begin
state start begin
function Config()
return
{
["Coordenadas"] = {55500, 55500}, -- Coordenadas do mapa quando você clica no botão Participar
["Index"] = {360}, -- Índice do mapa de eventos
["Vidas"] = {3} -- Vidas dos players
}
end
when 20011.chat."Evento PvP" with game.get_event_flag("eventopvp") == 1 begin
local r = game.get_event_flag("eventopvp2")
if pc.getqf("eventopvp") != r then
pc.setqf("eventopvp", r)
pc.setqf("mortes", 0)
pc.setqf("revisar", 0)
end
if pc.getqf("mortes") >= evento_pvp.Config().Vidas[1] then
say_title(mob_name(20011))
say("")
say("Desculpa, você já esgotou suas "..pvp_event.Config().Lives[1].." vidas. ")
say("")
say("Aguarde para poder participar do próximo evento. ")
say("")
return
end
if select ("Participar", "Sair") == 1 then
pc.warp(evento_pvp.Config().Coordenadas[1],evento_pvp.Config().Coordenadas[2])
end
end
when 20358.chat."GM: Evento PvP " with pc.is_gm() begin
local e = select ("Iniciar evento", "Terminar evento", "Sair")
if e == 1 then
notice_all("O evento pvp começou, vai falar com o Uriel para poder participar. ")
game.set_event_flag("eventopvp", 1)
game.set_event_flag("eventopvp2", game.get_event_flag("eventopvp2") + 1)
elseif e == 2 then
notice_all("O evento pvp terminou. ")
game.set_event_flag("eventopvp", 0)
end
end
when login with pc.get_map_index() == evento_pvp.Config().Index[1] begin
if pc.getqf("mortes") >= evento_pvp.Config().Vidas[1] or game.get_event_flag("eventopvp2") == 0 then
warp_to_village()
return
end
loop_timer("revisar_pvp", 0.5)
end
when revisar_pvp.timer begin
if pc.get_hp() <= 0 and pc.getqf("revisar") == 0 then
pc.setqf("revisar", 1)
local m = pc.getqf("mortes") + 1
pc.setqf("mortes", m)
if m >= evento_pvp.Config().Vidas[1] then
notice_in_map("O usuário "..pc.get_name().." morreu "..m.." vezes e foi desclassificado. ")
cleartimer("revisar_pvp")
warp_to_village()
return
end
chat("Você morreu "..m.." vezes. ")
end
if pc.getqf("revisar") == 1 and pc.get_hp() >= 1 then
pc.setqf("revisar",0)
end
if game.get_event_flag("eventopvp2") == 0 then
cleartimer("revisar_pvp")
warp_to_village()
end
end
end
end