Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. ########################
  2. #####WAIT CT REWRITTEN##
  3. ##### BY JACKMASTER#####
  4. ########################
  5.  
  6. import es
  7. import cPickle
  8. import os
  9.  
  10. addonpath = es.getAddonPath("CTWait").replace("\\", "/")
  11. dbpath = os.path.join(addonpath, "CTWait.db")
  12. need_rounds = 50
  13. rounds = {}
  14. try:
  15.     rounds = cPickle.load(open(dbpath, "rb"))
  16. except:
  17.     pass
  18.  
  19. def round_start(ev):
  20.     for p in es.getUseridList():
  21.         sid = es.getplayersteamid(p)
  22.         t = es.getplayerteam(p)
  23.         if not sid in ['BOT', 'STEAM_ID_LAN', 'STEAM_ID_PENDING']:
  24.             if t == 3:
  25.                 if not round.has_key(sid):
  26.                     rounds[sid] = {}
  27.                 if not rounds[sid].has_key('roundcounter']:
  28.                     rounds[sid]['roundcounter'] = 0
  29.                    
  30.                 rounds[sid]['roundcounter'] += 1
  31.    
  32.     cPickle.dump(rounds, open(dbpath, "wb"))
  33.    
  34.  
  35.  
  36.  
  37. def player_team(ev):
  38.     steamid = ev['es_steamid']
  39.     newteam = ev['team']
  40.     change_allowed = False
  41.     if newteam == '3':
  42.         if rounds.has_key(steamid):
  43.             if rounds[steamid].has_key('roundcounter'):
  44.                 if rounds[steamid]['roundcounter'] >= need_rounds:
  45.                     change_allowed = True
  46.     if not change_allowed:
  47.         es.tell(userid, '#multi', 'du kannst noch nicht zu CT gehen')
  48.        
  49. def unload():
  50.     cPickle.dump(rounds, open(dbpath, "wb"))
  51.  
  52. ########################
  53. #####WAIT CT REWRITTEN##
  54. ##### BY JACKMASTER#####
  55. ########################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement