Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- quest horse_race begin
- state start begin
- when login with pc.getqf("sign") == 1 begin
- if pc.get_map_index() == 61 then
- return
- end
- pc.setqf("sign", 0)
- end
- when 20349.chat."Horce Race - Ranking" begin
- local list = {}--mysql_query("select name,horse_race_won from player.player order by horse_race_won desc, name desc limit 10;")
- list = {
- {"Remix", 893}
- }
- list = list or {}
- say_title("Horse Race - Ranking")
- say("This is the ranking or the horse race")
- say()
- say_reward("Position - Name - Won")
- table.foreach(list, function(i)
- say(i.." - "..list[i][1].." - "..list[i][2])
- end)
- say()
- end
- when 20349.chat."Horse Race - Start Event" with pc.is_gm() begin
- say_title("Horse Race - Start Event")
- say("The horse race is currently "..({"inactive","active","running"})[game.get_event_flag("horse_race")+1])
- say()
- if game.get_event_flag("horse_race") == 0 then
- say("Do you want to start it?")
- say()
- if select("Yes","No") == 2 then return end
- game.set_event_flag("horse_race", 1)
- game.set_event_flag("sign_up", 1)
- horse_race_subscribers = {}
- notice_all("The horse race started")
- notice_all("You have 5 minutes time to sign up at the Stable Boy")
- server_timer("sign_up", 60*5)
- pc.warp(358400, 153600)
- else
- select("Quit")
- end
- end
- when sign_up.server_timer begin
- game.set_event_flag("sign_up", 0)
- end
- when 20349.chat."Horse Race - Sign up" with game.get_event_flag("horse_race") == 1 begin
- say_title("Horse Race - Sign up")
- if pc.is_gm() then
- say("Team members arent able to sign up for the horse race")
- say()
- select("Quit")
- return
- end
- if pc.getqf("sign") == 1 then
- say("You are already signed up")
- else
- say("You want to sign up for the horse race?")
- say()
- if select("Yes","No") == 2 then return end
- pc.setqf("sign", 1)
- chat("You were signed up succesfully")
- chat("Now wait for the start")
- pc.warp(358400, 153600)
- end
- end
- when login with pc.is_gm() and pc.get_map_index() == 61 and game.get_event_flag("horse_race") == 1 and game.get_event_flag("guard_spawn") == 0 begin
- mob.spawn(20349, pc.get_local_x()-5, pc.get_local_y()-5, 1, 1, 1)
- end
- when 20349.chat."Horse Racing - Start Race" with pc.is_gm() and pc.get_map_index() == 61 and game.get_event_flag("horse_race") == 1 begin
- say_title("Start Race")
- say("Do you want to start the race?")
- say()
- if select("Yes","No") == 2 then return end
- server_timer("race_start", 10)
- mob.spawn(20095, 1324, 211, 1, 1, 1)
- notice_all("The race will start in 10 seconds")
- notice_all("Be fast and talk to "..mob_name(20095).." at the end of the map")
- notice_all("Be ready!")
- end
- when race_start.server_timer begin
- game.set_event_flag("horse_race", 2)
- notice_all("The race started! Have fun")
- winner = 0
- end
- when 20095.click with game.get_event_flag("horse_race") == 2 begin
- if pc.getqf("sign") == 1 then
- --[[npc.purge()
- game.set_event_flag("horse_race", 0)
- notice_all(pc.get_name().." has won the race")
- say_title("Congratulation!")
- say("You've won this race")
- game.set_event_flag("sign_up", 0)]]
- winner = winner + 1
- --game.set_event_flag("winner", game.get_event_flag("winner")+1)
- if winner == 1 then
- say_title("Congratulation")
- say("You won the race")
- notice_all(pc.get_name().." has won the race")
- notice_all("Congratulation")
- pc.give_item2(50040, 1)
- elseif winner == 2 then
- say_title("Congratulation")
- say("You reached the second place")
- notice_all(pc.get_name().." has reached the second place")
- notice_all("Congratulations")
- pc.give_item2(50039, 1)
- elseif winner == 3 then
- npc.purge()
- say_title("Congratulation")
- say("You reached the third place")
- notice_all(pc.get_name().." has reached the third place")
- notice_all("Congratulations")
- pc.give_item2(50038, 1)
- game.set_event_flag("horse_race", 0)
- notice_all("The horse race is over now")
- end
- pc.setqf("sign", 0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement