SHARE
TWEET

Untitled

a guest Jul 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import es
  2. import playerlib
  3. import popuplib
  4. import usermsg
  5. import gamethread
  6.  
  7. from configobj import ConfigObj
  8.  
  9. import random
  10.  
  11. global pct
  12. pct = 0
  13.  
  14. #Klassen  
  15.  
  16. class MapManager(object):
  17.     def __init__(self):
  18.         pass
  19.        
  20.     def remove(self):
  21.         index = es.createentitylist('hostage_entity')
  22.         for i in index:
  23.             es.server.queuecmd('es_xremove %s' %(i))
  24.        
  25. class DownloadManager(object):
  26.     def __init__(self):
  27.         self.downloads = []
  28.        
  29.     def add(self, path):
  30.         if not path in self.downloads:
  31.             self.downloads.append(path)
  32.        
  33.     def remove(self, path):
  34.         try:
  35.             self.downloads.remove(path)
  36.         except:
  37.             pass  
  38.                      
  39.     def activate(self):
  40.         for i in self.downloads:
  41.             es.stringtable('downloadables', i)      
  42.            
  43. class Clock(object):
  44.     def __init__(self):
  45.         self.time = float(es.ServerVar('mp_roundtime'))*60
  46.         self.userids = []
  47.        
  48.     def start(self):
  49.         gamethread.delayedname(1, 'clockTimer', self.tick, ())
  50.         self.time = float(es.ServerVar('mp_roundtime'))*60
  51.        
  52.     def stop(self):
  53.         self.time = 0
  54.         gamethread.cancelDelayed('clockTimer')
  55.        
  56.     def tick(self):
  57.         gamethread.delayedname(1, 'clockTimer', self.tick, ())
  58.         self.time -= 1
  59.         if self.time == 0:
  60.             self.stop()
  61.        
  62.     def getTime(self):
  63.         return self.time
  64.        
  65.     def add(self, userid):
  66.         if userid not in self.userids:
  67.             self.userids.append(userid)
  68.            
  69.     def remove(self, userid):
  70.         if userid in self.userids:
  71.             self.userids.remove(userid)
  72.             usermsg.hudhint(userid, '')
  73.            
  74.     def send(self):
  75.         for i in self.userids:
  76.             min = int(self.getTime()//60)
  77.             sec = int(self.getTime()%60)
  78.             if sec <= 9:
  79.                 sec = '0%s' %(sec)
  80.             usermsg.hudhint(i, 'Time left:\n%s:%s' %(min, sec))
  81.            
  82. class TickManager(object):
  83.     def __init__(self):
  84.         self.tickEnabled = False
  85.        
  86.     def enable(self):
  87.         if not self.tickEnabled:
  88.             es.addons.registerTickListener(tickListener)
  89.             loop()
  90.             self.tickEnabled = True
  91.            
  92.     def disable(self):
  93.         if self.tickEnabled:
  94.             es.addons.unregisterTickListener(tickListener)
  95.             gamethread.cancelDelayed('sseekLoop')
  96.             self.tickEnabled = False
  97.            
  98.     def isEnabled(self):
  99.         return self.tickEnabled                
  100.        
  101. class Player(object):
  102.     def __init__(self, userid):
  103.         self.userid = userid
  104.         self.player = playerlib.getPlayer(userid)
  105.         self.team = es.getplayerteam(userid)
  106.         self.alive = False
  107.         self.thirdView = False
  108.         self.solidStatus = True
  109.         self.freezeStatus = False
  110.         self.valuesOK = False
  111.         self.valueList = []
  112.         self.configPopupSend = False
  113.         self.whistle = 0
  114.         self.weapons = 0
  115.         self.color = 0
  116.         self.model = None
  117.         self.ct = False
  118.         self.ready = False
  119.         self.wantsToSeePopup = True
  120.        
  121.         gamethread.delayed(1, self.isReady, ())
  122.        
  123.     def isReady(self):
  124.         self.ready = True
  125.        
  126.     def changeTeam(self, index):
  127.         self.team = int(index)
  128.         if self.team in (2,3):
  129.             cnt = 0
  130.             for i in checkValues:
  131.                 cnt += 1
  132.                 gamethread.delayed(0.2*cnt, self.checkSettings, (i))
  133.        
  134.     def death(self):
  135.         self.alive = False
  136.         self.firstPerson()
  137.         self.solid()
  138.         self.unfreeze()
  139.        
  140.     def itemPickup(self, item):
  141.         if self.team == 2:
  142.             if not self.ct or item != 'usp':
  143.                 self.removeWeapons()
  144.             elif item == 'usp':
  145.                 gamethread.delayed(0.5, self.player.setClip, ('weapon_usp', 0))
  146.                 gamethread.delayed(0.5, self.player.setAmmo, ('weapon_usp', 0))
  147.         elif self.team == 3:
  148.             if item in ('hegrenade', 'flashbang', 'smokegrenade'):
  149.                 index = self.player.getWeaponIndex('weapon_%s' %(item))
  150.                 es.server.queuecmd('es_xremove %s' %(index))
  151.                 es.cexec(self.userid, 'lastinv')      
  152.                
  153.     def weaponFire(self):
  154.         hp = self.player.getHealth() - 4
  155.         if hp <= 0:
  156.             es.server.queuecmd('damage %s %s' %(self.userid, self.player.getHealth()))
  157.         else:
  158.             self.player.setHealth(hp)  
  159.            
  160.     def say(self, text):
  161.         if self.alive:
  162.             if self.team == 2:
  163.                 if text == '!model':
  164.                     tell(self.userid, 'Your Model: #green%s' %(self.model))
  165.                 elif text == '!t':
  166.                     infoPopup.sendTPopup(self.userid)
  167.             elif self.team == 3:  
  168.                 if text == '!ct':
  169.                     if self.weapons < 2:
  170.                         gunPopup.send(self.userid)
  171.         if text == '!cfg' and not self.configPopupSend:
  172.             infoPopup.sendConfigPopup(self.userid)
  173.             self.configPopupSend = True        
  174.            
  175.     def removeWeapons(self):
  176.         es.server.queuecmd('es_xgive %s player_weaponstrip' %(self.userid))
  177.         es.server.queuecmd('es_xfire %s player_weaponstrip strip' %(self.userid))
  178.         if self.ct:  
  179.             try:
  180.                 es.server.queuecmd('es_xgive %s weapon_usp' %(self.userid))
  181.                 gamethread.delayed(0.5, self.player.setClip, ('weapon_usp', 0))
  182.                 gamethread.delayed(0.5, self.player.setAmmo, ('weapon_usp', 0))
  183.             except:
  184.                 pass
  185.                    
  186.     def prepare(self):
  187.         es.server.queuecmd('es_xfire %s func_buyzone disable' %(self.userid))
  188.         es.server.queuecmd('es_xfire %s func_breakable break' %(self.userid))
  189.         es.server.queuecmd('es_xfire %s func_breakable_surf break' %(self.userid))
  190.        
  191.         self.whiste = 0
  192.         self.weapons = 0
  193.         self.color = 0
  194.         self.model = None
  195.         self.ct = False
  196.        
  197.         self.firstPerson()
  198.         self.solid()
  199.         self.unfreeze()  
  200.        
  201.         if self.team == 2:
  202.             self.prepareHide()
  203.         elif self.team == 3:
  204.             self.prepareSeek()
  205.         self.alive = True          
  206.        
  207.     def prepareHide(self):
  208.         self.removeWeapons()
  209.        
  210.         if curMap in modellist:      
  211.             tmp = random.randint(1, len(modellist[curMap].keys()))
  212.             self.player.setModel(modellist[curMap][tmp][1])
  213.             tell(self.userid, 'Your new Model: #green%s' %(modellist[curMap][tmp][0]))
  214.             self.model = modellist[curMap][tmp][0]
  215.        
  216.         self.player.setSpeed(1.3)
  217.            
  218.     def prepareSeek(self):    
  219.         usermsg.fade(self.userid, 1, 2, 15050, 2, 2, 2, 255)
  220.         self.player.freeze(1)
  221.         gamethread.delayed(31, self.player.freeze, (0))
  222.         self.player.setColor(255,255,255,255)
  223.  
  224.     def thirdPerson(self):
  225.         if not self.thirdView:
  226.             es.setplayerprop(self.userid, 'CBasePlayer.m_hObserverTarget', 0)
  227.             es.setplayerprop(self.userid, 'CBasePlayer.m_iObserverMode', 1)
  228.             es.setplayerprop(self.userid, 'CBasePlayer.localdata.m_Local.m_bDrawViewmodel', 0)
  229.             es.setplayerprop(self.userid, 'CBasePlayer.m_iFOV', 100)
  230.             clock.add(self.userid)
  231.             self.thirdView = True
  232.             tell(self.userid, 'Third Person: #greenActivated')
  233.            
  234.     def firstPerson(self):
  235.         if self.thirdView:
  236.             es.setplayerprop(self.userid, 'CCSPlayer.baseclass.m_hObserverTarget', 0)
  237.             if self.alive:
  238.                 es.setplayerprop(self.userid, 'CBasePlayer.m_iObserverMode', 0)
  239.                 es.setplayerprop(self.userid, 'CBasePlayer.localdata.m_Local.m_bDrawViewmodel', 1)
  240.                 es.setplayerprop(self.userid, 'CBasePlayer.m_iFOV', 90)  
  241.             clock.remove(self.userid)
  242.             self.thirdView = False
  243.             tell(self.userid, 'Third Person: #greenDeactivated')
  244.                
  245.     def nonSolid(self):
  246.         if self.solidStatus:
  247.             es.setplayerprop(self.userid, 'CBaseEntity.m_CollisionGroup', 2)
  248.             self.solidStatus = False  
  249.             tell(self.userid, 'NoBlock: #greenActivated')
  250.            
  251.     def solid(self):
  252.         if not self.solidStatus:
  253.             es.setplayerprop(self.userid, 'CBaseEntity.m_CollisionGroup', 5)
  254.             self.solidStatus = True  
  255.             tell(self.user, 'NoBlock: #greenDeactivated')
  256.            
  257.     def freeze(self):
  258.         if not self.freezeStatus:
  259.             es.setplayerprop(self.userid, 'CBasePlayer.m_fFlags', 66172)
  260.             es.setplayerprop(self.userid, 'CBaseEntity.movetype', 0)
  261.             self.freezeStatus = True
  262.             tell(self.userid, 'Freeze: #greenActivated')
  263.            
  264.     def unfreeze(self):
  265.         if self.freezeStatus:
  266.             es.setplayerprop(self.userid, 'CBasePlayer.m_fFlags', 32)
  267.             es.setplayerprop(self.userid, 'CBaseEntity.movetype', 2)
  268.             self.freezeStatus = False  
  269.             tell(self.userid, 'Freeze: #greenDeactivated')
  270.                
  271.     def checkSettings(self, val):
  272.         if self.ready:
  273.             es.queryclientvar(self.userid, val)
  274.            
  275.     def addValue(self, value):    
  276.         if not value in self.valueList:
  277.             self.valueList.append(value)
  278.             if len(self.valueList) == len(checkValues):
  279.                 self.valuesOK = True  
  280.            
  281.     def removeValue(self, value):
  282.         if value in self.valueList:
  283.             self.valueList.remove(value)
  284.         if self.team != 1:
  285.             es.server.queuecmd('es_xchangeteam %s 1' %(self.userid))
  286.             tell(self.userid, 'Your Config isnt right yet! Please look in your Console or the Popup Menu to fix it.')
  287.         self.valuesOK = False
  288.         if not self.configPopupSend:
  289.             infoPopup.sendConfigPopup(self.userid)
  290.             self.configPopupSend = True
  291.            
  292.     def getValueStatus(self):
  293.         return self.valuesOK  
  294.        
  295.     def configPopupClosed(self):
  296.         self.configPopupSend = False
  297.        
  298.     def gotWeapon(self):
  299.         self.weapons += 1
  300.        
  301.     def setCT(self):
  302.         self.ct = True
  303.         self.player.setModel('player/ct_gsg9')
  304.         es.server.queuecmd('es_xgive %s weapon_usp' %(self.userid))
  305.         gamethread.delayed(0.1, self.player.setClip, ('weapon_usp', 0))
  306.         gamethread.delayed(0.1, self.player.setAmmo, ('weapon_usp', 0))
  307.         self.model = 'CT'
  308.        
  309.     def damageDucked(self):
  310.         if self.player.isDucked():
  311.             hp = self.player.getHealth() - 10
  312.             if hp <= 0:
  313.                 es.server.queuecmd('damage %s %s' %(self.userid, self.player.getHealth()))
  314.             else:
  315.                 self.player.setHealth(hp)  
  316.             msg('#green%s #defaultis ducking, like a Mouse!' %(es.getplayername(self.userid)))
  317.        
  318. class Playerlist(object):
  319.     def __init__(self):
  320.         self.players = {}
  321.        
  322.     def __getitem__(self, key):
  323.         try:
  324.             return self.players[int(key)]
  325.         except:
  326.             return None
  327.        
  328.     def add(self, userid):
  329.         userid = int(userid)
  330.         self.players[userid] = Player(userid)
  331.        
  332.     def remove(self, userid):
  333.         userid = int(userid)
  334.         del self.players[userid]
  335.                              
  336.     def checkSettings(self, val):
  337.         for i in self.players:
  338.             try:
  339.                 self.players[i].checkSettings(val)
  340.             except:
  341.                 pass
  342.            
  343.     def damageDucked(self):
  344.         for i in playerlib.getUseridList('#t, #alive'):
  345.             self.players[i].damageDucked()
  346.  
  347. class GunPopup(object):
  348.     def __init__(self):
  349.         if popuplib.exists('sseekGunMainMenu'):
  350.             popuplib.delete('sseekGunMainMenu')      
  351.         self.main = popuplib.create('sseekGunMainMenu')
  352.         self.main.addline('Waffen Menu:')
  353.         self.main.addline('->1. Pistols')
  354.         self.main.addline('->2. Shotguns')
  355.         self.main.addline('->3. SMGs')
  356.         self.main.addline('->4. Rifles')
  357.         self.main.addline(' ')
  358.         self.main.addline('0. Close')
  359.         self.main.menuselect = self.mainChoice
  360.      
  361.         if popuplib.exists('sseekGunPistolMenu'):
  362.             popuplib.delete('sseekGunPistolMenu')  
  363.         self.pistol = popuplib.create('sseekGunPistolMenu')
  364.         self.pistol.addline('Handgun Menu:')
  365.         self.pistol.addline('->1. Glock')
  366.         self.pistol.addline('->2. USP')
  367.         self.pistol.addline('->3. P228')
  368.         self.pistol.addline('->4. Deagle')
  369.         self.pistol.addline('->5. Dual Elite')
  370.         self.pistol.addline('->6. Fiveseven')
  371.         self.pistol.addline(' ')
  372.         self.pistol.addline('->8. Back')
  373.         self.pistol.addline('0. Close')
  374.         self.pistol.menuselect = self.pistolChoice
  375.        
  376.         if popuplib.exists('sseekGunShotgunMenu'):
  377.             popuplib.delete('sseekGunShotgunMenu')  
  378.         self.shotgun = popuplib.create('sseekGunShotgunMenu')
  379.         self.shotgun.addline('Shotgun Menu:')
  380.         self.shotgun.addline('->1. M3')
  381.         self.shotgun.addline('->2. XM1014')
  382.         self.shotgun.addline(' ')
  383.         self.shotgun.addline('->8. Back')
  384.         self.shotgun.addline('0. Close')  
  385.         self.shotgun.menuselect = self.shotgunChoice
  386.        
  387.         if popuplib.exists('sseekGunSMGMenu'):
  388.             popuplib.delete('sseekGunSMGMenu')  
  389.         self.smg = popuplib.create('sseekGunSMGMenu')  
  390.         self.smg.addline('SMG Menu:')
  391.         self.smg.addline('->1. Mac10')
  392.         self.smg.addline('->2. TMP')
  393.         self.smg.addline('->3. MP5')
  394.         self.smg.addline('->4. UMP')
  395.         self.smg.addline('->5. P90')
  396.         self.smg.addline(' ')
  397.         self.smg.addline('->8. Back')
  398.         self.smg.addline('0. Close')
  399.         self.smg.menuselect = self.smgChoice
  400.    
  401.    
  402.         if popuplib.exists('sseekGunRifleMenu'):
  403.             popuplib.delete('sseekGunRifleMMenu')  
  404.         self.rifle = popuplib.create('sseekGunRifleMMenu')
  405.         self.rifle.addline('Rifle Menu:')
  406.         self.rifle.addline('->1. Galil')
  407.         self.rifle.addline('->2. Famas')
  408.         self.rifle.addline('->3. AK47')
  409.         self.rifle.addline('->4. M4A1')
  410.         self.rifle.addline('->5. SG552')
  411.         self.rifle.addline('->6. AUG')
  412.         self.rifle.addline(' ')
  413.         self.rifle.addline('->8. Back')
  414.         self.rifle.addline('0. Close')
  415.         self.rifle.menuselect = self.rifleChoice
  416.        
  417.     def mainChoice(self, userid, choice, id):
  418.         if choice == 1:
  419.             self.pistol.send(userid)  
  420.         elif choice == 2:
  421.             self.shotgun.send(userid)  
  422.         elif choice == 3:
  423.             self.smg.send(userid)  
  424.         elif choice == 4:
  425.             self.rifle.send(userid)  
  426.         elif choice != 10:
  427.             self.main.send(userid)
  428.        
  429.     def pistolChoice(self, userid, choice, id):
  430.         weapons = ('glock', 'usp', 'p228', 'deagle', 'elite', 'fiveseven')
  431.         if choice in (1,2,3,4,5,6):
  432.             player = playerlib.getPlayer(userid)
  433.             weapon = player.getSecondary()
  434.             if weapon != 0:
  435.                 index = player.getWeaponIndex(weapon)
  436.                 es.server.queuecmd('es_xremove %s' %(index))
  437.             es.server.queuecmd('es_xgive %s weapon_%s' %(userid, weapons[choice-1]))
  438.             playerlist[userid].gotWeapon()
  439.         elif choice == 8:
  440.             self.main.send(userid)
  441.         elif choice != 10:
  442.             self.pistol.send(userid)
  443.        
  444.     def shotgunChoice(self, userid, choice, id):
  445.         weapons = ('m3', 'xm1014')
  446.         if choice in (1,2):
  447.             player = playerlib.getPlayer(userid)
  448.             weapon = player.getPrimary()
  449.             if weapon != 0:
  450.                 index = player.getWeaponIndex(weapon)
  451.                 es.server.queuecmd('es_xremove %s' %(index))
  452.             es.server.queuecmd('es_xgive %s weapon_%s' %(userid, weapons[choice-1]))
  453.             playerlist[userid].gotWeapon()
  454.         elif choice == 8:
  455.             self.main.send(userid)
  456.         elif choice != 10:
  457.             self.shotgun.send(userid)
  458.        
  459.     def smgChoice(self, userid, choice, id):
  460.         weapons = ('mac10', 'tmp', 'mp5navy', 'ump', 'p90')
  461.         if choice in (1,2,3,4,5):
  462.             player = playerlib.getPlayer(userid)
  463.             weapon = player.getPrimary()
  464.             if weapon != 0:
  465.                 index = player.getWeaponIndex(weapon)
  466.                 es.server.queuecmd('es_xremove %s' %(index))
  467.             es.server.queuecmd('es_xgive %s weapon_%s' %(userid, weapons[choice-1]))
  468.             playerlist[userid].gotWeapon()
  469.         elif choice == 8:
  470.             self.main.send(userid)
  471.         elif choice != 10:
  472.             self.shotgun.send(userid)    
  473.                
  474.     def rifleChoice(self, userid, choice, id):
  475.         weapons = ('galil', 'famas', 'ak47', 'm4a1', 'sg552', 'aug')
  476.         if choice in (1,2,3,4,5,6):
  477.             player = playerlib.getPlayer(userid)
  478.             weapon = player.getPrimary()
  479.             if weapon != 0:
  480.                 index = player.getWeaponIndex(weapon)
  481.                 es.server.queuecmd('es_xremove %s' %(index))
  482.             es.server.queuecmd('es_xgive %s weapon_%s' %(userid, weapons[choice-1]))
  483.             playerlist[userid].gotWeapon()
  484.         elif choice == 8:
  485.             self.main.send(userid)
  486.         elif choice != 10:
  487.             self.rifle.send(userid)
  488.            
  489.     def send(self, userid):
  490.         self.main.send(userid)
  491.        
  492. class InfoPopup(object):
  493.     def __init__(self):
  494.         if popuplib.exists('sseekInfoConfig'):
  495.             popuplib.delete('sseekInfoConfig')
  496.         self.config = popuplib.create('sseekInfoConfig')          
  497.         self.config.addline ('Config')
  498.         self.config.addline ('----------')
  499.         self.config.addline ('->1. cl_radaralpha 0')
  500.         self.config.addline ('Configurate in Console')
  501.         self.config.addline ('Radar off: cl_radaralpha 0')
  502.         self.config.addline ('Radar on: cl_radaralpha 255')
  503.         self.config.addline ('----------')
  504.         self.config.addline ('->0. Close')  
  505.         self.config.menuselect = self.configChoice
  506.        
  507.         if popuplib.exists('sseekInfoT'):
  508.             popuplib.delete('sseekInfoT')
  509.         self.t = popuplib.create('sseekInfoT')    
  510.         self.t.addline ('SSeek - Terror')
  511.         self.t.addline ('->1. Views')
  512.         self.t.addline ('->2. Contrasts')
  513.         self.t.addline ('->3. Painting')
  514.         self.t.addline ('->4. Whistle')
  515.         self.t.addline ('->5. Movement')
  516.         self.t.addline ('->6. CT Model')
  517.         self.t.addline ('->7. Color Blink')
  518.         self.t.addline (' ')
  519.         self.t.addline ('->0. Close')
  520.         self.t.menuselect = self.tChoice
  521.  
  522.         if popuplib.exists('sseekBlink'):
  523.             popuplib.delete('sseekBlink')
  524.         self.blink = popuplib.create('sseekBlink')
  525.         self.blink.addline ('SSeek - Blink')
  526.         self.blink.addline ('->1. Start Blinking')
  527.         self.blink.addline ('->2. Stop Blinking')
  528.         self.blink.addline (' ')
  529.         self.blink.addline ('->8. Back')
  530.         self.blink.addline ('->0. Close')
  531.         self.blink.menuselect = self.Blink
  532.  
  533.         if popuplib.exists('sseekMovement'):
  534.             popuplib.delete('sseekMovement')
  535.         self.movement = popuplib.create('sseekMovement')
  536.         self.movement.addline ('SSeek - Movement')
  537.         self.movement.addline ('->1. Noblock')
  538.         self.movement.addline ('->2. Block')
  539.         self.movement.addline ('->3. Freeze')
  540.         self.movement.addline ('->4. UnFreeze')
  541.         self.movement.addline (' ')
  542.         self.movement.addline ('->8. Back')
  543.         self.movement.addline ('->0. Close')
  544.         self.movement.menuselect = self.Movement
  545.  
  546.         if popuplib.exists('sseekPaint'):
  547.             popuplib.delete('sseekPaint')
  548.         self.paint = popuplib.create('sseekPaint')
  549.         self.paint.addline('SSeek - Painting')
  550.         self.paint.addline('->1. Red')
  551.         self.paint.addline('->2. Yellow')
  552.         self.paint.addline('->3. Blue')
  553.         self.paint.addline('->4. Green')
  554.         self.paint.addline('->5. Pink')
  555.         self.paint.addline('->6. Lila')
  556.         self.paint.addline('->7. Black')
  557.         self.paint.addline('->8. Normal')
  558.         self.paint.addline(' ')
  559.         self.paint.addline('->9. Back')
  560.         self.paint.addline('->0. Close')
  561.         self.paint.menuselect = self.Paint
  562.  
  563.         if popuplib.exists('sseekViews'):
  564.             popuplib.delete('sseekViews')
  565.         self.views = popuplib.create('sseekViews')
  566.         self.views.addline ('SSeek - Views')
  567.         self.views.addline ('->1. +3rd')
  568.         self.views.addline ('->2. -3rd')
  569.         self.views.addline (' ')
  570.         self.views.addline ('->8. Back')
  571.         self.views.addline ('->0. Close')
  572.         self.views.menuselect = self.Views
  573.  
  574.         if popuplib.exists('sseekContrasts'):
  575.             popuplib.delete('sseekContrasts')
  576.         self.contrasts = popuplib.create('sseekContrasts')
  577.         self.contrasts.addline ('SSeek - Contrasts')
  578.         self.contrasts.addline ('->1. Getting Darker')
  579.         self.contrasts.addline ('->2. Getting Lighter')
  580.         self.contrasts.addline (' ')
  581.         self.contrasts.addline ('->8. Back')
  582.         self.contrasts.addline ('->0. Close')
  583.         self.contrasts.menuselect = self.Contrasts
  584.  
  585.     def Movement(self,userid,choice,id):
  586.         if choice == 1:
  587.             player = playerlist[userid]
  588.             if player.alive:
  589.                 if player.solidStatus:
  590.                     es.setplayerprop(userid, 'CBaseEntity.m_CollisionGroup', 2)
  591.                     player.solidStatus = False  
  592.                     tell(userid, 'NoBlock: #greenActivated')
  593.                     self.movement.send(userid)
  594.  
  595.         elif choice == 2:
  596.             player = playerlist[userid]
  597.             if player.alive:
  598.                 if not player.solidStatus:
  599.                     es.setplayerprop(userid, 'CBaseEntity.m_CollisionGroup', 5)
  600.                     player.solidStatus = True  
  601.                     tell(userid, 'NoBlock: #greenDeactivated')
  602.                     self.movement.send(userid)
  603.  
  604.         elif choice == 3:
  605.             player = playerlist[userid]
  606.             if player.alive:
  607.                 if not player.freezeStatus:
  608.                     es.setplayerprop(userid, 'CBasePlayer.m_fFlags', 66172)
  609.                     es.setplayerprop(userid, 'CBaseEntity.movetype', 0)
  610.                     player.freezeStatus = True
  611.                     tell(userid, 'Freeze: #greenActivated')
  612.                     self.movement.send(userid)
  613.  
  614.         elif choice == 4:
  615.             player = playerlist[userid]
  616.             if player.alive:
  617.                 if player.freezeStatus:
  618.                     es.setplayerprop(userid, 'CBasePlayer.m_fFlags', 32)
  619.                     es.setplayerprop(userid, 'CBaseEntity.movetype', 2)
  620.                     player.freezeStatus = False  
  621.                     tell(userid, 'Freeze: #greenDeactivated')
  622.                     self.movement.send(userid)
  623.  
  624.         elif choice == 8:
  625.             self.sendTPopup(userid)
  626.  
  627.     def Paint(self, userid, choice, id):
  628.         player = playerlist[userid]
  629.         if choice == 1:
  630.             if player.alive:
  631.                 player.player.setColor(255,0,0,255)
  632.                 self.paint.send(userid)
  633.                 tell(userid, 'You are now: #greenRed!')
  634.         elif choice == 2:
  635.             if player.alive:
  636.                 player.player.setColor(255,240,0,255)
  637.                 self.paint.send(userid)
  638.                 tell(userid, 'You are now: #greenYellow!')
  639.         elif choice == 3:
  640.             if player.alive:
  641.                 player.player.setColor(0,0,255,255)
  642.                 self.paint.send(userid)
  643.                 tell(userid, 'You are now: #greenBlue!')
  644.         elif choice == 4:
  645.             if player.alive:
  646.                 player.player.setColor(0,255,0,255)
  647.                 self.paint.send(userid)
  648.                 tell(userid, 'You are now: #greenGreen!')
  649.         elif choice == 5:
  650.             if player.alive:
  651.                 player.player.setColor(255,0,255,255)
  652.                 self.paint.send(userid)
  653.                 tell(userid, 'You are now: #greenPink!')
  654.         elif choice == 6:
  655.             if player.alive:
  656.                 player.player.setColor(174,0,255,255)
  657.                 self.paint.send(userid)
  658.                 tell(userid, 'You are now: #greenLila!')
  659.         elif choice == 7:
  660.             if player.alive:
  661.                 player.player.setColor(0,0,0,255)
  662.                 self.paint.send(userid)
  663.                 tell(userid, 'You are now: #greenBlack!')
  664.         elif choice == 8:
  665.             if player.alive:
  666.                 player.player.setColor(255,255,255,255)
  667.                 self.paint.send(userid)
  668.                 tell(userid, 'You are now: #greenClean!')
  669.         elif choice == 9:
  670.             if player.alive:
  671.                 self.sendTPopup(userid)
  672.  
  673.     def Blink(self, userid, choice, id):
  674.         if choice == 1:
  675.             player = playerlist[userid]
  676.             if player.alive:
  677.                 gamethread.delayedname(0.1, 'blink1', startblinking, (userid))
  678.                 self.blink.send(userid)
  679.         elif choice == 2:
  680.             player = playerlist[userid]
  681.             if player.alive:
  682.                 gamethread.cancelDelayed('blink1')
  683.                 gamethread.cancelDelayed('blink2')
  684.                 gamethread.cancelDelayed('farbe1')
  685.                 player.player.setColor(255,255,255,255)
  686.                 self.blink.send(userid)
  687.         elif choice == 8:
  688.             player = playerlist[userid]
  689.             if player.alive:
  690.                 self.sendTPopup(userid)
  691.  
  692.     def tChoice(self, userid, choice, id):
  693.         if choice == 1:
  694.             player = playerlist[userid]
  695.             if player.alive:
  696.                 self.views.send(userid)
  697.         elif choice == 2:
  698.             player = playerlist[userid]
  699.             if player.alive:
  700.                 self.contrasts.send(userid)
  701.         elif choice == 3:
  702.             player = playerlist[userid]
  703.             if player.alive:
  704.                 self.paint.send(userid)
  705.         elif choice == 4:
  706.             player = playerlist[userid]
  707.             if player.alive:
  708.                 if player.whistle < 3:
  709.                     whistle.play(userid)
  710.                     player.whistle += 1
  711.                     self.sendTPopup(userid)
  712.         elif choice == 5:
  713.             player = playerlist[userid]
  714.             if player.alive:
  715.                 self.movement.send(userid)
  716.         elif choice == 6:
  717.             player = playerlist[userid]
  718.             if player.alive:
  719.                 if not pct:
  720.                     player = playerlist[userid]
  721.                     player.ct = True
  722.                     player.player.setModel('player/ct_gsg9')
  723.                     es.server.queuecmd('es_xgive %s weapon_usp' %(userid))
  724.                     gamethread.delayed(0.1, player.player.setClip, ('weapon_usp', 0))
  725.                     gamethread.delayed(0.1, player.player.setAmmo, ('weapon_usp', 0))
  726.                     player.model = 'CT'
  727.                     global pct
  728.                     pct = 1
  729.                     self.sendTPopup(userid)
  730.                 else:
  731.                     player = playerlist[userid]
  732.                     if player.alive:
  733.                         tell(userid, 'There is actually a #greenCT in your Team.')
  734.         elif choice == 7:
  735.             player = playerlist[userid]
  736.             if player.alive:
  737.                 self.blink.send(userid)
  738.  
  739.     def Views(self, userid, choice, id):
  740.         if choice == 1:
  741.             player = playerlist[userid]
  742.             if player.alive:
  743.                 if player.team == 2:
  744.                     if not player.thirdView:
  745.                         es.setplayerprop(userid, 'CBasePlayer.m_hObserverTarget', 0)
  746.                         es.setplayerprop(userid, 'CBasePlayer.m_iObserverMode', 1)
  747.                         es.setplayerprop(userid, 'CBasePlayer.localdata.m_Local.m_bDrawViewmodel', 0)
  748.                         es.setplayerprop(userid, 'CBasePlayer.m_iFOV', 100)
  749.                         clock.add(userid)
  750.                         player.thirdView = True
  751.                         tell(userid, 'Third Person: #greenActivated')
  752.                         self.views.send(userid)
  753.  
  754.         elif choice == 2:
  755.             player = playerlist[userid]
  756.             if player.alive:
  757.                 if player.team == 2:
  758.                     if player.thirdView:
  759.                        es.setplayerprop(userid, 'CCSPlayer.baseclass.m_hObserverTarget', 0)
  760.                        if player.alive:
  761.                             es.setplayerprop(userid, 'CBasePlayer.m_iObserverMode', 0)
  762.                             es.setplayerprop(userid, 'CBasePlayer.localdata.m_Local.m_bDrawViewmodel', 1)
  763.                             es.setplayerprop(userid, 'CBasePlayer.m_iFOV', 90)  
  764.                             clock.remove(userid)
  765.                             player.thirdView = False
  766.                             tell(userid, 'Third Person: #greenDeactivated')
  767.                             self.views.send(userid)
  768.            
  769.         elif choice == 8:
  770.             self.sendTPopup(userid)
  771.  
  772.     def Contrasts(self, userid, choice, id):
  773.         if choice == 1:
  774.             player = playerlist[userid]
  775.             if player.alive:
  776.                 if player.team == 2:
  777.                     if player.color < 140:
  778.                         player.color += 20
  779.                         player.player.setColor(255 - player.color, 255 - player.color, 255 - player.color, 255)
  780.                     else:
  781.                         tell(userid, 'You reached the maximum of #greendarkness!')
  782.                     self.contrasts.send(userid)
  783.  
  784.         elif choice == 2:
  785.             player = playerlist[userid]
  786.             if player.alive:
  787.                 if player.team == 2:
  788.                     if player.color > 0:
  789.                         player.color -= 20
  790.                         player.player.setColor(255 - player.color, 255 - player.color, 255 - player.color, 255)
  791.                     else:
  792.                         tell(userid, 'You reached the maximum of #greenlightness!')
  793.                     self.contrasts.send(userid)
  794.  
  795.         elif choice == 8:
  796.             self.sendTPopup(userid)
  797.        
  798.     def configChoice(self, userid, choice, id):
  799.         if choice not in (1,2,3,10):
  800.             self.config.send(userid)
  801.         else:
  802.             playerlist[userid].configPopupClosed()
  803.        
  804.     def sendConfigPopup(self, userid):
  805.         self.config.send(userid)      
  806.        
  807.     def sendTPopup(self, userid):
  808.         self.t.send(userid)      
  809.        
  810. class Whistle(object):
  811.     def __init__(self):
  812.         self.sounds = []
  813.        
  814.     def add(self, sound, name):
  815.         if not (sound, name) in self.sounds:
  816.             self.sounds.append((sound, name))
  817.             downloadManager.add('sound/%s' %(sound))
  818.        
  819.     def play(self, userid):
  820.         tmp = random.choice(self.sounds)
  821.         es.emitsound('player', userid, tmp[0], 1.0, 0.7)
  822.         msg('#green%s #default,is making noise with: #green%s' %(es.getplayername(userid), tmp[1]))
  823.  
  824.        
  825. class MessageManager(object):
  826.     def __init__(self):
  827.         pass
  828.        
  829.     def start(self):
  830.         for i in xrange(1,6):
  831.             gamethread.delayedname(30 - i, 'sseekStart_%s' %(i), usermsg.centermsg, ('#all', 'Only %s' %(i)))
  832.         gamethread.delayedname(20, 'sseekStart_10', msg, ('The seeking starts in 10 seconds!'))
  833.         gamethread.delayedname(30, 'sseekStart_0', msg, ('The Seeker getting started!'))
  834.  
  835.     def stop(self):
  836.         tmp = (0,1,2,3,4,5,10)
  837.         for i in tmp:
  838.             gamethread.cancelDelayed('sseekStart_%s' %(i))
  839.  
  840. def startblinking(userid):
  841.     player = playerlib.getPlayer(userid)
  842.     player.setColor(102,102,102,255)
  843.     gamethread.delayedname(1, 'farbe1', player.setColor, (255,255,255,255))
  844.     gamethread.delayedname(2, 'blink2', startblinking, (userid))
  845.                  
  846. #Globale Variablen
  847.  
  848. configmaps = ConfigObj(es.getAddonPath('sseek') + '/maps.txt')
  849. modellist = {}
  850. for x in configmaps.keys():
  851.     modellist[x] = {}
  852.     cnt = 1
  853.     for y in configmaps[x]:
  854.         modellist[x][cnt] = [y, configmaps[x][y]]
  855.         cnt += 1
  856.  
  857. mapManager = MapManager()
  858. downloadManager = DownloadManager()
  859.  
  860. clock = Clock()
  861.  
  862. pct = {}
  863.  
  864. tickManager = TickManager()
  865.  
  866. playerlist = Playerlist()
  867.    
  868. gunPopup = GunPopup()
  869. infoPopup = InfoPopup()
  870.  
  871. whistle = Whistle()
  872. whistle.add('santasseek/buzzer.mp3', 'Buzzer')
  873. whistle.add('santasseek/caralarm.mp3', 'Alarm')
  874. whistle.add('santasseek/cartoon.mp3', 'Run...')
  875. whistle.add('santasseek/evillaugh.mp3', 'Evil Laugh')
  876. whistle.add('santasseek/mammi.mp3', 'Mammi')
  877. whistle.add('santasseek/mw.mp3', 'SHOUT!!!')
  878. whistle.add('santasseek/popi.mp3', 'Duck...')
  879. whistle.add('santasseek/muahaha.mp3', 'Muahaha...')
  880.  
  881. messageManager = MessageManager()
  882.  
  883.  
  884. curMap = None  
  885.  
  886. tickCounter = 0
  887. checkValues = ['cl_radaralpha']
  888.  
  889. info = es.AddonInfo()
  890. info.name = "Santas Seek"
  891. info.version = "6.0"
  892. info.author = "Santa"
  893. info.url = "http://www.s-seek.de"
  894. info.basename = "santasseek"
  895. info.description = "Hide n Seek Mod fuer CSS"
  896. info.copyright = "2010 - 2120"
  897.  
  898. #ES-Methoden
  899.  
  900. def load():
  901.     global curMap
  902.     curMap = str(es.ServerVar('eventscripts_currentmap'))
  903.    
  904.     es.set("%s" % info.basename,info.version)
  905.     es.makepublic("%s" % info.basename)
  906.    
  907.     es.server.queuecmd('eventscripts_noisy 1')
  908.    
  909.     es.set('mp_flashlight', 0)
  910.     es.set('mp_freezetime', 3)
  911.     es.set('mp_forcecamera', 0)
  912.     es.set('sv_hudhint_sound', 0)
  913.     es.set('mp_playerid', 1)
  914.     es.set('sv_allowminmodels', 0)
  915.     es.set('mp_unbalance_limit', 0)
  916.        
  917.     downloadManager.activate()
  918.    
  919.     es.addons.registerClientCommandFilter(clientCommand)
  920.    
  921. def unload():
  922.     tickManager.disable()
  923.     clock.stop()
  924.        
  925.     es.addons.unregisterClientCommandFilter(clientCommand)  
  926.    
  927. def es_map_start(ev):
  928.     global curMap
  929.     curMap = str(es.ServerVar('eventscripts_currentmap'))
  930.    
  931.     downloadManager.activate()
  932.    
  933. def player_say(ev):
  934.     playerlist[ev['userid']].say(ev['text'])
  935.    
  936. def round_start(ev):
  937.     userid = ev['userid']
  938.     mapManager.remove()    
  939.     tickManager.enable()    
  940.     messageManager.start()
  941.     global pct
  942.     pct = 0
  943.  
  944.     gamethread.cancelDelayed('blink1')
  945.     gamethread.cancelDelayed('blink2')
  946.     gamethread.cancelDelayed('farbe1')
  947.     player = playerlib.getPlayer(userid)
  948.     player.setColor(255,255,255,255)
  949.    
  950. def round_freeze_end(ev):
  951.     clock.start()
  952.    
  953. def round_end(ev):
  954.     tickManager.disable()
  955.     clock.stop()
  956.     messageManager.stop()
  957.    
  958.     for i in playerlib.getPlayerList('#t,#alive'):
  959.         es.server.queuecmd('score add %s 10' % i)
  960.         msg('All living Hiders get #green10 Points!!!')
  961.  
  962.     for a in playerlib.getPlayerList('#t'):
  963.         userid = a
  964.         popuplib.close('sseekBlink', userid)
  965.         popuplib.close('sseekMovement', userid)
  966.         popuplib.close('sseekPaint', userid)
  967.         popuplib.close('sseekViews', userid)
  968.         popuplib.close('sseekContrasts', userid)
  969.    
  970. def player_spawn(ev):
  971.     userid = ev['userid']
  972.     try:
  973.         playerlist[ev['userid']].prepare()
  974.     except:
  975.         pass  
  976.    
  977.     team = int(es.getplayerteam(userid))
  978.     if team == 2:
  979.         tell(userid, 'Hider Menu: #green!t')
  980.     if team == 3:
  981.         tell(userid, 'Seeker Menu: #green!ct')
  982.        
  983.     player = playerlib.getPlayer(userid)
  984.     player.setColor(255,255,255,255)
  985.    
  986. def player_death(ev):
  987.     userid = ev['userid']
  988.     playerlist[ev['userid']].death()
  989.     gamethread.cancelDelayed('blink1')
  990.     gamethread.cancelDelayed('blink2')
  991.     gamethread.cancelDelayed('farbe1')
  992.     player = playerlib.getPlayer(userid)
  993.     player.setColor(255,255,255,255)
  994.    
  995.     if es.getplayerteam(ev['attacker']) == 3 and int(ev['attacker']) != int(ev['userid']):
  996.         es.server.queuecmd('score add %s 2' % ev['attacker'])
  997.  
  998.     popuplib.close('sseekBlink', userid)
  999.     popuplib.close('sseekMovement', userid)
  1000.     popuplib.close('sseekPaint', userid)
  1001.     popuplib.close('sseekViews', userid)
  1002.     popuplib.close('sseekContrasts', userid)
  1003.        
  1004. def player_hurt(ev):
  1005.     hp = playerlist[ev['attacker']].player.getHealth() + int(int(ev['dmg_health']) * 0.1)
  1006.     if hp > 100:
  1007.         hp = 100
  1008.     playerlist[ev['attacker']].player.setHealth(hp)
  1009.    
  1010. def player_activate(ev):
  1011.     es.server.mp_disable_autokick(ev['userid'])
  1012.     playerlist.add(ev['userid'])
  1013.    
  1014. def player_disconnect(ev):
  1015.     playerlist.remove(ev['userid'])  
  1016.    
  1017.     if es.getplayercount() == 0:                                  
  1018.         tickManager.disable()
  1019.    
  1020. def player_team(ev):    
  1021.     playerlist[ev['userid']].changeTeam(ev['team'])  
  1022.        
  1023. def item_pickup(ev):
  1024.     playerlist[ev['userid']].itemPickup(ev['item'])      
  1025.    
  1026. def weapon_fire(ev):
  1027.     playerlist[ev['userid']].weaponFire()      
  1028.    
  1029. def es_player_variable(ev):
  1030.     if ev['variable'] in ('cl_radaralpha') and ev['status'] == 'success':
  1031.         if int(ev['value']) != 0:
  1032.             playerlist[ev['userid']].removeValue(ev['variable'])
  1033.             echo(ev['userid'], '%s the Value has to be 0' %(ev['variable']))
  1034.         else:
  1035.             playerlist[ev['userid']].addValue(ev['variable'])
  1036.  
  1037. #Eigene Methoden
  1038.  
  1039. def tickListener():
  1040.     global tickCounter
  1041.     tickCounter += 1
  1042.     if tickCounter % 10 == 0:
  1043.         clock.send()
  1044.     if tickCounter % 50 == 0:
  1045.         playerlist.checkSettings(checkValues[tickCounter/50 - 1])  
  1046.         if tickCounter/50 == len(checkValues):  
  1047.             tickCounter = 0
  1048.            
  1049. def loop():
  1050.     gamethread.delayedname(2, 'sseekLoop', loop, ())
  1051.     playerlist.damageDucked()
  1052.            
  1053. def clientCommand(userid, command):
  1054.     if command[0] == 'jointeam':
  1055.         if not playerlist[userid].getValueStatus():
  1056.             if es.getplayercount() == 1 and not tickManager.isEnabled():
  1057.                 tickManager.enable()
  1058.                 tell(userid, 'Your Config isnt checked yet! Please wait a moment')
  1059.             else:
  1060.                 tell(userid, 'Your Config isnt right yet! Please look in your Console or the Popup Menu to fix it.')
  1061.             return False
  1062.         elif command[1] == '3':
  1063.             sizeT = int(es.getplayercount(2))
  1064.             sizeCT = int(es.getplayercount(3))  
  1065.             if sizeT <= 20 and sizeCT > 4:
  1066.                 tell(userid, 'The Seeker Team is full.')
  1067.                 return False
  1068.             elif sizeT > 20 and sizeCT > 6:
  1069.                 tell(userid, 'The Seeker Team is full.')
  1070.                 return False
  1071.     return True
  1072.    
  1073. def msg(text):
  1074.     es.msg('#multi', '#green[ #defaultS-Seek #lightgreen%s #green]#default %s' %(info.version, text))
  1075.    
  1076. def tell(userid, text):
  1077.     es.tell(userid, '#multi', '#green[ #defaultS-Seek #lightgreen%s #green]#default %s' %(info.version, text))
  1078.  
  1079. def echo(userid, text):
  1080.     es.cexec(userid, 'echo', '[S-Seek %s] %s' %(info.version, text))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top