Advertisement
captmicro

Untitled

Sep 21st, 2011
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.99 KB | None | 0 0
  1. import es, playerlib, popuplib, gamethread
  2.  
  3. START_POS = "top" #top, default (spawns), or pikachu (middle of spawns)
  4.  
  5. info = es.AddonInfo()
  6. info.name = "SurfTricks Extended"
  7. info.basename = "surftricks_ext"
  8. info.version = "HERPDERPDURR"
  9. info.url = "microvnet.info"
  10. info.description= "SUP3R L33T SURFTR1CKK5 3XT3ND3D"
  11. info.author = "Capt. Micro"
  12. info.contact = "arrowflyer@gmail.com"
  13. info.tags = "surf,tricks,surftricks,race,money"
  14.  
  15. tricklist = {
  16. 'Awp2Awp':{
  17. 'racable':True,
  18. 'prize':500,
  19. },
  20. 'Awp3':{
  21. 'racable':True,
  22. 'prize':500,
  23. },
  24. 'Pikachu Gap':{
  25. 'racable':True,
  26. 'prize':500,
  27. },
  28. 'Tobe Go Home':{
  29. 'racable':True,
  30. 'prize':500,
  31. },
  32. 'Deagle to awp':{
  33. 'racable':True,
  34. 'prize':500,
  35. },
  36. 'T1000':{
  37. 'racable':True,
  38. 'prize':500,
  39. },
  40. 'T1000 to spawn':{
  41. 'racable':True,
  42. 'prize':500,
  43. },
  44. 'T1000 to sign':{
  45. 'racable':True,
  46. 'prize':500,
  47. },
  48. 'Awp4':{
  49. 'racable':True,
  50. 'prize':500,
  51. },
  52. 'Main to sign':{
  53. 'racable':True,
  54. 'prize':500,
  55. },
  56. 'Razor Gap':{
  57. 'racable':True,
  58. 'prize':500,
  59. },
  60. 'Awp To Awp Over Main':{
  61. 'racable':True,
  62. 'prize':500,
  63. },
  64. 'Spawn Hop Ct->T':{
  65. 'racable':True,
  66. 'prize':500,
  67. },
  68. 'Spawn Hop T->Ct':{
  69. 'racable':True,
  70. 'prize':500,
  71. },
  72. 'Nc Waave':{
  73. 'racable':True,
  74. 'prize':500,
  75. },
  76. 'Double Hop':{
  77. 'racable':True,
  78. 'prize':500,
  79. },
  80. 'Chrome Gap':{
  81. 'racable':True,
  82. 'prize':500,
  83. }
  84. }
  85.  
  86. race_start_positions = {
  87. 'default': {
  88. 'player1': (-1073, 232, 6080),
  89. 'player2': (-1073, -232, 6080)
  90. },
  91. 'pikachu': {
  92. 'player1': (-1040, 8.0, 6080.093750),
  93. 'player2': (-1040, -7.9, 6080.093750)
  94. },
  95. 'top': {
  96. 'player1': (-1952, 150, 7272.093750),
  97. 'player2': (-1952, -150, 7272.093750)
  98. },
  99. }
  100.  
  101. race_start_pos = race_start_positions[START_POS]
  102. race_winner_prize = 1500
  103. race_races = []
  104. race_playerselect = None
  105. race_trickselect = None
  106. race_menutmp = {}
  107.  
  108. def race_newrace(userid1, userid2, trick):
  109. global race_races
  110. race_races += [{
  111. 'userid1': str(userid1),
  112. 'userid2': str(userid2),
  113. 'trick': trick,
  114. 'status': 'WAIT'
  115. }]
  116. ply1 = playerlib.getPlayer(userid1)
  117. ply2 = playerlib.getPlayer(userid2)
  118. es.tell(ply2.userid, "#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  119. "[#lightgreen%s vs #lightgreen%s#default] #green%s #defaulthas challenged you to race #green%s #default!"
  120. %(ply1.name,ply2.name,ply1.name,trick))
  121. es.tell(ply2.userid, "#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  122. "[#lightgreen%s vs #lightgreen%s#default] type \"!race accept\" to accept the challenge."
  123. %(ply1.name,ply2.name))
  124.  
  125. def race_startrace(raceindex):
  126. global race_races
  127. ply1 = playerlib.getPlayer(race_races[raceindex]['userid1'])
  128. ply2 = playerlib.getPlayer(race_races[raceindex]['userid2'])
  129. #this resets both players tricks (kinda hacky yo)
  130. ply1.kill()
  131. ply2.kill()
  132. gamethread.delayed(1, ply1.freeze, 1)
  133. gamethread.delayed(1, ply2.freeze, 1)
  134. #move players to start positions
  135. ply1.setLocation(race_start_pos['player1'])
  136. ply2.setLocation(race_start_pos['player2'])
  137. gamethread.delayed(5, ply1.freeze, 0)
  138. gamethread.delayed(5, ply2.freeze, 0)
  139. #FIRE THE BOOLET
  140. race_races[raceindex]['status'] = 'RACE'
  141. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  142. "[#lightgreen%s vs #lightgreen%s#default] #default RACE STARTED!"
  143. %(ply1.name,ply2.name))
  144.  
  145. def race_endrace(raceindex, winner):
  146. global race_races
  147. ply1 = playerlib.getPlayer(race_races[raceindex]['userid1'])
  148. ply2 = playerlib.getPlayer(race_races[raceindex]['userid2'])
  149. pwinner = playerlib.getPlayer(winner)
  150. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  151. "[#lightgreen%s vs #lightgreen%s#default] #green%s #default has won the race!"
  152. %(ply1.name,ply2.name,pwinner.name))
  153. pwinner.cash += race_winner_prize
  154. del race_races[raceindex]
  155.  
  156. def playermenu_handler(userid, choice, menuname):
  157. global race_trickselect
  158. global race_menutmp
  159. race_menutmp[userid] = choice
  160. race_trickselect.send(userid)
  161.  
  162. def trickmenu_handler(userid, choice, menuname):
  163. global race_menutmp
  164. opp = race_menutmp[userid]
  165. del race_menutmp[userid]
  166. race_newrace(userid, opp, choice)
  167.  
  168. def load():
  169. #RACE trick selection menu
  170. global race_trickselect
  171. if (race_trickselect != None): race_trickselect.delete()
  172. race_trickselect = popuplib.easymenu('trickselect', None, trickmenu_handler)
  173. race_trickselect.settitle("[RACE] Trick Select")
  174. for trickname in tricklist:
  175. if (tricklist[trickname]['racable']):
  176. race_trickselect.addoption(trickname, trickname)
  177.  
  178. #RACE player selection menu
  179. global race_playerselect
  180. if (race_playerselect != None): race_playerselect.delete()
  181. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  182. race_playerselect.settitle("[RACE] Player Select")
  183. for player in playerlib.getPlayerList('#human'):
  184. race_playerselect.addoption(player.userid, player.name)
  185.  
  186. def unload():
  187. global race_playerselect
  188. if (race_playerselect != None): race_playerselect.delete()
  189. global race_trickselect
  190. if (race_trickselect != None): race_trickselect.delete()
  191. pass
  192.  
  193. def player_activate(e):
  194. #RACE player selection menu
  195. global race_playerselect
  196. if (race_playerselect != None): race_playerselect.delete()
  197. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  198. race_playerselect.settitle("[RACE] Player Select")
  199. for player in playerlib.getPlayerList('#human'):
  200. race_playerselect.addoption(player.userid, player.name)
  201.  
  202. def player_disconnect(e):
  203. #RACE player selection menu
  204. global race_playerselect
  205. if (race_playerselect != None): race_playerselect.delete()
  206. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  207. race_playerselect.settitle("[RACE] Player Select")
  208. for player in playerlib.getPlayerList('#human'):
  209. race_playerselect.addoption(player.userid, player.name)
  210.  
  211. def es_player_chat(e):
  212. text = e['text']
  213. ply = playerlib.getPlayer(e['userid'])
  214. if (text[0:5] == '!race'):
  215. args = text.split(' ')
  216. if (len(args) == 1):
  217. global race_playerselect
  218. race_playerselect.send(ply.userid)
  219. elif (len(args) == 2):
  220. if (args[1] == 'accept'):
  221. global race_races
  222. for race in race_races:
  223. if (race['userid2'] == str(ply.userid)):
  224. ply1 = playerlib.getPlayer(race['userid1'])
  225. ply2 = playerlib.getPlayer(race['userid2'])
  226. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  227. "[#lightgreen%s vs #lightgreen%s#default]#green #default%s has accepted the race!"
  228. %(ply1.name,ply2.name,ply.name))
  229. race_startrace(race_races.index(race))
  230.  
  231. def surftricks_trick(e):
  232. #Cash money prize
  233. ply = playerlib.getPlayer(e['userid'])
  234. ply.cash += tricklist[e['trick']]['prize']
  235.  
  236. #Racing stuffffff
  237. global race_races
  238. for race in race_races:
  239. if (race['trick'] == e['trick'] and race['status'] == 'RACE'):
  240. if (race['userid1'] == str(ply.userid) or race['userid2'] == str(ply.userid)):
  241. race_endrace(race_races.index(race), str(ply.userid))
  242. race['status'] = 'OVER'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement