Advertisement
captmicro

Untitled

Sep 18th, 2011
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.16 KB | None | 0 0
  1. import es, playerlib, popuplib
  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.  
  115. def race_startrace(raceindex):
  116. global race_races
  117. #this resets both players tricks (kinda hacky yo)
  118. es.event('initialize', 'player_spawn')
  119. es.event('setstring', 'player_spawn', 'userid', race['userid1'])
  120. es.event('fire', 'player_spawn')
  121. es.event('initialize', 'player_spawn')
  122. es.event('setstring', 'player_spawn', 'userid', race['userid2'])
  123. es.event('fire', 'player_spawn')
  124. #move players to start positions
  125. playerlib.getPlayer(race_races[raceindex]['userid1']
  126. ).setLocation(race_start_pos['player1'])
  127. playerlib.getPlayer(race_races[raceindex]['userid2']
  128. ).setLocation(race_start_pos['player2'])
  129. #FIRE THE BOOLET
  130. race_races[raceindex]['status'] = 'RACE'
  131.  
  132. def race_startrace(raceindex, winner):
  133. global race_races
  134. ply1 = playerlib.getPlayer(race_races[raceindex]['userid1'])
  135. ply2 = playerlib.getPlayer(race_races[raceindex]['userid2'])
  136. pwinner = playerlib.getPlayer(winner)
  137. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  138. "[#lightgreen%s vs #lightgreen%s#default]#green #default%s has won the race!"
  139. %(ply1.name,ply2.name,winner.name))
  140. pwinner.cash += race_winner_prize
  141. del race_races[raceindex]
  142.  
  143. def playermenu_handler(userid, choice, menuname):
  144. global race_trickselect
  145. global race_menutmp
  146. race_menutmp[userid] = choice
  147. race_trickselect.send(userid)
  148.  
  149. def trickmenu_handler(userid, choice, menuname):
  150. global race_menutmp
  151. opp = race_menutmp[userid]
  152. del race_menutmp[userid]
  153. race_newrace(userid, opp, choice)
  154.  
  155. def load():
  156. es.loadevents('addons/eventscripts/surftricks/surftricks_trick.res')
  157.  
  158. #RACE trick selection menu
  159. global race_trickselect
  160. if (race_trickselect != None): race_trickselect.delete()
  161. race_trickselect = popuplib.easymenu('trickselect', None, trickmenu_handler)
  162. race_trickselect.settitle("[RACE] Trick Select")
  163. for trackname in tricklist:
  164. if (tracklist[trackname]['racable']):
  165. race_trickselect.addoption(trackname, trackname)
  166.  
  167. #RACE player selection menu
  168. global race_playerselect
  169. if (race_playerselect != None): race_playerselect.delete()
  170. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  171. race_playerselect.settitle("[RACE] Player Select")
  172. for player in playerlib.getPlayerList('#human'):
  173. race_playerselect.addoption(player.userid, player.name)
  174.  
  175. def es_map_start(e):
  176. es.loadevents('addons/eventscripts/surftricks/surftricks_trick.res')
  177.  
  178. def unload():
  179. global race_playerselect
  180. if (race_playerselect != None): race_playerselect.delete()
  181. global race_trickselect
  182. if (race_trickselect != None): race_trickselect.delete()
  183. pass
  184.  
  185. def player_activate(e):
  186. #RACE player selection menu
  187. global race_playerselect
  188. if (race_playerselect != None): race_playerselect.delete()
  189. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  190. race_playerselect.settitle("[RACE] Player Select")
  191. for player in playerlib.getPlayerList('#human'):
  192. race_playerselect.addoption(player.userid, player.name)
  193.  
  194. def player_disconnect(e):
  195. #RACE player selection menu
  196. global race_playerselect
  197. if (race_playerselect != None): race_playerselect.delete()
  198. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  199. race_playerselect.settitle("[RACE] Player Select")
  200. for player in playerlib.getPlayerList('#human'):
  201. race_playerselect.addoption(player.userid, player.name)
  202.  
  203. def es_player_chat(e):
  204. text = e['text']
  205. ply = playerlib.getPlayer(e['userid'])
  206. if (text[0:5] == '!race'):
  207. args = text.split(' ')
  208. if (len(args) == 1):
  209. global race_playerselect
  210. race_playerselect.send(ply.userid)
  211. elif (len(args) == 2):
  212. if (args[1] == 'accept'):
  213. global race_races
  214. for race in race_races:
  215. if (race['userid2'] == str(ply.userid)):
  216. race_startrace(race_races.index(race))
  217.  
  218. def surftricks_trick(userid, trick, time):
  219. #Cash money prize
  220. ply = playerlib.getPlayer(userid)
  221. ply.cash += tracklist[trick]['prize']
  222.  
  223. #Racing stuffffff
  224. global race_races
  225. for race in race_races:
  226. if (race['trick'] == trick and race['status'] == 'RACE'):
  227. if (race['ply1'] == str(userid) or race['ply2'] == str(userid)):
  228. race_endrace(race_races.index(race), str(userid))
  229. race['status'] = 'OVER'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement