Advertisement
captmicro

Untitled

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