Erroare FUNCTION get_win()

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Închis
Avatar utilizator
wgaming
Nou Venit

Nou Venit
Mesaje: 14
Membru din: 08 Iul 2018, 17:18
Regat: Chunjo
Aprecieri: 1  
Mulţumiri: 1  
Medalii

*Problemă/Întrebare: Priemsc erroare asta cand compilez quest Erroare FUNCTION get_win()
Tipologie server:Pvm
*Resursă folosită: -
*ServerFiles utilizat: Mega Release
*Syserr: -
Poză:-
*Detalii suplimentare: Cand vreau sa compilez questul, primesc erroarea aia sau daca este o erroare
adica: FUNCTION get_win().
Am adaugat FUNCTION get_win() in quest_functions dar aceas problema. Si mai am aceas problema la un quest pt dojang.
Primesc:

Cod: Selectaţi tot

FUNCTION fight_playerless()
FUNCTION init_next_round()
FUNCTION distribute_bets(winner_name)
FUNCTION give_jackpot_gold(name,amount)
FUNCTION local_pc_warp(name,x,y)
FUNCTION setqf_by_name(name,flag,value)
FUNCTION getqf_by_name(name,flag)
FUNCTION get_attender_id_by_name(name)
FUNCTION get_my_attender_id()
FUNCTION get_duel_partner()
FUNCTION get_fight_mode()
FUNCTION set_fight_mode(fmode)
FUNCTION get_arena()
FUNCTION set_arena(id)
FUNCTION ask_fight(asker,target)

Are cineva idee cum le pot rezolva sa pot compila questul si sa il folosesc?[/b]
Avatar utilizator
[ATR]
Membru Club

Membru Club
Mesaje: 373
Membru din: 08 Sep 2019, 19:06
Server: n am
Regat: Shinsoo
Aprecieri: 164  
Mulţumiri: 1236  
Discord: Copiază ID
 Contact:
Medalii

incearca acest quest

Cod: Selectaţi tot

quest pvp_manager begin
	state start begin
		when login with game.get_event_flag("budokan_open") > 0 and pc.get_map_index() != 112 begin
			q.set_icon("scroll_open_blue.tga")
			send_letter("*Intra la Dojang")
		end
		        when button or info begin
                        say_title("Turneul Dojang")
			say("")
			if game.get_event_flag("budokan_open") == 2 then
				say("Arena pentru Turneul Dojang este acum deschisa!")
				say("")
				say("Alatura-te si tu pentru a lupta in ring ")
				say("contra celorlalti jucatori intr-o lupta")
				say("pentru glorie, onoare si faima!")
				say("")
				local s = select("Du-ma acolo acum!","Nu multumesc.")
				if s == 1 then
					pc.warp(857300, 4400)
				end
			else
				say("Arena Dojang se va deschide in curand.")
				say("")
				say("Alatura-te si tu pentru a lupta in ring ")
				say("contra celorlalti jucatori intr-o lupta")
				say("pentru glorie, onoare si faima!")
				say("")
				say("Cand intrarea va fii deschisa, vei putea intra ")
				say("folosind aceast quest. Pregateste-ti echipamentul!")
				say("")
				local s = select("Voi fii pregatit!", "Voi urmarii ca spectator.")
				if s == 1 then
					return
				end

				say_title("Turneul Dojang")
				say("")
				say("Alege o actiune:")
				say("")
				ttype = select("Turneul Dojang : Deschidere", "Inchide")
				if ttype == 5 then
					return
				end

				pvp_manager.say_hof(ttype)
			end
		end

		when login with pc.get_map_index() == 112 and (pvp_attenders == nil or pvp_attenders[pvp_manager.get_my_attender_id()] == nil or (pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2)) begin
			if party.is_party() then
				party.remove_player()
			end

			if pvp_attenders == nil then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
				return
			end

			if pvp_attenders[pvp_manager.get_my_attender_id()] == nil then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
				return
			end

			if pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2 then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
			end
		end
		
		when pvp_guard_1.timer begin
			if pc.get_map_index() != 112 then
				return
			end
			pvp_manager.guard_check_position()
			timer("pvp_guard_2", 20)
		end
		when pvp_guard_2.timer begin
			if pc.get_map_index() != 112 then
				return
			end
			pvp_manager.guard_check_position()
			timer("pvp_guard_1", 20)
		end
		function guard_check_position()
			if pc.get_local_x() >= 84 and pc.get_local_y() >= 84 and pc.get_local_x() <= 116 and pc.get_local_y() <= 116 then --arena 1
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 84 and pc.get_local_y() >= 136 and pc.get_local_x() <= 116 and pc.get_local_y() <= 168 then --arena 2
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 136 and pc.get_local_y() >= 84 and pc.get_local_x() <= 168 and pc.get_local_y() <= 116 then --arena 3
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 136 and pc.get_local_y() >= 136 and pc.get_local_x() <= 168 and pc.get_local_y() <= 168 then --arena 4
				pvp_manager.guard_reset()
			end
		end
		
		function guard_reset()
			notice_in_map("AUTOPVP-GUARD: "..pc.getname().." a fost eliminat din arena.")
			pc.warp_local(pc.get_map_index(), 1112*100, 24*100)
		end
		
		when 20088.chat."Inchide Arena PvP" with pc.is_gm() and pc.get_map_index() == 112 begin
			say_title("Dojang:")
			say("Intarea in aceasta mapa este acum inchisa")
			say("iar fiecare jucator va fii teleportat in oras...")
			say("")
			warp_all_to_village( pc.get_map_index() , 1 )
			game.set_event_flag("budokan_open", 0)
		end
		
		when 20088.chat."Inapoi in oras" with pc.get_map_index() == 112 begin
			say_title("Maestrul Bataliilor")
			say("")
			say("Doresti sa parasesti arena si sa te intorci ")
			say("acasa, in oras?")
			say("")
			local s = select("Da", "Nu")
			if s == 1 then
				warp_to_village()
			end
		end

		when 20088.chat."GM: Intrerupe Turneul PvP" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") != 0 begin
			say_title("Intrerupe Turneul PvP")
			say("")
			say("Chiar doresti sa intrerupi Turneul PvP?")
			say("")
			local s = select("Da", "Nu")
			if s == 1 then
				game.set_event_flag("pvp", 0)
				pvp_attenders = nil
				notice_all("Turneul Dojang a fost anulat.")
				say_title("Turneu Dojang anulat!")
				say("Turneul Dojang a fost anulat.")
				say("")
			end
		end

		when 20088.chat."GM: Incepe Turneul PvP" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") == 0 begin

			local tournament_presets =
			{
			--	Min Lv 		Max Lv 	    Reward vnum 	Reward count
				{98, 		99,			11971,			1 },
			}

			say_title("Incepe Turneul PvP")
			say("")
		    local tournament = select("Turneul Dojang", "Inchide")

			if tournament < 5 then
				prize_vnum = tournament_presets[tournament][4]
				prize_count = tournament_presets[tournament][5]

                game.set_event_flag("pvp_price_vnum", prize_vnum)
				game.set_event_flag("pvp_price_count", prize_count)
				
				say_title("Start PvP-Tournament")
				say("")
				say("Premiul castigatorului va fii "..prize_count.."x "..item_name(prize_vnum))
				say("(vnum: "..prize_vnum..")")
				say("")
			end		

			local s = select("Start now", "Cancel")
			if s == 2 then
				return
			end

			say_title("Incepe Turneul Dojang")
			say("Turneul Dojang a inceput.")
			say("Oricine vrea sa participe se poate")
			say("inscrie aici.")
			say("")
			say("Inscrierile se pot inchide aici.")
	        game.set_event_flag("pvp", 1)
			attender_count = 0
			game.set_event_flag("pvp_tournament", get_global_time())
			pvp_attenders = nil
			pvp_attenders = { }
			
			arena = {
						-- arena 1
						{
							{ 113, 100 },
							{ 88, 100 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 2
						{
							{ 113, 152 },
							{ 88, 152 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 3
						{
							{ 140, 152 },
							{ 164, 152 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 4
						{
							{ 164, 100 },
							{ 140, 100 },
							0,
							"SLEEPING",
							0,
						},
					}
			
			notice_all("Inscrierile pentru Turneul Dojang au fost deschise!")
			notice_all("Castigatorul va primii "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." ca premiu!")
		end
		
		when 20088.chat."Inscrie-te la Turneul PvP" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 1 begin
			say_title(mob_name(,)..":")
			say("")
			if game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") then
				say("Te-ai inscris deja la Turneu.")
				say("")
				return
			end
			----"123456789012345678901234567890123456789012345678901234567890"|

			say("Bun venit la Dojang. In Turneu vei lupta")
			say("impotriva altor jucatori.")
			say("")
			say("Infrange toti participantii pentru a iti primii premiul")
			say("si a iti castiga un loc in Hala Eroilor!")
			say("")
			say("Doresti sa accepti provocarea?)
			say("")
			local s = select("Vreau sa particip!", "Nu am nici o sansa..")
			say_title(mob_name(,)..":")
			say("")
			if s == 1 then
				say("Vei fii chemat cand iti va venii randul, dar ai grija.")
				say("Trebuie sa stai prin preajma, altfel vei fii descalificat.")
				say("")
				say("Mult noroc!")
				say("")
				
				pvp_attenders[attender_count+1] = {name = pc.getname(), level = pc.get_level(), partner = nil, winner = true, fight_mode = 0, arena = 0}
				pc.setqf("attender_id", attender_count+1)
				pc.setqf("pvp_tournament", game.get_event_flag("pvp_tournament"))
				attender_count = attender_count + 1
			elseif s == 2 then
				say("Intr-adevar, pari cam slab.")
				say("Am mai avut cazuri care s-au soldat")
				say("cu moartea la acest turneu.")
				say("")
			end
		end
		
		when ,.chat."Cati participanti sunt?" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") == 1 begin
			say_title("PVP-Tournament")
			say("Deocamdata sunt "..tostring(attender_count).." playeri inscrisi.")
			say("Shall the registration be closed and betting")
			say("Ar trebuii sa incepem?")
			say("")
			local s = select("Inchide inscrierile.", "Continua cu inscrierile.")
			if s == 1 then
				say_title("Inchide inscrierile:")
				say("Inscrierile au fost inchise.")
			    say("")
				game.set_event_flag("pvp", 2)
			end
		end
		    when 20088.chat."Cine participa la turneu?" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 2 begin
			setskin(NOWINDOW)
			chat("Urmatorii playeri sunt participanti ai Turneului:")
			for i = 1, attender_count, 4 do
				local chatline = ""
				for j = i, i + 4, 1 do
					if pvp_attenders[j] != nil then
						chatline = chatline..pvp_attenders[j].name.."	"
					end
				end
				syschat(chatline)
			end
			syschat("In total sunt "..attender_count.." participanti")
		end
		
		when 20088.chat."Cu cine voi concura in runda urmatoare?" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") begin
			say_title(mob_name(,)..":")
			say("")
			if pvp_manager.get_duel_partner() == nil then
				say("Nu este niciun oponent disponibil pentru tine momentan")
				say("")
				say("Daca nu iti vom gasii un adversar, vei avea norocul")
				say("de a trece in runda urmatoare fara sa lupti.")
				say("")
				return
			end
			say("In runda urmatoare vei lupta impotriva lui:")
			say("")
			say_reward(""..pvp_manager.get_duel_partner().."")
			say("")
		end
		
		
		function make_duel_list()
			duel_list = { }
			local i = 0
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
					local partner_id = pvp_manager.findpartner(tostring(pvp_attenders[ai].name))
					if partner_id != nil then
						pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
						pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
						duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
						i = i + 1
					end
				end
			end
			
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
					local partner_id = pvp_manager.findpartner_for_partnerless(tostring(pvp_attenders[ai].name))
					if partner_id != nil then
						pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
						pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
						duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
						i = i + 1
					end
				end
			end
		end
		
		
		function findpartner(name)
			local partner_id = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
				        partner_id = ai
				end
			end
			return tonumber(partner_id)
		end
		
		function findpartner_for_partnerless(name)
			local closest_level = nil
			local partner_id = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
				    end
				end
			end
			return partner_id
		end
		
		function is_player_in_map(name)
			if pc.getname() == name then
				return true
			end
			local myname = pc.getname()
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			if pc.getname() == myname then
				pc.select(t)
				return false
			end
			pc.select(t)
			return true
		end
		
		
		when 20088.chat."GM: Curata arenele" with pc.is_gm() and game.get_event_flag("pvp") == 3 begin
			for aArena = 1, 4, 1 do
				arena[aArena][3] = 0
				arena[aArena][4] = "SLEEPING"
			end
			pvp_manager.refresh_arenas()
		end
		
		-- not working
		--[[
		when 20088.chat."GM: Incheie lupta" with pc.is_gm() and game.get_event_flag("pvp") == 2 begin
			say_title("Incheie lupta:")
			say("In care arena doresti sa inchei lupta?")
			local s = select("Arena 1", "Arena 2", "Arena 3", "Arena 4", "Inapoi")
			
			if s == 5 then
				return
			end
			
			local fighter1 = nil
			local fighter2 = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai].arena == s and pvp_attenders[ai].fight_mode != 0 then
					if fighter1 == nil then
						fighter1 = ai
					else
						fighter2 = ai
					end
				end
			end
			
			if fighter1 == nil then
				say_title("Incheie lupta:")
				say("Nu sunt lupte in desfasurare in aceasta arena.")
				say("")
				return
			end
			
			say_title("Incheie lupta:")
			say("Cine ar trebuii sa fie ales castigator cand lupta in arena "..s.." ")
			say("va trebuii sa fie inchisa?")
			local w = select(tostring(pvp_attenders[fighter1].name), tostring(pvp_attenders[fighter1].name), "Cancel")
			if w == 3 then
				return
			end
			
			if w == 1 then
				pvp_attenders[fighter2].winner = false
				notice_in_map(tostring(pvp_attenders[fighter1].name).." a castigat lupta impotriva lui "..tostring(pvp_attenders[fighter2].name).."!", pc.get_map_index())
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 1112, 234))
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 1112, 24))
			else
				pvp_attenders[fighter1].winner = false
				notice_in_map(tostring(pvp_attenders[fighter2].name).." a castigat lupta impotriva lui "..tostring(pvp_attenders[fighter1].name).."!", pc.get_map_index())
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 1112, 24))
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 1112, 234))
			end
			
			pvp_attenders[fighter1].fight_mode = 0
			pvp_attenders[fighter2].fight_mode = 0
			
			
			arena[s][3] = 0
			pvp_manager.refresh_arenas()
			
			say_title("Incheie lupta:")
			say("Lupta s-a incheiat.")
		end
		--]]
		
		when 20088.chat."GM: Premiul Turneului Dojang" with pc.is_gm() begin
			say_title("Premiu:")
			say("Premiul actual: "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." (vnum: "..game.get_event_flag("pvp_price_vnum")..")")
			say("")
			local s = select("Schimba premiul", "Close")
			if s == 2 then
				return
			end
			say_title("Schimba premiul:")
			say("Introdu codul noului premiu:")
			say("")
			local vnum = input()
			say_title("Schimba premiul:")
			say("Alege cantitatea de premii pe care o va primii castigatorul")
			say("")
			local count = input()
			game.set_event_flag("pvp_price_count", count)
			game.set_event_flag("pvp_price_vnum", vnum)
			say_title("Schimba premiul:")
			say("Premiul a fost schimbat.")
			say("Noul premiu: "..count.."x "..item_name(vnum).." (vnum: "..vnum..")")
			say("")
		end

		
		function refresh_arenas()
			for aArena = 1, 4, 1 do
				if duel_list[duel_list_index] == nil then
					if playerless_mode == true then
						pvp_manager.init_next_round()
					else
						pvp_manager.fight_playerless()
					end
					return
				end
				if arena[aArena][3] == 0 then
					arena[aArena][3] = 1
					pvp_manager.fight_init(duel_list[duel_list_index].fighter_id1, duel_list[duel_list_index].fighter_id2, aArena)
				end
			end
		end
		

		function fight_init(pid1, pid2, arena_id)
			duel_list_index = duel_list_index + 1
			if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid1].name)) == false then
				notice_in_map(tostring(pvp_attenders[pid1].name).." nu este online si a fost descalificat.", pc.get_map_index())
				pvp_attenders[pid1].winner = false
				pvp_attenders[pid2].partner = nil
				arena[arena_id][3] = 0
				pvp_manager.refresh_arenas()
				return
			end
			if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid2].name)) == false then
				notice_in_map(tostring(pvp_attenders[pid2].name).." nu este online si a fost descalificat.", pc.get_map_index())
				pvp_attenders[pid2].winner = false
				pvp_attenders[pid1].partner = nil
				arena[arena_id][3] = 0
				pvp_manager.refresh_arenas()
				return
			end
			
			notice_in_map(tostring(pvp_attenders[pid1].name).." si "..tostring(pvp_attenders[pid2].name).." intrati in ring va rog!", pc.get_map_index())
			
			--[[
			local f1_accept = ask_fight(tostring(pvp_attenders[pid1].name), tostring(pvp_attenders[pid2].name))
			if f1_accept != CONFIRM_OK then
				notice_in_map(tostring(pvp_attenders[pid1].name).." a refuzat lupta impotriva "..tostring(pvp_attenders[pid2].name)..".", pc.get_map_index())
				pvp_attenders[pid1] = nil
				pvp_attenders[pid2].partner = nil
				pvp_manager.refresh_arenas()
				return
			end
			
			local f2_accept = confirm(find_pc_by_name(tostring(pvp_attenders[pid2].name)), "a refuzat lupta impotriva "..tostring(pvp_attenders[pid1].name).. " an?", 15)
			if f2_accept != CONFIRM_OK then
				notice_in_map(tostring(pvp_attenders[pid2].name).." a refuzat lupta impotriva  "..tostring(pvp_attenders[pid1].name)..".", pc.get_map_index())
				pvp_attenders[pid2] = nil
				pvp_attenders[pid1].partner = nil
				pvp_manager.refresh_arenas()
				return
			end
			]]
			
			pvp_attenders[pid1].fight_mode = 1
			pvp_attenders[pid2].fight_mode = 1
			pvp_attenders[pid1].arena = arena_id
			pvp_attenders[pid2].arena = arena_id
			
			
			pvp_manager.local_pc_warp(tostring(pvp_attenders[pid1].name), arena[arena_id][1][1], arena[arena_id][1][2])
			pvp_manager.local_pc_warp(tostring(pvp_attenders[pid2].name), arena[arena_id][2][1], arena[arena_id][2][2])
		end
		
		when login with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 1 begin
			affect.add(apply.MOV_SPEED, -10000, 2)
			affect.add_collect(apply.HP_REGEN, 5000, 30)
			affect.add_collect(apply.SP_REGEN, 5000, 30)
			affect.remove_good()
			affect.remove_bad()
			affect.remove(apply.AFFECT_JUMAGAP) -- Remove "Remove Magic"

			pvp_manager.set_fight_mode(2)
			if arena[pvp_manager.get_arena()][3] == 2 then
				arena[pvp_manager.get_arena()][5] = 30
				loop_timer("fight_start_countdown", 1)
			else
				timer("partner_timeout", 60)
			end
			arena[pvp_manager.get_arena()][3] = 2
		end		
		
		when partner_timeout.timer begin
			if pvp_manager.is_player_in_map(pvp_manager.get_duel_partner()) == true or game.get_event_flag("pvp") != 2 or pvp_manager.get_fight_mode() != 2 then
				return
			end
			pvp_manager.set_fight_mode(3)
			if arena[pvp_manager.get_arena()][3] == 3 then
				return
			end
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pc.getname().." a castigat lupta impotriva lui "..pvp_manager.get_duel_partner().." prin descalificare!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
			pc.warp_local(pc.get_map_index(), 111200, 23400)
		end

		when fight_start_countdown.timer begin
			if arena[pvp_manager.get_arena()][5] == -1 then
				return
			end
			local partner_vid = find_pc_by_name(pvp_manager.get_duel_partner())
			local my_vid = pc.get_vid()
			if arena[pvp_manager.get_arena()][5] == 0 then
				arena[pvp_manager.get_arena()][5] = -1
				--pc.select(partner_vid)
				--command("pvp "..my_vid)
				--pc.select(my_vid)
				--command("pvp "..partner_vid)
				pc.start_duel(partner_vid)
				notice_in_map("Lupta dintre "..pvp_manager.get_duel_partner().." si "..pc.get_name().." incepe!", pc.get_map_index())
				timer("fight_start_countdown_shutdown", 1)
			else
				pc.select(partner_vid)
				if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
					syschat("Lupta incepe in "..tostring(arena[pvp_manager.get_arena()][5]).." secunde.")
				end
				affect.add(apply.MOV_SPEED, -10000, 2)
				pc.select(my_vid)
				if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
					syschat("Lupta incepe in  "..tostring(arena[pvp_manager.get_arena()][5]).." secunde.")
				end
				affect.add(apply.MOV_SPEED, -10000, 2)
				arena[pvp_manager.get_arena()][5] = arena[pvp_manager.get_arena()][5] - 1
			end
		end
		
		when fight_start_countdown_shutdown.timer begin
			cleartimer("fight_start_countdown")
		end
		
		when logout with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 112 and pvp_manager.get_fight_mode() == 2 begin
			pvp_manager.set_fight_mode(3)
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pvp_manager.get_duel_partner().." has won the fight against "..pc.getname().."!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = false
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = true
			
			local target = find_pc_by_name(pvp_manager.get_duel_partner())
			local t = pc.select(target)
			pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
			pc.select(t)
			
			pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 1112, 24)
		end
		
		when kill with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 112 and npc.is_pc() and pvp_manager.get_fight_mode() == 2 begin
			pvp_manager.set_fight_mode(3)
			if arena[pvp_manager.get_arena()][3] == 3 then
				return
			end
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pc.getname().." a castigat lupta impotriva lui "..pvp_manager.get_duel_partner().."!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
			
			pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
			
			timer("fight_end", 5)
		end
		
		when fight_end.timer begin
			pc.warp_local(pc.get_map_index(), 111200, 23400)
			pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 1112, 24)
		end
		
		when letter with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 3 begin
			pvp_manager.set_fight_mode(0)
			
			if pvp_attenders[pvp_manager.get_my_attender_id()].winner == true then
				arena[pvp_manager.get_arena()][3] = 0
				pvp_manager.refresh_arenas()
			end
		end
		
		function fight_playerless()
			for aArena = 1, 4, 1 do
				if arena[aArena][3] != 0 then
					return
				end
			end
			playerless_mode = true

			
			pvp_manager.make_duel_list()
			pvp_manager.refresh_arenas()
		end
		
		function init_next_round()
			for aArena = 1, 4, 1 do
				if arena[aArena][3] != 0 then
					return
				end
			end
			playerless_mode = false
			
			local winner_count = 0
			local winner_id = 0
			for ai = 1, attender_count, 1 do
				pvp_attenders[ai].partner = nil
				pvp_attenders[ai].fight_mode = 0
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true then
					winner_count = winner_count + 1
					winner_id = ai
				end
			end
			
			if winner_count == 1 then
				notice_all(pvp_attenders[winner_id].name.." a castigat Turneul Dojang!")
				notice_all(pvp_attenders[winner_id].name.." primeste "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." ca premiu!")
				
				pvp_manager.distribute_bets(pvp_attenders[winner_id].name)
				
				local target = find_pc_by_name(pvp_attenders[winner_id].name)
				local t = pc.select(target)
				pc.give_item2(game.get_event_flag("pvp_price_vnum"), game.get_event_flag("pvp_price_count"))
				pc.select(t)
				notice_all("Turneul Dojang s-a incheiat.")
				game.set_event_flag("pvp", 0)
				
				if game.get_event_flag("pvp_tournament_type") ~= 0 and game.get_event_flag("pvp_tournament_type") < 5 then
					local player_found = false
					local new_content = ""
					local player_row = "%d\\t%s\\n"

					local f = io.open("data/"..pvp_manager.retrieve_hof_name(game.get_event_flag("pvp_tournament_type")), "r")
					if f ~= nil then
						for line in f:lines() do
							local data = string.split(line, "\\t") --format: [wins] [playername]

							if new_content ~= "" then
								new_content = new_content .. "\\n"
							end

							if tostring(data[2]) == pvp_attenders[winner_id].name and not player_found then
								new_content = new_content .. string.format(player_row, tonumber(data[1]) + 1, pvp_attenders[winner_id].name)
								player_found = true
							else
								new_content = new_content .. line
							end
						end
						f:close()
					end

					if not player_found then
						new_content = new_content .. "\\n" .. string.format(player_row, 1, pvp_attenders[winner_id].name)
					end

					pvp_manager.replace_hof(game.get_event_flag("pvp_tournament_type"), new_content)
				end

				game.set_event_flag("pvp_tournament_type", 0)
				pvp_attenders = nil
				return
			end
			
			pvp_manager.make_duel_list()
			duel_list_index = 0
			if winner_count == 2 then
				notice_all("Runda finala din Turneu incepe acum!")
			elseif winner_count <= 4 then
				notice_all("Runda semi-finala din Turneu incepe acum!")
			else
				notice_all("Urmatoarea runda din Turneu incepe acum!")
			end
			pvp_round_num = pvp_round_num + 1
			pvp_manager.refresh_arenas()
		end
		
		function distribute_bets(winner_name)
			--table.insert(betting_list, {pc.get_name(), bet_amount, player})
			local jackpot = 0
			local jackpot_winner_only = 0
			local winners = 0
			for i = 1, table.getn(betting_list), 1 do
				if betting_list[i][3] == winner_name then
					jackpot_winner_only = jackpot_winner_only + betting_list[i][2]
				end
				jackpot = jackpot + betting_list[i][2]
				winners = winners + 1
			end
			
			for i = 1, table.getn(betting_list), 1 do
				if betting_list[i][3] == winner_name then
					pvp_manager.give_jackpot_gold(betting_list[i][1], math.ceil( (betting_list[i][2] / jackpot_winner_only)*jackpot ))
				end
			end
			
		end
		
		function give_jackpot_gold(name, amount)
			local target = find_pc_by_name(name)
			if target == 0 then
				return
			end
			local t = pc.select(target)
			pc.change_money(amount)
			pc.select(t)
		end
		
		function local_pc_warp(name, x, y)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			pc.warp_local(pc.get_map_index(), x*100, y*100)
			pc.select(t)
		end
		
		function setqf_by_name(name, flag, value)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			pc.setqf(flag, value)
			pc.select(t)
		end
		
		function getqf_by_name(name, flag)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			local rflag = pc.getqf(flag)
			pc.select(t)
			return rflag
		end
		
		function get_attender_id_by_name(name)
			for ai = 1, attender_count, 1 do
				if tostring(pvp_attenders[ai].name) == name then
					return ai
				end
			end
			return 0
		end
		
		function get_my_attender_id()
			return pvp_manager.get_attender_id_by_name(pc.get_name())
		end
		
		function get_duel_partner()
			if pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].partner != nil then
				return pvp_attenders[pvp_manager.get_my_attender_id()].partner
			else
				return nil
			end
		end
		
		function get_fight_mode()
			if pvp_attenders != nil and pvp_manager.get_my_attender_id() != 0 and pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != nil then
				return pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode
			else
				return 0
			end
		end
		
		function set_fight_mode(fmode)
			pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode = fmode
		end
		
		function get_arena()
			return pvp_attenders[pvp_manager.get_my_attender_id()].arena
		end
		
		function set_arena(id)
			pvp_attenders[pvp_manager.get_my_attender_id()].arena = id
		end
		
		function ask_fight(asker, target)
			return confirm(find_pc_by_name(target), "Te vei lupta impotriva "..asker.. "?", 15)
		end
		
		function retrieve_hof_name(tournament_num)
			local names = {"pvp_dojang"}
			return names[tournament_num]
		end

		function replace_hof(tnum, content)
			local f = io.open("data/"..pvp_manager.retrieve_hof_name(tnum), "w+")
			f:write(content)
			f:close()
		end

		function get_hof(tnum, offset, playerAmount)
			local f = io.open("data/"..pvp_manager.retrieve_hof_name(tnum), "r")
			if not f then 
				return function() return nil end 
			end

			local participants = {}
			for line in f:lines() do
				local data = string.split(line, "\t")
				if data[2] ~= nil then
					participants[data[2]] = tonumber(data[1])
				end
			end
			f:close()

			local sorter = function(tb,a,b) return tonumber(tb[b]) < tonumber(tb[a]) end
			return table.sort_by_value(participants, sorter, offset, playerAmount)
		end
		say("")
	end
end
Afișează semnătura
Avatar utilizator
wgaming
Nou Venit

Nou Venit
Mesaje: 14
Membru din: 08 Iul 2018, 17:18
Regat: Chunjo
Aprecieri: 1  
Mulţumiri: 1  
Medalii

Ionut AKA ATR scrie: ↑21 Iun 2020, 04:19 incearca acest quest

Cod: Selectaţi tot

quest pvp_manager begin
	state start begin
		when login with game.get_event_flag("budokan_open") > 0 and pc.get_map_index() != 112 begin
			q.set_icon("scroll_open_blue.tga")
			send_letter("*Intra la Dojang")
		end
		        when button or info begin
                        say_title("Turneul Dojang")
			say("")
			if game.get_event_flag("budokan_open") == 2 then
				say("Arena pentru Turneul Dojang este acum deschisa!")
				say("")
				say("Alatura-te si tu pentru a lupta in ring ")
				say("contra celorlalti jucatori intr-o lupta")
				say("pentru glorie, onoare si faima!")
				say("")
				local s = select("Du-ma acolo acum!","Nu multumesc.")
				if s == 1 then
					pc.warp(857300, 4400)
				end
			else
				say("Arena Dojang se va deschide in curand.")
				say("")
				say("Alatura-te si tu pentru a lupta in ring ")
				say("contra celorlalti jucatori intr-o lupta")
				say("pentru glorie, onoare si faima!")
				say("")
				say("Cand intrarea va fii deschisa, vei putea intra ")
				say("folosind aceast quest. Pregateste-ti echipamentul!")
				say("")
				local s = select("Voi fii pregatit!", "Voi urmarii ca spectator.")
				if s == 1 then
					return
				end

				say_title("Turneul Dojang")
				say("")
				say("Alege o actiune:")
				say("")
				ttype = select("Turneul Dojang : Deschidere", "Inchide")
				if ttype == 5 then
					return
				end

				pvp_manager.say_hof(ttype)
			end
		end

		when login with pc.get_map_index() == 112 and (pvp_attenders == nil or pvp_attenders[pvp_manager.get_my_attender_id()] == nil or (pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2)) begin
			if party.is_party() then
				party.remove_player()
			end

			if pvp_attenders == nil then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
				return
			end

			if pvp_attenders[pvp_manager.get_my_attender_id()] == nil then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
				return
			end

			if pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 1 and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != 2 then
				pvp_manager.guard_check_position()
				timer("pvp_guard_1", 20)
			end
		end
		
		when pvp_guard_1.timer begin
			if pc.get_map_index() != 112 then
				return
			end
			pvp_manager.guard_check_position()
			timer("pvp_guard_2", 20)
		end
		when pvp_guard_2.timer begin
			if pc.get_map_index() != 112 then
				return
			end
			pvp_manager.guard_check_position()
			timer("pvp_guard_1", 20)
		end
		function guard_check_position()
			if pc.get_local_x() >= 84 and pc.get_local_y() >= 84 and pc.get_local_x() <= 116 and pc.get_local_y() <= 116 then --arena 1
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 84 and pc.get_local_y() >= 136 and pc.get_local_x() <= 116 and pc.get_local_y() <= 168 then --arena 2
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 136 and pc.get_local_y() >= 84 and pc.get_local_x() <= 168 and pc.get_local_y() <= 116 then --arena 3
				pvp_manager.guard_reset()
			end
			if pc.get_local_x() >= 136 and pc.get_local_y() >= 136 and pc.get_local_x() <= 168 and pc.get_local_y() <= 168 then --arena 4
				pvp_manager.guard_reset()
			end
		end
		
		function guard_reset()
			notice_in_map("AUTOPVP-GUARD: "..pc.getname().." a fost eliminat din arena.")
			pc.warp_local(pc.get_map_index(), 1112*100, 24*100)
		end
		
		when 20088.chat."Inchide Arena PvP" with pc.is_gm() and pc.get_map_index() == 112 begin
			say_title("Dojang:")
			say("Intarea in aceasta mapa este acum inchisa")
			say("iar fiecare jucator va fii teleportat in oras...")
			say("")
			warp_all_to_village( pc.get_map_index() , 1 )
			game.set_event_flag("budokan_open", 0)
		end
		
		when 20088.chat."Inapoi in oras" with pc.get_map_index() == 112 begin
			say_title("Maestrul Bataliilor")
			say("")
			say("Doresti sa parasesti arena si sa te intorci ")
			say("acasa, in oras?")
			say("")
			local s = select("Da", "Nu")
			if s == 1 then
				warp_to_village()
			end
		end

		when 20088.chat."GM: Intrerupe Turneul PvP" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") != 0 begin
			say_title("Intrerupe Turneul PvP")
			say("")
			say("Chiar doresti sa intrerupi Turneul PvP?")
			say("")
			local s = select("Da", "Nu")
			if s == 1 then
				game.set_event_flag("pvp", 0)
				pvp_attenders = nil
				notice_all("Turneul Dojang a fost anulat.")
				say_title("Turneu Dojang anulat!")
				say("Turneul Dojang a fost anulat.")
				say("")
			end
		end

		when 20088.chat."GM: Incepe Turneul PvP" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") == 0 begin

			local tournament_presets =
			{
			--	Min Lv 		Max Lv 	    Reward vnum 	Reward count
				{98, 		99,			11971,			1 },
			}

			say_title("Incepe Turneul PvP")
			say("")
		    local tournament = select("Turneul Dojang", "Inchide")

			if tournament < 5 then
				prize_vnum = tournament_presets[tournament][4]
				prize_count = tournament_presets[tournament][5]

                game.set_event_flag("pvp_price_vnum", prize_vnum)
				game.set_event_flag("pvp_price_count", prize_count)
				
				say_title("Start PvP-Tournament")
				say("")
				say("Premiul castigatorului va fii "..prize_count.."x "..item_name(prize_vnum))
				say("(vnum: "..prize_vnum..")")
				say("")
			end		

			local s = select("Start now", "Cancel")
			if s == 2 then
				return
			end

			say_title("Incepe Turneul Dojang")
			say("Turneul Dojang a inceput.")
			say("Oricine vrea sa participe se poate")
			say("inscrie aici.")
			say("")
			say("Inscrierile se pot inchide aici.")
	        game.set_event_flag("pvp", 1)
			attender_count = 0
			game.set_event_flag("pvp_tournament", get_global_time())
			pvp_attenders = nil
			pvp_attenders = { }
			
			arena = {
						-- arena 1
						{
							{ 113, 100 },
							{ 88, 100 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 2
						{
							{ 113, 152 },
							{ 88, 152 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 3
						{
							{ 140, 152 },
							{ 164, 152 },
							0,
							"SLEEPING",
							0,
						},
						-- arena 4
						{
							{ 164, 100 },
							{ 140, 100 },
							0,
							"SLEEPING",
							0,
						},
					}
			
			notice_all("Inscrierile pentru Turneul Dojang au fost deschise!")
			notice_all("Castigatorul va primii "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." ca premiu!")
		end
		
		when 20088.chat."Inscrie-te la Turneul PvP" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 1 begin
			say_title(mob_name(,)..":")
			say("")
			if game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") then
				say("Te-ai inscris deja la Turneu.")
				say("")
				return
			end
			----"123456789012345678901234567890123456789012345678901234567890"|

			say("Bun venit la Dojang. In Turneu vei lupta")
			say("impotriva altor jucatori.")
			say("")
			say("Infrange toti participantii pentru a iti primii premiul")
			say("si a iti castiga un loc in Hala Eroilor!")
			say("")
			say("Doresti sa accepti provocarea?)
			say("")
			local s = select("Vreau sa particip!", "Nu am nici o sansa..")
			say_title(mob_name(,)..":")
			say("")
			if s == 1 then
				say("Vei fii chemat cand iti va venii randul, dar ai grija.")
				say("Trebuie sa stai prin preajma, altfel vei fii descalificat.")
				say("")
				say("Mult noroc!")
				say("")
				
				pvp_attenders[attender_count+1] = {name = pc.getname(), level = pc.get_level(), partner = nil, winner = true, fight_mode = 0, arena = 0}
				pc.setqf("attender_id", attender_count+1)
				pc.setqf("pvp_tournament", game.get_event_flag("pvp_tournament"))
				attender_count = attender_count + 1
			elseif s == 2 then
				say("Intr-adevar, pari cam slab.")
				say("Am mai avut cazuri care s-au soldat")
				say("cu moartea la acest turneu.")
				say("")
			end
		end
		
		when ,.chat."Cati participanti sunt?" with pc.get_map_index() == 112 and pc.is_gm() and game.get_event_flag("pvp") == 1 begin
			say_title("PVP-Tournament")
			say("Deocamdata sunt "..tostring(attender_count).." playeri inscrisi.")
			say("Shall the registration be closed and betting")
			say("Ar trebuii sa incepem?")
			say("")
			local s = select("Inchide inscrierile.", "Continua cu inscrierile.")
			if s == 1 then
				say_title("Inchide inscrierile:")
				say("Inscrierile au fost inchise.")
			    say("")
				game.set_event_flag("pvp", 2)
			end
		end
		    when 20088.chat."Cine participa la turneu?" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 2 begin
			setskin(NOWINDOW)
			chat("Urmatorii playeri sunt participanti ai Turneului:")
			for i = 1, attender_count, 4 do
				local chatline = ""
				for j = i, i + 4, 1 do
					if pvp_attenders[j] != nil then
						chatline = chatline..pvp_attenders[j].name.."	"
					end
				end
				syschat(chatline)
			end
			syschat("In total sunt "..attender_count.." participanti")
		end
		
		when 20088.chat."Cu cine voi concura in runda urmatoare?" with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and game.get_event_flag("pvp_tournament") == pc.getqf("pvp_tournament") begin
			say_title(mob_name(,)..":")
			say("")
			if pvp_manager.get_duel_partner() == nil then
				say("Nu este niciun oponent disponibil pentru tine momentan")
				say("")
				say("Daca nu iti vom gasii un adversar, vei avea norocul")
				say("de a trece in runda urmatoare fara sa lupti.")
				say("")
				return
			end
			say("In runda urmatoare vei lupta impotriva lui:")
			say("")
			say_reward(""..pvp_manager.get_duel_partner().."")
			say("")
		end
		
		
		function make_duel_list()
			duel_list = { }
			local i = 0
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
					local partner_id = pvp_manager.findpartner(tostring(pvp_attenders[ai].name))
					if partner_id != nil then
						pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
						pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
						duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
						i = i + 1
					end
				end
			end
			
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].partner == nil and pvp_attenders[ai].winner == true then
					local partner_id = pvp_manager.findpartner_for_partnerless(tostring(pvp_attenders[ai].name))
					if partner_id != nil then
						pvp_attenders[ai].partner = tostring(pvp_attenders[partner_id].name)
						pvp_attenders[partner_id].partner = tostring(pvp_attenders[ai].name)
						duel_list[i] = {fighter_id1 = ai, fighter_id2 = partner_id}
						i = i + 1
					end
				end
			end
		end
		
		
		function findpartner(name)
			local partner_id = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
				        partner_id = ai
				end
			end
			return tonumber(partner_id)
		end
		
		function findpartner_for_partnerless(name)
			local closest_level = nil
			local partner_id = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true and tostring(pvp_attenders[ai].name) != name and pvp_attenders[ai].partner == nil and pvp_manager.is_player_in_map(tostring(pvp_attenders[ai].name)) == true then
				    end
				end
			end
			return partner_id
		end
		
		function is_player_in_map(name)
			if pc.getname() == name then
				return true
			end
			local myname = pc.getname()
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			if pc.getname() == myname then
				pc.select(t)
				return false
			end
			pc.select(t)
			return true
		end
		
		
		when 20088.chat."GM: Curata arenele" with pc.is_gm() and game.get_event_flag("pvp") == 3 begin
			for aArena = 1, 4, 1 do
				arena[aArena][3] = 0
				arena[aArena][4] = "SLEEPING"
			end
			pvp_manager.refresh_arenas()
		end
		
		-- not working
		--[[
		when 20088.chat."GM: Incheie lupta" with pc.is_gm() and game.get_event_flag("pvp") == 2 begin
			say_title("Incheie lupta:")
			say("In care arena doresti sa inchei lupta?")
			local s = select("Arena 1", "Arena 2", "Arena 3", "Arena 4", "Inapoi")
			
			if s == 5 then
				return
			end
			
			local fighter1 = nil
			local fighter2 = nil
			for ai = 1, attender_count, 1 do
				if pvp_attenders[ai].arena == s and pvp_attenders[ai].fight_mode != 0 then
					if fighter1 == nil then
						fighter1 = ai
					else
						fighter2 = ai
					end
				end
			end
			
			if fighter1 == nil then
				say_title("Incheie lupta:")
				say("Nu sunt lupte in desfasurare in aceasta arena.")
				say("")
				return
			end
			
			say_title("Incheie lupta:")
			say("Cine ar trebuii sa fie ales castigator cand lupta in arena "..s.." ")
			say("va trebuii sa fie inchisa?")
			local w = select(tostring(pvp_attenders[fighter1].name), tostring(pvp_attenders[fighter1].name), "Cancel")
			if w == 3 then
				return
			end
			
			if w == 1 then
				pvp_attenders[fighter2].winner = false
				notice_in_map(tostring(pvp_attenders[fighter1].name).." a castigat lupta impotriva lui "..tostring(pvp_attenders[fighter2].name).."!", pc.get_map_index())
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 1112, 234))
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 1112, 24))
			else
				pvp_attenders[fighter1].winner = false
				notice_in_map(tostring(pvp_attenders[fighter2].name).." a castigat lupta impotriva lui "..tostring(pvp_attenders[fighter1].name).."!", pc.get_map_index())
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter1].name, 1112, 24))
				pvp_manager.local_pc_warp(tostring(pvp_attenders[fighter2].name, 1112, 234))
			end
			
			pvp_attenders[fighter1].fight_mode = 0
			pvp_attenders[fighter2].fight_mode = 0
			
			
			arena[s][3] = 0
			pvp_manager.refresh_arenas()
			
			say_title("Incheie lupta:")
			say("Lupta s-a incheiat.")
		end
		--]]
		
		when 20088.chat."GM: Premiul Turneului Dojang" with pc.is_gm() begin
			say_title("Premiu:")
			say("Premiul actual: "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." (vnum: "..game.get_event_flag("pvp_price_vnum")..")")
			say("")
			local s = select("Schimba premiul", "Close")
			if s == 2 then
				return
			end
			say_title("Schimba premiul:")
			say("Introdu codul noului premiu:")
			say("")
			local vnum = input()
			say_title("Schimba premiul:")
			say("Alege cantitatea de premii pe care o va primii castigatorul")
			say("")
			local count = input()
			game.set_event_flag("pvp_price_count", count)
			game.set_event_flag("pvp_price_vnum", vnum)
			say_title("Schimba premiul:")
			say("Premiul a fost schimbat.")
			say("Noul premiu: "..count.."x "..item_name(vnum).." (vnum: "..vnum..")")
			say("")
		end

		
		function refresh_arenas()
			for aArena = 1, 4, 1 do
				if duel_list[duel_list_index] == nil then
					if playerless_mode == true then
						pvp_manager.init_next_round()
					else
						pvp_manager.fight_playerless()
					end
					return
				end
				if arena[aArena][3] == 0 then
					arena[aArena][3] = 1
					pvp_manager.fight_init(duel_list[duel_list_index].fighter_id1, duel_list[duel_list_index].fighter_id2, aArena)
				end
			end
		end
		

		function fight_init(pid1, pid2, arena_id)
			duel_list_index = duel_list_index + 1
			if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid1].name)) == false then
				notice_in_map(tostring(pvp_attenders[pid1].name).." nu este online si a fost descalificat.", pc.get_map_index())
				pvp_attenders[pid1].winner = false
				pvp_attenders[pid2].partner = nil
				arena[arena_id][3] = 0
				pvp_manager.refresh_arenas()
				return
			end
			if pvp_manager.is_player_in_map(tostring(pvp_attenders[pid2].name)) == false then
				notice_in_map(tostring(pvp_attenders[pid2].name).." nu este online si a fost descalificat.", pc.get_map_index())
				pvp_attenders[pid2].winner = false
				pvp_attenders[pid1].partner = nil
				arena[arena_id][3] = 0
				pvp_manager.refresh_arenas()
				return
			end
			
			notice_in_map(tostring(pvp_attenders[pid1].name).." si "..tostring(pvp_attenders[pid2].name).." intrati in ring va rog!", pc.get_map_index())
			
			--[[
			local f1_accept = ask_fight(tostring(pvp_attenders[pid1].name), tostring(pvp_attenders[pid2].name))
			if f1_accept != CONFIRM_OK then
				notice_in_map(tostring(pvp_attenders[pid1].name).." a refuzat lupta impotriva "..tostring(pvp_attenders[pid2].name)..".", pc.get_map_index())
				pvp_attenders[pid1] = nil
				pvp_attenders[pid2].partner = nil
				pvp_manager.refresh_arenas()
				return
			end
			
			local f2_accept = confirm(find_pc_by_name(tostring(pvp_attenders[pid2].name)), "a refuzat lupta impotriva "..tostring(pvp_attenders[pid1].name).. " an?", 15)
			if f2_accept != CONFIRM_OK then
				notice_in_map(tostring(pvp_attenders[pid2].name).." a refuzat lupta impotriva  "..tostring(pvp_attenders[pid1].name)..".", pc.get_map_index())
				pvp_attenders[pid2] = nil
				pvp_attenders[pid1].partner = nil
				pvp_manager.refresh_arenas()
				return
			end
			]]
			
			pvp_attenders[pid1].fight_mode = 1
			pvp_attenders[pid2].fight_mode = 1
			pvp_attenders[pid1].arena = arena_id
			pvp_attenders[pid2].arena = arena_id
			
			
			pvp_manager.local_pc_warp(tostring(pvp_attenders[pid1].name), arena[arena_id][1][1], arena[arena_id][1][2])
			pvp_manager.local_pc_warp(tostring(pvp_attenders[pid2].name), arena[arena_id][2][1], arena[arena_id][2][2])
		end
		
		when login with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 1 begin
			affect.add(apply.MOV_SPEED, -10000, 2)
			affect.add_collect(apply.HP_REGEN, 5000, 30)
			affect.add_collect(apply.SP_REGEN, 5000, 30)
			affect.remove_good()
			affect.remove_bad()
			affect.remove(apply.AFFECT_JUMAGAP) -- Remove "Remove Magic"

			pvp_manager.set_fight_mode(2)
			if arena[pvp_manager.get_arena()][3] == 2 then
				arena[pvp_manager.get_arena()][5] = 30
				loop_timer("fight_start_countdown", 1)
			else
				timer("partner_timeout", 60)
			end
			arena[pvp_manager.get_arena()][3] = 2
		end		
		
		when partner_timeout.timer begin
			if pvp_manager.is_player_in_map(pvp_manager.get_duel_partner()) == true or game.get_event_flag("pvp") != 2 or pvp_manager.get_fight_mode() != 2 then
				return
			end
			pvp_manager.set_fight_mode(3)
			if arena[pvp_manager.get_arena()][3] == 3 then
				return
			end
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pc.getname().." a castigat lupta impotriva lui "..pvp_manager.get_duel_partner().." prin descalificare!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
			pc.warp_local(pc.get_map_index(), 111200, 23400)
		end

		when fight_start_countdown.timer begin
			if arena[pvp_manager.get_arena()][5] == -1 then
				return
			end
			local partner_vid = find_pc_by_name(pvp_manager.get_duel_partner())
			local my_vid = pc.get_vid()
			if arena[pvp_manager.get_arena()][5] == 0 then
				arena[pvp_manager.get_arena()][5] = -1
				--pc.select(partner_vid)
				--command("pvp "..my_vid)
				--pc.select(my_vid)
				--command("pvp "..partner_vid)
				pc.start_duel(partner_vid)
				notice_in_map("Lupta dintre "..pvp_manager.get_duel_partner().." si "..pc.get_name().." incepe!", pc.get_map_index())
				timer("fight_start_countdown_shutdown", 1)
			else
				pc.select(partner_vid)
				if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
					syschat("Lupta incepe in "..tostring(arena[pvp_manager.get_arena()][5]).." secunde.")
				end
				affect.add(apply.MOV_SPEED, -10000, 2)
				pc.select(my_vid)
				if math.mod(arena[pvp_manager.get_arena()][5], 5) == 0 then
					syschat("Lupta incepe in  "..tostring(arena[pvp_manager.get_arena()][5]).." secunde.")
				end
				affect.add(apply.MOV_SPEED, -10000, 2)
				arena[pvp_manager.get_arena()][5] = arena[pvp_manager.get_arena()][5] - 1
			end
		end
		
		when fight_start_countdown_shutdown.timer begin
			cleartimer("fight_start_countdown")
		end
		
		when logout with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 112 and pvp_manager.get_fight_mode() == 2 begin
			pvp_manager.set_fight_mode(3)
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pvp_manager.get_duel_partner().." has won the fight against "..pc.getname().."!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = false
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = true
			
			local target = find_pc_by_name(pvp_manager.get_duel_partner())
			local t = pc.select(target)
			pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
			pc.select(t)
			
			pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 1112, 24)
		end
		
		when kill with game.get_event_flag("pvp") == 3 and pc.get_map_index() == 112 and npc.is_pc() and pvp_manager.get_fight_mode() == 2 begin
			pvp_manager.set_fight_mode(3)
			if arena[pvp_manager.get_arena()][3] == 3 then
				return
			end
			arena[pvp_manager.get_arena()][3] = 3
			notice_in_map(pc.getname().." a castigat lupta impotriva lui "..pvp_manager.get_duel_partner().."!", pc.get_map_index())
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].fight_mode = 3
			pvp_attenders[pvp_manager.get_my_attender_id()].winner = true
			pvp_attenders[pvp_manager.get_attender_id_by_name(pvp_manager.get_duel_partner())].winner = false
			
			pc.change_gold(game.get_event_flag("pvp_round_gold")*pvp_round_num)
			
			timer("fight_end", 5)
		end
		
		when fight_end.timer begin
			pc.warp_local(pc.get_map_index(), 111200, 23400)
			pvp_manager.local_pc_warp(pvp_manager.get_duel_partner(), 1112, 24)
		end
		
		when letter with pc.get_map_index() == 112 and game.get_event_flag("pvp") == 3 and pvp_manager.get_fight_mode() == 3 begin
			pvp_manager.set_fight_mode(0)
			
			if pvp_attenders[pvp_manager.get_my_attender_id()].winner == true then
				arena[pvp_manager.get_arena()][3] = 0
				pvp_manager.refresh_arenas()
			end
		end
		
		function fight_playerless()
			for aArena = 1, 4, 1 do
				if arena[aArena][3] != 0 then
					return
				end
			end
			playerless_mode = true

			
			pvp_manager.make_duel_list()
			pvp_manager.refresh_arenas()
		end
		
		function init_next_round()
			for aArena = 1, 4, 1 do
				if arena[aArena][3] != 0 then
					return
				end
			end
			playerless_mode = false
			
			local winner_count = 0
			local winner_id = 0
			for ai = 1, attender_count, 1 do
				pvp_attenders[ai].partner = nil
				pvp_attenders[ai].fight_mode = 0
				if pvp_attenders[ai] != nil and pvp_attenders[ai].winner == true then
					winner_count = winner_count + 1
					winner_id = ai
				end
			end
			
			if winner_count == 1 then
				notice_all(pvp_attenders[winner_id].name.." a castigat Turneul Dojang!")
				notice_all(pvp_attenders[winner_id].name.." primeste "..game.get_event_flag("pvp_price_count").."x "..item_name(game.get_event_flag("pvp_price_vnum")).." ca premiu!")
				
				pvp_manager.distribute_bets(pvp_attenders[winner_id].name)
				
				local target = find_pc_by_name(pvp_attenders[winner_id].name)
				local t = pc.select(target)
				pc.give_item2(game.get_event_flag("pvp_price_vnum"), game.get_event_flag("pvp_price_count"))
				pc.select(t)
				notice_all("Turneul Dojang s-a incheiat.")
				game.set_event_flag("pvp", 0)
				
				if game.get_event_flag("pvp_tournament_type") ~= 0 and game.get_event_flag("pvp_tournament_type") < 5 then
					local player_found = false
					local new_content = ""
					local player_row = "%d\\t%s\\n"

					local f = io.open("data/"..pvp_manager.retrieve_hof_name(game.get_event_flag("pvp_tournament_type")), "r")
					if f ~= nil then
						for line in f:lines() do
							local data = string.split(line, "\\t") --format: [wins] [playername]

							if new_content ~= "" then
								new_content = new_content .. "\\n"
							end

							if tostring(data[2]) == pvp_attenders[winner_id].name and not player_found then
								new_content = new_content .. string.format(player_row, tonumber(data[1]) + 1, pvp_attenders[winner_id].name)
								player_found = true
							else
								new_content = new_content .. line
							end
						end
						f:close()
					end

					if not player_found then
						new_content = new_content .. "\\n" .. string.format(player_row, 1, pvp_attenders[winner_id].name)
					end

					pvp_manager.replace_hof(game.get_event_flag("pvp_tournament_type"), new_content)
				end

				game.set_event_flag("pvp_tournament_type", 0)
				pvp_attenders = nil
				return
			end
			
			pvp_manager.make_duel_list()
			duel_list_index = 0
			if winner_count == 2 then
				notice_all("Runda finala din Turneu incepe acum!")
			elseif winner_count <= 4 then
				notice_all("Runda semi-finala din Turneu incepe acum!")
			else
				notice_all("Urmatoarea runda din Turneu incepe acum!")
			end
			pvp_round_num = pvp_round_num + 1
			pvp_manager.refresh_arenas()
		end
		
		function distribute_bets(winner_name)
			--table.insert(betting_list, {pc.get_name(), bet_amount, player})
			local jackpot = 0
			local jackpot_winner_only = 0
			local winners = 0
			for i = 1, table.getn(betting_list), 1 do
				if betting_list[i][3] == winner_name then
					jackpot_winner_only = jackpot_winner_only + betting_list[i][2]
				end
				jackpot = jackpot + betting_list[i][2]
				winners = winners + 1
			end
			
			for i = 1, table.getn(betting_list), 1 do
				if betting_list[i][3] == winner_name then
					pvp_manager.give_jackpot_gold(betting_list[i][1], math.ceil( (betting_list[i][2] / jackpot_winner_only)*jackpot ))
				end
			end
			
		end
		
		function give_jackpot_gold(name, amount)
			local target = find_pc_by_name(name)
			if target == 0 then
				return
			end
			local t = pc.select(target)
			pc.change_money(amount)
			pc.select(t)
		end
		
		function local_pc_warp(name, x, y)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			pc.warp_local(pc.get_map_index(), x*100, y*100)
			pc.select(t)
		end
		
		function setqf_by_name(name, flag, value)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			pc.setqf(flag, value)
			pc.select(t)
		end
		
		function getqf_by_name(name, flag)
			local target = find_pc_by_name(name)
			local t = pc.select(target)
			local rflag = pc.getqf(flag)
			pc.select(t)
			return rflag
		end
		
		function get_attender_id_by_name(name)
			for ai = 1, attender_count, 1 do
				if tostring(pvp_attenders[ai].name) == name then
					return ai
				end
			end
			return 0
		end
		
		function get_my_attender_id()
			return pvp_manager.get_attender_id_by_name(pc.get_name())
		end
		
		function get_duel_partner()
			if pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].partner != nil then
				return pvp_attenders[pvp_manager.get_my_attender_id()].partner
			else
				return nil
			end
		end
		
		function get_fight_mode()
			if pvp_attenders != nil and pvp_manager.get_my_attender_id() != 0 and pvp_attenders[pvp_manager.get_my_attender_id()] != nil and pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode != nil then
				return pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode
			else
				return 0
			end
		end
		
		function set_fight_mode(fmode)
			pvp_attenders[pvp_manager.get_my_attender_id()].fight_mode = fmode
		end
		
		function get_arena()
			return pvp_attenders[pvp_manager.get_my_attender_id()].arena
		end
		
		function set_arena(id)
			pvp_attenders[pvp_manager.get_my_attender_id()].arena = id
		end
		
		function ask_fight(asker, target)
			return confirm(find_pc_by_name(target), "Te vei lupta impotriva "..asker.. "?", 15)
		end
		
		function retrieve_hof_name(tournament_num)
			local names = {"pvp_dojang"}
			return names[tournament_num]
		end

		function replace_hof(tnum, content)
			local f = io.open("data/"..pvp_manager.retrieve_hof_name(tnum), "w+")
			f:write(content)
			f:close()
		end

		function get_hof(tnum, offset, playerAmount)
			local f = io.open("data/"..pvp_manager.retrieve_hof_name(tnum), "r")
			if not f then 
				return function() return nil end 
			end

			local participants = {}
			for line in f:lines() do
				local data = string.split(line, "\t")
				if data[2] ~= nil then
					participants[data[2]] = tonumber(data[1])
				end
			end
			f:close()

			local sorter = function(tb,a,b) return tonumber(tb[b]) < tonumber(tb[a]) end
			return table.sort_by_value(participants, sorter, offset, playerAmount)
		end
		say("")
	end
end
il incerc si revin cu edit.
Dar ma poti ajuta cu asta? FUNCTION get_win()
quest-ul la care primesc: FUNCTION get_win() este

Cod: Selectaţi tot

quest daily_mision_1 begin
	state start begin
		function get_win()
			return ({
						{27992, 2},
						{27993, 2},
						{27994, 2},
						{82800, 2},
						{82801, 2},
						{82802, 2},
						{82803, 2},
						{82804, 2},
						{82805, 2},
						{82806, 2},
						{82807, 2},
						{82808, 2},
						{82809, 2},
						{82810, 2},
						{82811, 2},
						{82812, 2},
						{82813, 2},
						{82814, 2},
						{82815, 10},
						{82816, 2},
						{82817, 2},
						{82818, 2},
						{82819, 2},
						{82820, 2},
						{82821, 2},
						{82822, 2},
						{82823, 2},
						{82824, 2},
						{82825, 2},
						{82826, 2},
						{82827, 2},
						{82828, 2},
						{82829, 2},
						{99990, 2},
						{99991, 2},
						{99992, 2},
						{99993, 2},
						{99994, 2},
						{99995, 2}
					})
		end
		when login begin
			if get_time() > pc.getqf("duration") then
				send_letter("Misiune Zilnica")
			end
		end
		when button or info with get_time() > pc.getqf("duration") begin
		
			data = {
				-- Collect
				{
					{"5 Dinti Orc", 30006, 5},
					{"5 Indrumator de esoterica", 30008, 5},
					{"5 Indrumator de esoterica+", 30078, 5},
					{"5 Medicament necunoscut", 30009, 5},
					{"5 Medicament necunoscut+", 30083, 5},
					{"5 Blana de Yeti", 30014, 5},
					{"5 Blana de Yeti+", 30089, 5},
					{"5 Bile de gheata", 30050, 5},
					{"5 Bile de gheata+", 30090, 5},
					{"5 Suvenir de demoni", 30015, 5},
					{"5 Suvenir de demoni+", 30086, 5},
					{"5 Demon pietre pretioase", 30016, 5},
					{"5 Bijuterie de demon+", 30087, 5},
					{"5 Cozi de sarpe", 30022, 5},
					{"5 Bucata de sesut", 30039, 5},
					{"5 Talismane necunoscute+", 30079, 5},
					{"5 Limbi de broasca", 30060, 5},
					{"5 Simboluri Razboinic", 30091, 5},
					{"5 Foarfeca Scorpion", 30055, 5},
				},
				
				-- Hunt
				{
					{"250 Caini salbatici", 101, 250},
					{"100 Devoti salbatici", 502, 100},
					{"100 Infanteristi salbatici", 501, 100},
					{"5 Capitanii brutali", 591, 5},
					{"75 Orcii negri", 636, 75},
					{"200 Arcas Demon", 1002, 200},
					{"200 Demon Sulitas", 1003, 200},
					{"75 Golemuri de gheata", 1107, 75},
					{"75 Soldat Brotac", 1301, 75},
					{"75 General Brotac", 1302, 75},
					{"5 Miria-Luptator", 1403, 5},
					{"30 Talhar de desert", 2108, 30},
					{"30 Luptator de foc", 2205, 30},
					{"50 Copac Fantoma", 2301, 50},
					{"50 Salcie Fantoma", 2304, 50},
					{"50 Driada Rosie", 2313, 50},
					{"10 Metin Pung-Ma", 8024, 10},
					{"10 Metin Ma-An", 8025, 10},
					{"10 Metin Tu-Young", 8026, 10},
					{"10 Metin Jeon-Un", 8027, 10},
				}
			}
			
			local rnd1 = math.random(1, table.getn(data))
			local rnd2 = math.random(1, table.getn(data[rnd1]))
			
			say_title("Misiune Zilnica")
			if rnd1 == 1 then
				say("Sarcina ta de astazi este o sarcina colectiva")
				say()
				say("Colectarea "..data[rnd1][rnd2][1])
				say("Le poti duce in map 1 la "..mob_name(20354))
				say()
				say("Vrei sa-ti asumi aceasta sarcina?")
				say()
				if select("Da","Nu") == 2 then
					pc.setqf("duration", get_time() + 60*60*24)
					return
				else
					pc.setqf("vnum", data[rnd1][rnd2][2])
					pc.setqf("count", data[rnd1][rnd2][3])
					set_state(collect)
				end
			else
				say("Meseria ta astazi este o misiune de vânatoare")
				say()
				say("Vânatoare "..data[rnd1][rnd2][1])
				say()
				say("Vrei sa-ti asumi aceasta sarcina?")
				say()
				if select("Da","Nu") == 2 then
					pc.setqf("duration", get_time() + 60*60*24)
					return
				else
					pc.setqf("vnum", data[rnd1][rnd2][2])
					pc.setqf("count", data[rnd1][rnd2][3])
					set_state(kill)
				end
			end
		end
	end
	state collect begin
		when 20354.chat."Sarcina colectiva" begin
			say_title("Sarcina colectiva")
			say("Trebuie sa colectati urmatoarele:")
			say_reward(pc.getqf("count").." "..item_name(pc.getqf("vnum")))
			say()
			if pc.count_item(pc.getqf("vnum")) < 1 then
				return
			end
			say("Doriti sa predati articole?")
			say()
			if select("Da","Nu") == 2 then return end
			local c = pc.count_item(pc.getqf("vnum"))
			pc.remove_item(pc.getqf("vnum"), c)
			pc.setqf("done", pc.getqf("done") + c)
			if pc.getqf("done") >= 25 then
				recompensa = daily.get_win()
				local win = math.random(1, table.getn(recompensa))
				say("Mi-ai adus toate articolele")
				say("Deine recompensa:")
				say_reward(recompensa[win][2].." "..item_name(recompensa[win][1]))
				say()
				pc.give_item2(recompensa[win][1], recompensa[win][2])
				pc.setqf("duration", get_time() + 60*60*24)
				set_state(start)
			else
				say_title("Sarcina colectiva")
				say("Bringe mir noch ".. (25 - pc.getqf("done")) .." Items")
				return
			end
			
			--[[
			say_title("Sarcina colectiva")
			if item.get_vnum() == pc.getqf("vnum") then
				local c = item.get_count()
				if c > pc.getqf("count") then
					c = pc.getqf("count")
				end
				pc.setqf("countt", pc.getqf("countt") + c)
				if pc.getqf("countt") >= pc.getqf("count") then
					recompensa = daily.get_win()
					local win = math.random(1, table.getn(recompensa))
					say("Mi-ai adus toate articolele")
					say("Recompensa ta:")
					say_reward(recompensa[win][2].." "..item_name(recompensa[win][1]))
					say()
					pc.give_item2(recompensa[win][1], recompensa[win][2])
					pc.setqf("duration", get_time() + 60*60*24)
					set_state(start)
				else
					say("Adu-mi ".. (pc.getqf("count")- pc.getqf("countt")) .." Items")
					say()
				end
			else
				say("Acest item nu este bun")
				say("Adu-mi "..item_name(pc.getqf("vnum")).." Trimite")
				say()
				return
			end]]
		end
	end
	state kill begin
		when kill begin
			if npc.get_race() == pc.getqf("vnum") then
				pc.setqf("c", pc.getqf("c") + 1)
				if pc.getqf("c") == pc.getqf("count") then
					recompensa = daily.get_win()
					local win = math.random(1, table.getn(recompensa))
					
					say_title("Misiunea de vânatoare")
					say("Ai ucis toti monstrii")
					say("Recompensa ta:")
					say_reward(recompensa[win][2].." "..item_name(recompensa[win][1]))
					say()
					pc.give_item2(recompensa[win][1], recompensa[win][2])
					pc.setqf("duration", get_time() + 60*60*24)
					set_state(start)
				end
			end
		end
	end
end
Avatar utilizator
Asky
Ţepar / Untrusted User

Ţepar / Untrusted User
Mesaje: 1472
Membru din: 08 Oct 2014, 17:32
Regat: Chunjo
Aprecieri: 98  
Mulţumiri: 4811  
Discord: Copiază ID
 Contact:
Medalii

T/C Subiect inactiv mai mult de 5 zile!
Imagine
Afișează semnătura
Închis
Răspunsuri
0
Vizualizări
1069
Răspunsuri
4
Vizualizări
395
Răspunsuri
9
Vizualizări
880
Răspunsuri
5
Vizualizări
1890

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie