Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import es
- import vecmath
- import playerlib
- import popuplib
- import time
- tricks = {}
- info = es.AddonInfo()
- info.name = "Surf Tricks"
- info.version = "1.0.0"
- info.url = "http://addons.eventscripts.com/addons/view/SurfTricks"
- info.basename = "SurfTricks"
- info.author = "DHack"
- es.ServerVar('SurfTricks_Ver', info.version, 'Surf Tricks Version').makepublic()
- #1 Top
- #2 top2
- #3 Main
- #4 Sign
- #5 Pool
- #6 ct
- #7 t
- #awp t side
- #8 pool
- #9 box
- #0 ramp
- #d triangles
- #awp ct side
- #a ramp
- #b pool
- #c box
- #e triangles
- #f deagle
- #g main triangl
- #h pika
- tricklist = {
- 'Awp2Awp':{
- 'sequence':['0a','a0'],
- 'combo':['Awp3'],
- 'combotriggers':1,
- 'prize':500,
- },
- 'Awp3':{
- 'sequence':['0a0','a0a'],
- 'combo':['Awp4'],
- 'combotriggers':1,
- 'prize':500,
- },
- 'Pikachu Gap':{
- 'sequence':['2h'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Tobe Go Home':{
- 'sequence':['5d09','5eac'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Deagle to awp':{
- 'sequence':['f0','fa'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'T1000':{
- 'sequence':['f3'],
- 'combo':['T1000 to spawn','T1000 to sign'],
- 'combotriggers':1,
- 'prize':500,
- },
- 'T1000 to spawn':{
- 'sequence':['f36','f37'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'T1000 to sign':{
- 'sequence':['f34'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Awp4':{
- 'sequence':['a0a0','0a0a'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Main to sign':{
- 'sequence':['34'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Razor Gap':{
- 'sequence':['235'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Awp To Awp Over Main':{
- 'sequence':['03a','a30'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Spawn Hop Ct->T':{
- 'sequence':['67'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Spawn Hop T->Ct':{
- 'sequence':['76'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Nc Waave':{
- 'sequence':['63d', '73e'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Double Hop':{
- 'sequence':['51513'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- },
- 'Chrome Gap':{
- 'sequence':['2389', '23bc'],
- 'combo':[],
- 'combotriggers':0,
- 'prize':500,
- }
- }
- def load():
- es.regsaycmd('!point', 'surftricks/point', 'This opens the menu')
- es.server.queuecmd("es_load extendedevents")
- es.server.queuecmd("extendedevents_load player_move")
- es.loadevents('declare', 'addons/eventscripts/surftricks/surftricks_trick.txt')
- def point():
- userid = es.getcmduserid()
- x,y,z = es.getplayerlocation(userid)
- es.msg(es.getplayername(userid)+' (%s, %s, %s)'%(x,y,z))
- def player_spawn(ev):
- userid = ev['userid']
- tricks[ev['userid']] = {}
- tricks[ev['userid']]['currenttrigger'] = ''
- tricks[ev['userid']]['lasttriggers'] = ''
- tricks[ev['userid']]['lasttrick'] = ''
- tricks[ev['userid']]['trigerstilldelete'] = 0
- tricks[ev['userid']]['time'] = []
- def firetrick(userid, trick, time)
- es.event('initalize', 'surftricks_trick')
- es.event('setstring', 'surftricks_trick', 'userid', userid)
- es.event('setstring', 'surftricks_trick', 'trick', trick)
- es.event('setfloat', 'surftricks_trick', 'time', time)
- es.event('fire', 'surftricks_trick')
- def player_move(ev):
- userid = ev['userid']
- name = es.getplayername(userid)
- player = playerlib.getPlayer(userid)
- if player.attributes['isdead'] == 1:
- return
- where = vecmath.vector(es.getplayerlocation(userid))
- #Top Triger
- if vecmath.isbetweenRect(where, (-1873.38208008, 186.852890015, 7208.03125), (-2422.34472656, -210.814849854, 7386.06152344)) and tricks[userid]['currenttrigger'] != '1':
- tricks[userid]['lasttriggers'] += '1'
- tricks[userid]['currenttrigger'] = '1'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 1')
- #Top2 Triger
- elif vecmath.isbetweenRect(where, (-1870.42553711, -191.403823853, 7208.03125), (-1709.19848633, 193.75177002, 7209.43017578)) and tricks[userid]['currenttrigger'] != '2':
- tricks[userid]['lasttriggers'] += '2'
- tricks[userid]['currenttrigger'] = '2'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 2')
- #MainRamp Triger
- elif vecmath.isbetweenRect(where, (-1045.970215, 227.254944, 5873.747559), (2488.334717, -261.856018, 4312.144043)) and tricks[userid]['currenttrigger'] != '3':
- tricks[userid]['lasttriggers'] += '3'
- tricks[userid]['currenttrigger'] = '3'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 3')
- #Sign Triger
- elif vecmath.isbetweenRect(where, (629.737793, 236.375458, 6182.140625), (536.640015, -260.946259, 6084.806152)) and tricks[userid]['currenttrigger'] != '4':
- tricks[userid]['lasttriggers'] += '4'
- tricks[userid]['currenttrigger'] = '4'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 4')
- #pool trigger
- elif pointincycylinder(where, 1056, (-6496, 0, -1743.96875), 686.96875) and tricks[userid]['currenttrigger'] != '5':
- tricks[userid]['lasttriggers'] += '5'
- tricks[userid]['currenttrigger'] = '5'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #Ct Triger
- elif vecmath.isbetweenRect(where, (-1711.96875, 207.96875, 5888.03125), (-1033.29418945, -5.25913906097, 5920.03125)) and tricks[userid]['currenttrigger'] != '6':
- tricks[userid]['lasttriggers'] += '6'
- tricks[userid]['currenttrigger'] = '6'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 6')
- #T Triger
- elif vecmath.isbetweenRect(where, (-1711.99975586, -207.96875, 5888.03125), (-1037.74841309, -9.07034873962, 5920.03125)) and tricks[userid]['currenttrigger'] != '7':
- tricks[userid]['lasttriggers'] += '7'
- tricks[userid]['currenttrigger'] = '7'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 7')
- #AWP pool T SIDE Triger
- elif vecmath.isbetweenRect(where, (2463.97387695, -4352.03125, 1888.03125), (1824.92590332, -4791.74902344, 2016.03125)) and tricks[userid]['currenttrigger'] != '8':
- tricks[userid]['lasttriggers'] += '8'
- tricks[userid]['currenttrigger'] = '8'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 8')
- #AWP BOX T SIDE Triger
- elif vecmath.isbetweenRect(where, (-495.999664307, -8336.03125, -1599.96875), (148.405853271, -8776.38183594, -1471.96875)) and tricks[userid]['currenttrigger'] != '9':
- tricks[userid]['lasttriggers'] += '9'
- tricks[userid]['currenttrigger'] = '9'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 9')
- #AWP ramp T SIDE Triger
- elif vecmath.isbetweenRect(where, (1819.20593262, -4322.34521484, 1888.03125), (-1642.31286621, -4803.55712891, 488.915740967)) and tricks[userid]['currenttrigger'] != '0':
- tricks[userid]['lasttriggers'] += '0'
- tricks[userid]['currenttrigger'] = '0'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point 0')
- #AWP ramp cT SIDE Triger
- elif vecmath.isbetweenRect(where, (-1632.60754395, 4288.19091797, -46.4395980835), (1823.96875, 4789.06591797, 1888.03125)) and tricks[userid]['currenttrigger'] != 'a':
- tricks[userid]['lasttriggers'] += 'a'
- tricks[userid]['currenttrigger'] = 'a'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point a')
- #AWP pool cT SIDE Triger
- elif vecmath.isbetweenRect(where, (2463.96875, 4767.96875, 1888.03125), (1845.4967041, 4328.50830078, 2016.03125)) and tricks[userid]['currenttrigger'] != 'b':
- tricks[userid]['lasttriggers'] += 'b'
- tricks[userid]['currenttrigger'] = 'b'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point b')
- #AWP box cT SIDE Triger
- elif vecmath.isbetweenRect(where, (-495.96875, 8751.98828125, -1599.96875), (147.067382813, 8311.66015625, -1471.96875)) and tricks[userid]['currenttrigger'] != 'c':
- tricks[userid]['lasttriggers'] += 'c'
- tricks[userid]['currenttrigger'] = 'c'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point c')
- #Triangles T SIDE Triger
- elif vecmath.isbetweenRect(where, (-2385.15722656, -3643.68798828, 688.03125), (-4883.10546875, -2420.86962891, -882.885742188)) and tricks[userid]['currenttrigger'] != 'd':
- tricks[userid]['lasttriggers'] += 'd'
- tricks[userid]['currenttrigger'] = 'd'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point d')
- #Triangles CT SIDE Triger
- elif vecmath.isbetweenRect(where, (-4866.59521484, 2435.82836914, -884.956970215), (-2389.23266602, 3641.50830078, 688.03125)) and tricks[userid]['currenttrigger'] != 'e':
- tricks[userid]['lasttriggers'] += 'e'
- tricks[userid]['currenttrigger'] = 'e'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point e')
- #deagle
- elif vecmath.isbetweenRect(where, (4524.40625, -447.232879639, 3494.28540039), (4024.60351563, 466.086273193, 3956.45458984)) and tricks[userid]['currenttrigger'] != 'f':
- tricks[userid]['lasttriggers'] += 'f'
- tricks[userid]['currenttrigger'] = 'f'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point f')
- #main triangle
- elif vecmath.isbetweenRect(where, (4565.15966797, -529.114379883, 5046.30761719), (3751.39990234, 548.926452637, 4113.79101563)) and tricks[userid]['currenttrigger'] != 'g':
- tricks[userid]['lasttriggers'] += 'g'
- tricks[userid]['currenttrigger'] = 'g'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point g')
- #pikachu
- elif vecmath.isbetweenRect(where, (-1132.33898926, 21.160577774, 6016.03125), (-1720.8840332, -19.4523143768, 6161.13330078)) and tricks[userid]['currenttrigger'] != 'h':
- tricks[userid]['lasttriggers'] += 'h'
- tricks[userid]['currenttrigger'] = 'h'
- tricks[userid]['time'].append(gettime())
- checktricks(userid)
- #es.msg(name+' Has gone in point h')
- def checktricks(userid):
- global tricks_races
- name = es.getplayername(userid)
- lasttrick = tricks[userid]['lasttrick']
- if tricks[userid]['trigerstilldelete'] > 0:
- tricks[userid]['trigerstilldelete'] -= 1
- trickdone = 0
- for trick in tricklist[lasttrick]['combo']:
- for sequence in tricklist[trick]['sequence']:
- if sequence in tricks[userid]['lasttriggers']:
- timelen = len(tricks[userid]['time'])-1
- time = tricks[userid]['time'][-1] - tricks[userid]['time'][timelen-(len(sequence)-1)]
- 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)))
- #EDIT BY CAPT MICRO
- firetrick(userid, trick, time)
- #EDIT BY CAPT MICRO
- tricks[userid]['lasttrick'] = trick
- tricks[userid]['trigerstilldelete'] = tricklist[trick]['combotriggers']
- trickdone = 1
- break
- if trickdone == 1:
- break
- if tricks[userid]['trigerstilldelete'] == 0:
- tricks[userid]['lasttriggers'] = ''
- return
- for trick in tricklist:
- for sequence in tricklist[trick]['sequence']:
- if sequence in tricks[userid]['lasttriggers']:
- tricks[userid]['lasttrick'] = trick
- tricks[userid]['trigerstilldelete'] = tricklist[trick]['combotriggers']
- timelen = len(tricks[userid]['time'])-1
- time = tricks[userid]['time'][-1] - tricks[userid]['time'][timelen-(len(sequence)-1)]
- 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)))
- #EDIT BY CAPT MICRO
- firetrick(userid, trick, time)
- #EDIT BY CAPT MICRO
- if tricks[userid]['trigerstilldelete'] == 0:
- tricks[userid]['lasttriggers'] = ''
- tricks[userid]['lasttriggers'] += tricks[userid]['currenttrigger']
- break
- def pointincycylinder(pointtocheck, radius, bottomcenterpoint, height):
- x, y, z = pointtocheck
- a, b, c = bottomcenterpoint
- if ((x-a)**2)+((y-b)**2)<=radius**2:
- if c < z < c+height:
- return True
- return False
- def gettime():
- time_now_mic = time.time()
- return time_now_mic
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement