Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.40 KB | None | 0 0
  1. from __future__ import division
  2. import es
  3. import popuplib
  4. import gamethread
  5. #import cmdlib
  6.  
  7. votes = {}
  8.  
  9.  
  10.  
  11. def select(userid, choice, popupid):
  12.     user = choice
  13.     voter = userid
  14.     if votes[voter]['status'] == 0:
  15.         votes[voter]['status'] = user                          
  16.         if votes[user]['count'] >= round(es.getplayercount()/2)+ 1:
  17.             gamethread.delayed(5, es.server.queuecmd, "changelevel %s" % choice)
  18.         else:
  19.             votes[user]['count'] += 1
  20.             es.msg('#multi','Test 1 %s' % votes[user]['count'])
  21.     if votes[voter]['status'] == user:
  22.         es.msg('#multi','Test 2 %s' % votes[user]['count'])
  23.  
  24.  
  25.  
  26. def load():
  27.         cmdlib.registerSayCommand('!votemap', voteM, "Choose a Map")
  28.  
  29. def player_spawn(ev):
  30.     userid = int(ev['userid'])
  31.     if userid not in votes:
  32.         votes[userid] = {}
  33.         votes[userid]['count'] = 0
  34.         votes[userid]['status'] = 0
  35.  
  36.  
  37.  
  38. def unload():
  39.         votemap.clear()
  40.         cmdlib.unregisterSayCommand('!votemap')
  41.  
  42.  
  43. def voteM(userid, args):
  44.         name = 'votemap_menu'
  45.         if popuplib.exists(name):
  46.                 popuplib.delete(name)
  47.         votemapmenu = popuplib.easymenu(name, '_popup_choice', select)
  48.         votemapmenu.settitle('Votemap Menu:')
  49.         f = open(es.getString('eventscripts_gamedir') + '/mapcycle.txt')
  50.         m = f.read().split('\n')
  51.         f.close()
  52.         for x in m:
  53.                 votemapmenu.addoption(x, x)
  54.         votemapmenu.send(userid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement