Advertisement
captmicro

Untitled

Sep 21st, 2011
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 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 surftricks_startpos(args):
  107. if race_start_positions.has_key(args[0]):
  108. race_start_pos = race_start_positions[args[0]]
  109.  
  110. def race_newrace(userid1, userid2, trick):
  111. global race_races
  112. race_races += [{
  113. 'userid1': str(userid1),
  114. 'userid2': str(userid2),
  115. 'trick': trick,
  116. 'status': 'WAIT'
  117. }]
  118. ply1 = playerlib.getPlayer(userid1)
  119. ply2 = playerlib.getPlayer(userid2)
  120. es.tell(ply2.userid, "#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  121. "[#lightgreen%s vs #lightgreen%s#default] #green%s #defaulthas challenged you to race #green%s #default!"
  122. %(ply1.name,ply2.name,ply1.name,trick))
  123. es.tell(ply2.userid, "#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  124. "[#lightgreen%s vs #lightgreen%s#default] type \"!race accept\" to accept the challenge."
  125. %(ply1.name,ply2.name))
  126.  
  127. def race_startrace(raceindex):
  128. global race_races
  129. ply1 = playerlib.getPlayer(race_races[raceindex]['userid1'])
  130. ply2 = playerlib.getPlayer(race_races[raceindex]['userid2'])
  131. #this resets both players tricks (kinda hacky yo)
  132. ply1.kill()
  133. ply2.kill()
  134. gamethread.delayed(1, ply1.freeze, 1)
  135. gamethread.delayed(1, ply2.freeze, 1)
  136. #move players to start positions
  137. ply1.setLocation(race_start_pos['player1'])
  138. ply2.setLocation(race_start_pos['player2'])
  139. gamethread.delayed(5, ply1.freeze, 0)
  140. gamethread.delayed(5, ply2.freeze, 0)
  141. #FIRE THE BOOLET
  142. race_races[raceindex]['status'] = 'RACE'
  143. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  144. "[#lightgreen%s vs #lightgreen%s#default] #default RACE STARTED!"
  145. %(ply1.name,ply2.name))
  146.  
  147. def race_endrace(raceindex, winner):
  148. global race_races
  149. ply1 = playerlib.getPlayer(race_races[raceindex]['userid1'])
  150. ply2 = playerlib.getPlayer(race_races[raceindex]['userid2'])
  151. pwinner = playerlib.getPlayer(winner)
  152. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  153. "[#lightgreen%s vs #lightgreen%s#default] #green%s #default has won the race!"
  154. %(ply1.name,ply2.name,pwinner.name))
  155. pwinner.cash += race_winner_prize
  156. del race_races[raceindex]
  157.  
  158. def playermenu_handler(userid, choice, menuname):
  159. global race_trickselect
  160. global race_menutmp
  161. race_menutmp[userid] = choice
  162. race_trickselect.send(userid)
  163.  
  164. def trickmenu_handler(userid, choice, menuname):
  165. global race_menutmp
  166. opp = race_menutmp[userid]
  167. del race_menutmp[userid]
  168. race_newrace(userid, opp, choice)
  169.  
  170. def load():
  171. cmdlib.registerServerCommand('surftricks_start_position', surftricks_startpos,
  172. "Surf Tricks Race Starting Position")
  173.  
  174. #RACE trick selection menu
  175. global race_trickselect
  176. if (race_trickselect != None): race_trickselect.delete()
  177. race_trickselect = popuplib.easymenu('trickselect', None, trickmenu_handler)
  178. race_trickselect.settitle("[RACE] Trick Select")
  179. for trickname in tricklist:
  180. if (tricklist[trickname]['racable']):
  181. race_trickselect.addoption(trickname, trickname)
  182.  
  183. #RACE player selection menu
  184. global race_playerselect
  185. if (race_playerselect != None): race_playerselect.delete()
  186. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  187. race_playerselect.settitle("[RACE] Player Select")
  188. for player in playerlib.getPlayerList('#human'):
  189. race_playerselect.addoption(player.userid, player.name)
  190.  
  191. def unload():
  192. cmdlib.unregisterServerCommand('surftricks_start_position')
  193. global race_playerselect
  194. if (race_playerselect != None): race_playerselect.delete()
  195. global race_trickselect
  196. if (race_trickselect != None): race_trickselect.delete()
  197. pass
  198.  
  199. def player_activate(e):
  200. #RACE player selection menu
  201. global race_playerselect
  202. if (race_playerselect != None): race_playerselect.delete()
  203. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  204. race_playerselect.settitle("[RACE] Player Select")
  205. for player in playerlib.getPlayerList('#human'):
  206. race_playerselect.addoption(player.userid, player.name)
  207.  
  208. def player_disconnect(e):
  209. #RACE player selection menu
  210. global race_playerselect
  211. if (race_playerselect != None): race_playerselect.delete()
  212. race_playerselect = popuplib.easymenu('playerselect', None, playermenu_handler)
  213. race_playerselect.settitle("[RACE] Player Select")
  214. for player in playerlib.getPlayerList('#human'):
  215. race_playerselect.addoption(player.userid, player.name)
  216.  
  217. def es_player_chat(e):
  218. text = e['text']
  219. ply = playerlib.getPlayer(e['userid'])
  220. if (text[0:5] == '!race'):
  221. args = text.split(' ')
  222. if (len(args) == 1):
  223. global race_playerselect
  224. race_playerselect.send(ply.userid)
  225. elif (len(args) == 2):
  226. if (args[1] == 'accept'):
  227. global race_races
  228. for race in race_races:
  229. if (race['userid2'] == str(ply.userid)):
  230. ply1 = playerlib.getPlayer(race['userid1'])
  231. ply2 = playerlib.getPlayer(race['userid2'])
  232. es.msg("#multi", "#default[#lightgreenSurf Tricks Racing#default] " +
  233. "[#lightgreen%s vs #lightgreen%s#default]#green #default%s has accepted the race!"
  234. %(ply1.name,ply2.name,ply.name))
  235. race_startrace(race_races.index(race))
  236.  
  237. def surftricks_trick(e):
  238. #Cash money prize
  239. ply = playerlib.getPlayer(e['userid'])
  240. ply.cash += tricklist[e['trick']]['prize']
  241.  
  242. #Racing stuffffff
  243. global race_races
  244. for race in race_races:
  245. if (race['trick'] == e['trick'] and race['status'] == 'RACE'):
  246. if (race['userid1'] == str(ply.userid) or race['userid2'] == str(ply.userid)):
  247. race_endrace(race_races.index(race), str(ply.userid))
  248. race['status'] = 'OVER'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement