Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import division
- import es
- import popuplib
- import gamethread
- #import cmdlib
- votes = {}
- def select(userid, choice, popupid):
- user = choice
- voter = userid
- if votes[voter]['status'] == 0:
- votes[voter]['status'] = user
- if votes[user]['count'] >= round(es.getplayercount()/2)+ 1:
- gamethread.delayed(5, es.server.queuecmd, "changelevel %s" % choice)
- else:
- votes[user]['count'] += 1
- es.msg('#multi','Test 1 %s' % votes[user]['count'])
- if votes[voter]['status'] == user:
- es.msg('#multi','Test 2 %s' % votes[user]['count'])
- def load():
- cmdlib.registerSayCommand('!votemap', voteM, "Choose a Map")
- def player_spawn(ev):
- userid = int(ev['userid'])
- if userid not in votes:
- votes[userid] = {}
- votes[userid]['count'] = 0
- votes[userid]['status'] = 0
- def unload():
- votemap.clear()
- cmdlib.unregisterSayCommand('!votemap')
- def voteM(userid, args):
- name = 'votemap_menu'
- if popuplib.exists(name):
- popuplib.delete(name)
- votemapmenu = popuplib.easymenu(name, '_popup_choice', select)
- votemapmenu.settitle('Votemap Menu:')
- f = open(es.getString('eventscripts_gamedir') + '/mapcycle.txt')
- m = f.read().split('\n')
- f.close()
- for x in m:
- votemapmenu.addoption(x, x)
- votemapmenu.send(userid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement