Advertisement
Guest User

Untitled

a guest
May 30th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. quest horse_race begin
  2. state start begin
  3. when login with pc.getqf("sign") == 1 begin
  4. if pc.get_map_index() == 61 then
  5. return
  6. end
  7. pc.setqf("sign", 0)
  8. end
  9. when 20349.chat."Horce Race - Ranking" begin
  10. local list = {}--mysql_query("select name,horse_race_won from player.player order by horse_race_won desc, name desc limit 10;")
  11. list = {
  12. {"Remix", 893}
  13. }
  14. list = list or {}
  15. say_title("Horse Race - Ranking")
  16. say("This is the ranking or the horse race")
  17. say()
  18. say_reward("Position - Name - Won")
  19. table.foreach(list, function(i)
  20. say(i.." - "..list[i][1].." - "..list[i][2])
  21. end)
  22. say()
  23. end
  24. when 20349.chat."Horse Race - Start Event" with pc.is_gm() begin
  25. say_title("Horse Race - Start Event")
  26. say("The horse race is currently "..({"inactive","active","running"})[game.get_event_flag("horse_race")+1])
  27. say()
  28. if game.get_event_flag("horse_race") == 0 then
  29. say("Do you want to start it?")
  30. say()
  31. if select("Yes","No") == 2 then return end
  32. game.set_event_flag("horse_race", 1)
  33. game.set_event_flag("sign_up", 1)
  34. horse_race_subscribers = {}
  35. notice_all("The horse race started")
  36. notice_all("You have 5 minutes time to sign up at the Stable Boy")
  37. server_timer("sign_up", 60*5)
  38. pc.warp(358400, 153600)
  39. else
  40. select("Quit")
  41. end
  42. end
  43. when sign_up.server_timer begin
  44. game.set_event_flag("sign_up", 0)
  45. end
  46. when 20349.chat."Horse Race - Sign up" with game.get_event_flag("horse_race") == 1 begin
  47. say_title("Horse Race - Sign up")
  48. if pc.is_gm() then
  49. say("Team members arent able to sign up for the horse race")
  50. say()
  51. select("Quit")
  52. return
  53. end
  54. if pc.getqf("sign") == 1 then
  55. say("You are already signed up")
  56. else
  57. say("You want to sign up for the horse race?")
  58. say()
  59. if select("Yes","No") == 2 then return end
  60. pc.setqf("sign", 1)
  61. chat("You were signed up succesfully")
  62. chat("Now wait for the start")
  63. pc.warp(358400, 153600)
  64. end
  65. end
  66. 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
  67. mob.spawn(20349, pc.get_local_x()-5, pc.get_local_y()-5, 1, 1, 1)
  68. end
  69. 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
  70. say_title("Start Race")
  71. say("Do you want to start the race?")
  72. say()
  73. if select("Yes","No") == 2 then return end
  74. server_timer("race_start", 10)
  75. mob.spawn(20095, 1324, 211, 1, 1, 1)
  76. notice_all("The race will start in 10 seconds")
  77. notice_all("Be fast and talk to "..mob_name(20095).." at the end of the map")
  78. notice_all("Be ready!")
  79. end
  80. when race_start.server_timer begin
  81. game.set_event_flag("horse_race", 2)
  82. notice_all("The race started! Have fun")
  83. winner = 0
  84. end
  85. when 20095.click with game.get_event_flag("horse_race") == 2 begin
  86. if pc.getqf("sign") == 1 then
  87. --[[npc.purge()
  88. game.set_event_flag("horse_race", 0)
  89. notice_all(pc.get_name().." has won the race")
  90. say_title("Congratulation!")
  91. say("You've won this race")
  92. game.set_event_flag("sign_up", 0)]]
  93. winner = winner + 1
  94. --game.set_event_flag("winner", game.get_event_flag("winner")+1)
  95. if winner == 1 then
  96. say_title("Congratulation")
  97. say("You won the race")
  98. notice_all(pc.get_name().." has won the race")
  99. notice_all("Congratulation")
  100. pc.give_item2(50040, 1)
  101. elseif winner == 2 then
  102. say_title("Congratulation")
  103. say("You reached the second place")
  104. notice_all(pc.get_name().." has reached the second place")
  105. notice_all("Congratulations")
  106. pc.give_item2(50039, 1)
  107. elseif winner == 3 then
  108. npc.purge()
  109. say_title("Congratulation")
  110. say("You reached the third place")
  111. notice_all(pc.get_name().." has reached the third place")
  112. notice_all("Congratulations")
  113. pc.give_item2(50038, 1)
  114. game.set_event_flag("horse_race", 0)
  115. notice_all("The horse race is over now")
  116. end
  117. pc.setqf("sign", 0)
  118. end
  119. end
  120. end
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement