Advertisement
captmicro

Untitled

Sep 18th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.00 KB | None | 0 0
  1. import es
  2. import vecmath
  3. import playerlib
  4. import popuplib
  5. import time
  6. tricks = {}
  7.  
  8. info = es.AddonInfo()
  9. info.name = "Surf Tricks"
  10. info.version = "1.0.0"
  11. info.url = "http://addons.eventscripts.com/addons/view/SurfTricks"
  12. info.basename = "SurfTricks"
  13. info.author = "DHack"
  14. es.ServerVar('SurfTricks_Ver', info.version, 'Surf Tricks Version').makepublic()
  15.  
  16.  
  17. #1 Top
  18. #2 top2
  19. #3 Main
  20. #4 Sign
  21. #5 Pool
  22. #6 ct
  23. #7 t
  24.  
  25. #awp t side
  26. #8 pool
  27. #9 box
  28. #0 ramp
  29. #d triangles
  30.  
  31. #awp ct side
  32. #a ramp
  33. #b pool
  34. #c box
  35. #e triangles
  36.  
  37.  
  38. #f deagle
  39. #g main triangl
  40. #h pika
  41.  
  42.  
  43. tricklist = {
  44. 'Awp2Awp':{
  45. 'sequence':['0a','a0'],
  46. 'combo':['Awp3'],
  47. 'combotriggers':1,
  48. 'prize':500,
  49. },
  50. 'Awp3':{
  51. 'sequence':['0a0','a0a'],
  52. 'combo':['Awp4'],
  53. 'combotriggers':1,
  54. 'prize':500,
  55. },
  56. 'Pikachu Gap':{
  57. 'sequence':['2h'],
  58. 'combo':[],
  59. 'combotriggers':0,
  60. 'prize':500,
  61. },
  62. 'Tobe Go Home':{
  63. 'sequence':['5d09','5eac'],
  64. 'combo':[],
  65. 'combotriggers':0,
  66. 'prize':500,
  67. },
  68. 'Deagle to awp':{
  69. 'sequence':['f0','fa'],
  70. 'combo':[],
  71. 'combotriggers':0,
  72. 'prize':500,
  73. },
  74. 'T1000':{
  75. 'sequence':['f3'],
  76. 'combo':['T1000 to spawn','T1000 to sign'],
  77. 'combotriggers':1,
  78. 'prize':500,
  79. },
  80. 'T1000 to spawn':{
  81. 'sequence':['f36','f37'],
  82. 'combo':[],
  83. 'combotriggers':0,
  84. 'prize':500,
  85. },
  86. 'T1000 to sign':{
  87. 'sequence':['f34'],
  88. 'combo':[],
  89. 'combotriggers':0,
  90. 'prize':500,
  91. },
  92. 'Awp4':{
  93. 'sequence':['a0a0','0a0a'],
  94. 'combo':[],
  95. 'combotriggers':0,
  96. 'prize':500,
  97. },
  98. 'Main to sign':{
  99. 'sequence':['34'],
  100. 'combo':[],
  101. 'combotriggers':0,
  102. 'prize':500,
  103. },
  104. 'Razor Gap':{
  105. 'sequence':['235'],
  106. 'combo':[],
  107. 'combotriggers':0,
  108. 'prize':500,
  109. },
  110. 'Awp To Awp Over Main':{
  111. 'sequence':['03a','a30'],
  112. 'combo':[],
  113. 'combotriggers':0,
  114. 'prize':500,
  115. },
  116. 'Spawn Hop Ct->T':{
  117. 'sequence':['67'],
  118. 'combo':[],
  119. 'combotriggers':0,
  120. 'prize':500,
  121. },
  122. 'Spawn Hop T->Ct':{
  123. 'sequence':['76'],
  124. 'combo':[],
  125. 'combotriggers':0,
  126. 'prize':500,
  127. },
  128. 'Nc Waave':{
  129. 'sequence':['63d', '73e'],
  130. 'combo':[],
  131. 'combotriggers':0,
  132. 'prize':500,
  133. },
  134. 'Double Hop':{
  135. 'sequence':['51513'],
  136. 'combo':[],
  137. 'combotriggers':0,
  138. 'prize':500,
  139. },
  140. 'Chrome Gap':{
  141. 'sequence':['2389', '23bc'],
  142. 'combo':[],
  143. 'combotriggers':0,
  144. 'prize':500,
  145. }
  146. }
  147.  
  148. def load():
  149. es.regsaycmd('!point', 'surftricks/point', 'This opens the menu')
  150. es.server.queuecmd("es_load extendedevents")
  151. es.server.queuecmd("extendedevents_load player_move")
  152.  
  153. def point():
  154. userid = es.getcmduserid()
  155. x,y,z = es.getplayerlocation(userid)
  156. es.msg(es.getplayername(userid)+' (%s, %s, %s)'%(x,y,z))
  157.  
  158. def player_spawn(ev):
  159. userid = ev['userid']
  160. tricks[ev['userid']] = {}
  161. tricks[ev['userid']]['currenttrigger'] = ''
  162. tricks[ev['userid']]['lasttriggers'] = ''
  163. tricks[ev['userid']]['lasttrick'] = ''
  164. tricks[ev['userid']]['trigerstilldelete'] = 0
  165. tricks[ev['userid']]['time'] = []
  166.  
  167. def player_move(ev):
  168. userid = ev['userid']
  169. name = es.getplayername(userid)
  170. player = playerlib.getPlayer(userid)
  171. if player.attributes['isdead'] == 1:
  172. return
  173. where = vecmath.vector(es.getplayerlocation(userid))
  174. #Top Triger
  175. if vecmath.isbetweenRect(where, (-1873.38208008, 186.852890015, 7208.03125), (-2422.34472656, -210.814849854, 7386.06152344)) and tricks[userid]['currenttrigger'] != '1':
  176. tricks[userid]['lasttriggers'] += '1'
  177. tricks[userid]['currenttrigger'] = '1'
  178. tricks[userid]['time'].append(gettime())
  179. checktricks(userid)
  180. #es.msg(name+' Has gone in point 1')
  181. #Top2 Triger
  182. elif vecmath.isbetweenRect(where, (-1870.42553711, -191.403823853, 7208.03125), (-1709.19848633, 193.75177002, 7209.43017578)) and tricks[userid]['currenttrigger'] != '2':
  183. tricks[userid]['lasttriggers'] += '2'
  184. tricks[userid]['currenttrigger'] = '2'
  185. tricks[userid]['time'].append(gettime())
  186. checktricks(userid)
  187. #es.msg(name+' Has gone in point 2')
  188. #MainRamp Triger
  189. elif vecmath.isbetweenRect(where, (-1045.970215, 227.254944, 5873.747559), (2488.334717, -261.856018, 4312.144043)) and tricks[userid]['currenttrigger'] != '3':
  190. tricks[userid]['lasttriggers'] += '3'
  191. tricks[userid]['currenttrigger'] = '3'
  192. tricks[userid]['time'].append(gettime())
  193. checktricks(userid)
  194. #es.msg(name+' Has gone in point 3')
  195. #Sign Triger
  196. elif vecmath.isbetweenRect(where, (629.737793, 236.375458, 6182.140625), (536.640015, -260.946259, 6084.806152)) and tricks[userid]['currenttrigger'] != '4':
  197. tricks[userid]['lasttriggers'] += '4'
  198. tricks[userid]['currenttrigger'] = '4'
  199. tricks[userid]['time'].append(gettime())
  200. checktricks(userid)
  201. #es.msg(name+' Has gone in point 4')
  202. #pool trigger
  203. elif pointincycylinder(where, 1056, (-6496, 0, -1743.96875), 686.96875) and tricks[userid]['currenttrigger'] != '5':
  204. tricks[userid]['lasttriggers'] += '5'
  205. tricks[userid]['currenttrigger'] = '5'
  206. tricks[userid]['time'].append(gettime())
  207. checktricks(userid)
  208. #Ct Triger
  209. elif vecmath.isbetweenRect(where, (-1711.96875, 207.96875, 5888.03125), (-1033.29418945, -5.25913906097, 5920.03125)) and tricks[userid]['currenttrigger'] != '6':
  210. tricks[userid]['lasttriggers'] += '6'
  211. tricks[userid]['currenttrigger'] = '6'
  212. tricks[userid]['time'].append(gettime())
  213. checktricks(userid)
  214. #es.msg(name+' Has gone in point 6')
  215. #T Triger
  216. elif vecmath.isbetweenRect(where, (-1711.99975586, -207.96875, 5888.03125), (-1037.74841309, -9.07034873962, 5920.03125)) and tricks[userid]['currenttrigger'] != '7':
  217. tricks[userid]['lasttriggers'] += '7'
  218. tricks[userid]['currenttrigger'] = '7'
  219. tricks[userid]['time'].append(gettime())
  220. checktricks(userid)
  221. #es.msg(name+' Has gone in point 7')
  222. #AWP pool T SIDE Triger
  223. elif vecmath.isbetweenRect(where, (2463.97387695, -4352.03125, 1888.03125), (1824.92590332, -4791.74902344, 2016.03125)) and tricks[userid]['currenttrigger'] != '8':
  224. tricks[userid]['lasttriggers'] += '8'
  225. tricks[userid]['currenttrigger'] = '8'
  226. tricks[userid]['time'].append(gettime())
  227. checktricks(userid)
  228. #es.msg(name+' Has gone in point 8')
  229. #AWP BOX T SIDE Triger
  230. elif vecmath.isbetweenRect(where, (-495.999664307, -8336.03125, -1599.96875), (148.405853271, -8776.38183594, -1471.96875)) and tricks[userid]['currenttrigger'] != '9':
  231. tricks[userid]['lasttriggers'] += '9'
  232. tricks[userid]['currenttrigger'] = '9'
  233. tricks[userid]['time'].append(gettime())
  234. checktricks(userid)
  235. #es.msg(name+' Has gone in point 9')
  236. #AWP ramp T SIDE Triger
  237. elif vecmath.isbetweenRect(where, (1819.20593262, -4322.34521484, 1888.03125), (-1642.31286621, -4803.55712891, 488.915740967)) and tricks[userid]['currenttrigger'] != '0':
  238. tricks[userid]['lasttriggers'] += '0'
  239. tricks[userid]['currenttrigger'] = '0'
  240. tricks[userid]['time'].append(gettime())
  241. checktricks(userid)
  242. #es.msg(name+' Has gone in point 0')
  243. #AWP ramp cT SIDE Triger
  244. elif vecmath.isbetweenRect(where, (-1632.60754395, 4288.19091797, -46.4395980835), (1823.96875, 4789.06591797, 1888.03125)) and tricks[userid]['currenttrigger'] != 'a':
  245. tricks[userid]['lasttriggers'] += 'a'
  246. tricks[userid]['currenttrigger'] = 'a'
  247. tricks[userid]['time'].append(gettime())
  248. checktricks(userid)
  249. #es.msg(name+' Has gone in point a')
  250. #AWP pool cT SIDE Triger
  251. elif vecmath.isbetweenRect(where, (2463.96875, 4767.96875, 1888.03125), (1845.4967041, 4328.50830078, 2016.03125)) and tricks[userid]['currenttrigger'] != 'b':
  252. tricks[userid]['lasttriggers'] += 'b'
  253. tricks[userid]['currenttrigger'] = 'b'
  254. tricks[userid]['time'].append(gettime())
  255. checktricks(userid)
  256. #es.msg(name+' Has gone in point b')
  257. #AWP box cT SIDE Triger
  258. elif vecmath.isbetweenRect(where, (-495.96875, 8751.98828125, -1599.96875), (147.067382813, 8311.66015625, -1471.96875)) and tricks[userid]['currenttrigger'] != 'c':
  259. tricks[userid]['lasttriggers'] += 'c'
  260. tricks[userid]['currenttrigger'] = 'c'
  261. tricks[userid]['time'].append(gettime())
  262. checktricks(userid)
  263. #es.msg(name+' Has gone in point c')
  264. #Triangles T SIDE Triger
  265. elif vecmath.isbetweenRect(where, (-2385.15722656, -3643.68798828, 688.03125), (-4883.10546875, -2420.86962891, -882.885742188)) and tricks[userid]['currenttrigger'] != 'd':
  266. tricks[userid]['lasttriggers'] += 'd'
  267. tricks[userid]['currenttrigger'] = 'd'
  268. tricks[userid]['time'].append(gettime())
  269. checktricks(userid)
  270. #es.msg(name+' Has gone in point d')
  271. #Triangles CT SIDE Triger
  272. elif vecmath.isbetweenRect(where, (-4866.59521484, 2435.82836914, -884.956970215), (-2389.23266602, 3641.50830078, 688.03125)) and tricks[userid]['currenttrigger'] != 'e':
  273. tricks[userid]['lasttriggers'] += 'e'
  274. tricks[userid]['currenttrigger'] = 'e'
  275. tricks[userid]['time'].append(gettime())
  276. checktricks(userid)
  277. #es.msg(name+' Has gone in point e')
  278. #deagle
  279. elif vecmath.isbetweenRect(where, (4524.40625, -447.232879639, 3494.28540039), (4024.60351563, 466.086273193, 3956.45458984)) and tricks[userid]['currenttrigger'] != 'f':
  280. tricks[userid]['lasttriggers'] += 'f'
  281. tricks[userid]['currenttrigger'] = 'f'
  282. tricks[userid]['time'].append(gettime())
  283. checktricks(userid)
  284. #es.msg(name+' Has gone in point f')
  285. #main triangle
  286. elif vecmath.isbetweenRect(where, (4565.15966797, -529.114379883, 5046.30761719), (3751.39990234, 548.926452637, 4113.79101563)) and tricks[userid]['currenttrigger'] != 'g':
  287. tricks[userid]['lasttriggers'] += 'g'
  288. tricks[userid]['currenttrigger'] = 'g'
  289. tricks[userid]['time'].append(gettime())
  290. checktricks(userid)
  291. #es.msg(name+' Has gone in point g')
  292. #pikachu
  293. elif vecmath.isbetweenRect(where, (-1132.33898926, 21.160577774, 6016.03125), (-1720.8840332, -19.4523143768, 6161.13330078)) and tricks[userid]['currenttrigger'] != 'h':
  294. tricks[userid]['lasttriggers'] += 'h'
  295. tricks[userid]['currenttrigger'] = 'h'
  296. tricks[userid]['time'].append(gettime())
  297. checktricks(userid)
  298. #es.msg(name+' Has gone in point h')
  299. def checktricks(userid):
  300. global tricks_races
  301. name = es.getplayername(userid)
  302. lasttrick = tricks[userid]['lasttrick']
  303. if tricks[userid]['trigerstilldelete'] > 0:
  304. tricks[userid]['trigerstilldelete'] -= 1
  305. trickdone = 0
  306. for trick in tricklist[lasttrick]['combo']:
  307. for sequence in tricklist[trick]['sequence']:
  308. if sequence in tricks[userid]['lasttriggers']:
  309. timelen = len(tricks[userid]['time'])-1
  310. time = tricks[userid]['time'][-1] - tricks[userid]['time'][timelen-(len(sequence)-1)]
  311. es.msg("#multi", "#default[#lightgreenSurf Tricks#default] #greenPlayer #default%s#green has done the trick #lightgreen%s #greenin #default%s #greenseconds!"%(name, trick, round(time, 2)))
  312. #EDIT BY CAPT MICRO
  313. ply = playerlib.getPlayer(userid)
  314. ply.cash += tricklist[trick]['prize']
  315. #EDIT BY CAPT MICRO
  316. tricks[userid]['lasttrick'] = trick
  317. tricks[userid]['trigerstilldelete'] = tricklist[trick]['combotriggers']
  318. trickdone = 1
  319. break
  320. if trickdone == 1:
  321. break
  322. if tricks[userid]['trigerstilldelete'] == 0:
  323. tricks[userid]['lasttriggers'] = ''
  324. return
  325. for trick in tricklist:
  326. for sequence in tricklist[trick]['sequence']:
  327. if sequence in tricks[userid]['lasttriggers']:
  328. tricks[userid]['lasttrick'] = trick
  329. tricks[userid]['trigerstilldelete'] = tricklist[trick]['combotriggers']
  330. timelen = len(tricks[userid]['time'])-1
  331. time = tricks[userid]['time'][-1] - tricks[userid]['time'][timelen-(len(sequence)-1)]
  332. es.msg("#multi", "#default[#lightgreenSurf Tricks#default] #greenPlayer #default%s#green has done the trick #lightgreen%s #greenin #default%s #greenseconds!"%(name, trick, round(time, 2)))
  333. #EDIT BY CAPT MICRO
  334. ply = playerlib.getPlayer(userid)
  335. ply.cash += tricklist[trick]['prize']
  336. #EDIT BY CAPT MICRO
  337. if tricks[userid]['trigerstilldelete'] == 0:
  338. tricks[userid]['lasttriggers'] = ''
  339. tricks[userid]['lasttriggers'] += tricks[userid]['currenttrigger']
  340. break
  341. def pointincycylinder(pointtocheck, radius, bottomcenterpoint, height):
  342. x, y, z = pointtocheck
  343. a, b, c = bottomcenterpoint
  344. if ((x-a)**2)+((y-b)**2)<=radius**2:
  345. if c < z < c+height:
  346. return True
  347. return False
  348.  
  349. def gettime():
  350. time_now_mic = time.time()
  351. return time_now_mic
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement