def load(): config.execute() lmv['command'] = str(lmv_command) if lmv['command']: cmdlib.registerSayCommand(lmv['command'],sendVote,'Send Player Vote popup') cmdlib.registerClientCommand(lmv['command'],sendVote,'Send Player Vote popup') ini = cfglib.AddonINI(addonpath + '/strings.ini') ini.addValueToGroup('Vote on GamePlay','en','Vote for next GamePlay:') ini.addValueToGroup('Vote on Map','en','Vote on a Map:') ini.addValueToGroup('Start GamePlay Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to vote for the next GamePlay') ini.addValueToGroup('End GamePlay Vote','en','#green[LooneyMapVote]#default Next GamePlay will be#lightgreen $gameplay#default!') ini.addValueToGroup('Start Map Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to Vote for the next Map') ini.addValueToGroup('End Map Vote','en','#green[LooneyMapVote]#default Next Map is#lightgreen $nextmap#default!') ini.addValueToGroup('Vote Not Started','en','#green[LooneyMapVote]#default Vote has not started yet') ini.addValueToGroup('Between Votes','en','#green[LooneyMapVote]#default Please wait to use this command, we are between votes') ini.addValueToGroup('Vote Over','en','#green[LooneyMapVote]#default Sorry, voting is over') ini.addValueToGroup('NextMap Decided','en','#green[LooneyMapVote]#default NextMap has already been decided.#lightgreen NextMap#default:#green $nextmap') ini.addValueToGroup('Already Voted','en','#green[LooneyMapVote]#default You already voted for#lightgreen $playervote') ini.addValueToGroup('Player Vote','en','#green[LooneyMapVote]#default $player voted for#lightgreen $choice') ini.addValueToGroup('Time Remaining','en','#green[LooneyMapVote]#default Vote ends in $seconds seconds') ini.addValueToGroup('One Second Remains','en','#green[LooneyMapVote]#default Vote ends in 1 second') lmv['maps'] = cfglib.AddonINI(addonpath + '/maptypes.ini') for mapbsp in os.listdir(str(es.ServerVar('eventscripts_gamedir')) + '/maps/'): if not mapbsp.endswith('.bsp'): continue mapname = mapbsp[0:~3] if mapname in str(lmv_maps_to_not_use).split(','): continue allmaps.add(mapname) if notInHeader(mapname): prefix = mapname.split('_')[0] + '_' lmv['maps'].addValueToGroup(prefix,getNumber(prefix),mapname) lmv['maps'].write() serverlang = langlib.getDefaultLang() for gameplay in lmv['maps']: ini.addValueToGroup(gameplay,serverlang,gameplay) first = True for group in ini: if first: first = False else: ini.setGroupComments(group,'') ini.write() lmv['lang'] = langlib.Strings(ini) if lmv_scripts_for_gameplay: scriptpath = addonpath + '/scriptmanager' if not os.path.isdir(scriptpath): os.makedirs(scriptpath) for gameplay in lmv['maps']: gameplay_ini[gameplay] = cfglib.AddonINI(scriptpath + '/%s.ini'%gameplay) gameplay_ini[gameplay].addValueToGroup('Scripts','1','') gameplay_ini[gameplay].setGroupComments('Scripts',['Set scripts to be loaded for maptype below','Use a different number for each and follow the same syntax']) gameplay_ini[gameplay].addValueToGroup('Configs','1','') gameplay_ini[gameplay].setGroupComments('Configs',['Set .cfg files to be executed for maptype below','Use a different number for each and follow the same syntax','Please use the path relative to <gamename>','For instance, if your cfg is in <gamename>/cfg/myconfigs/configone.cfg, you would use "cfg/myconfigs/configone"']) gameplay_ini[gameplay].write() mapVote.mapStart(str(lmv_default_gameplay)) mapVote.resetMapVote(str(es.ServerVar('eventscripts_currentmap'))) startTimeVote()
def _inputbox_handle(): userid = es.getcmduserid() count = int(es.getargc()) if count > 5: parent = es.getargv(1) if popuplib.exists(parent): module = es.getargv(2) if xa.exists(module): module = xa.find(module) keylist = langlist[str(module)] lang = es.getargv(3) key = es.getargv(4) if not key in keylist: key = es.getargv(4).replace('+', ' ') if module and lang and key in keylist: i = 5 newvalue = '' while i < count: newvalue = newvalue + ' ' + es.getargv(i) i = i + 1 newvalue = newvalue.strip() if newvalue: language = cfglib.AddonINI( "%s/modules/%s/strings.custom.ini" % (xa.coredir(), module)) language.addValueToGroup(key, lang, newvalue, True) language.write() es.tell( userid, '#green', xalang('string warning', playerlib.getPlayer(userid).get('lang'))) else: newvalue = langlist[str(module)](key, lang) try: langlist[str(module)] = module.language.getLanguage() except IOError: pass es.esctextbox( 10, userid, "Changed '" + str(keylist(key, lang)) + "' string", "Changed '%s' to '%s'\nThe language menu is open again.\nPress [ESC] a second time." % (keylist(key, lang), newvalue)) menu = _stringEditMenu(userid, module, key, parent) menu.send(userid) else: es.esctextbox(10, userid, "Invalid Entry", "<string>")
def __init__(self): # Create ini ini_path = _gamedir + '/cfg/ini_tree_auth.ini' ini = cfglib.AddonINI(ini_path) ini.unrepr = False # Quotes around strings in this case would be confusing since we only use = True or = False ini.indent_type = ' ' # Indention makes the ini much easier to read # Some comments and groups we need to enforce ini.setInitialComments(['./cfg/ini_tree_auth.ini', 'Use the space below to add players to ini_tree_auth', 'For more information see: http://www.eventscripts.com/pages/ini_tree_auth']) ini.addGroup('ROOT') ini.setGroupComments('ROOT', ['This group is usually reserved for server owners as players at level will be authorized for everything.']) ini.addGroup('ADMIN') ini.setGroupComments('ADMIN', ['This group is for players who should be allowed to use admin commands (kick, ban, etc.)']) ini.addGroup('POWERUSER') ini.setGroupComments('POWERUSER', ['This group is for players who should receive some special privileges (clan members, etc.)']) ini.addGroup('NOGROUP') ini.setGroupComments('NOGROUP', ['This group is for players who are authorized only for specific capabilities']) # If the file doesn't exist we give admin power to STEAM_ID_LAN if not os.path.isfile(ini_path): ini['ADMIN']['STEAM_ID_LAN'] = {} # Write any changes we made ini.write() self.ini_file = ini # Get client groups and capabilities from the ini self.capabilities = {} # Store each client's group by offline identifier self.clients = {} for group in ini: inigroup = ini[group] for steamid in inigroup: for s in inigroup[steamid]: # Register Mani flags they are available without being registered if s.startswith('mani_flag_'): self.capabilities[s] = 'ROOT' self.clients[steamid] = 'ROOT' else: self.clients[steamid] = group.upper() cmdlib.registerServerCommand('initreeauth_importmani', self._importManiClients, 'This command imports clients from ./cfg/mani_admin_plugin/clients.txt into ini_tree_auth.')
config.text('- Syncs the database with an internet database') config.text('THIS COMMAND SHOULD NOT BE USED WHILE PLAYERS ARE CONNECTED!') config.text(' url - (Optional) URL of database to download') config.text('') config.text('iptocountry_updatefrompath ["path"]') config.text('- Syncs the database with a local database') config.text('THIS COMMAND SHOULD NOT BE USED WHILE PLAYERS ARE CONNECTED!') config.text(' path - (Optional) Path to database file from server directory') config.text( ' Defaults to: /addons/eventscripts/_libs/python/IPToCountry.csv') config.write() ### ini = cfglib.AddonINI(addonpath.joinpath(info.basename + '_languages.ini')) ini.setInitialComments([ '# ./addons/eventscripts/%(basename)s/%(basename)s_languages.ini' % { 'basename': info.basename }, '# >>> For general addon configuration see ' + info.basename + '.cfg <<<', '', '# DO NOT translate words with $ or # in front!', '# For a list of language abbreviations please see ./addons/eventscripts/_libs/python/deflangs.ini' ]) ini.addGroup('connect') ini.addValueToGroup( 'connect', 'en', '#lightgreen$name#default has connected from #lightgreen$location#default.' )
'bomb_timer_middle_screen', 1, 'Should the bomb timer be shown in the middle of the screen? ( 0 = off | 1 = HudHint | 2 = CenterMsg )' ) bomb_timer_default_display = bomb_timer_config.cvar( 'bomb_timer_default_display', 1, 'Default settings for new connecting players') bomb_timer_default_text = bomb_timer_config.cvar( 'bomb_timer_default_text', 1, 'Default settings for new connecting players') bomb_timer_default_sound = bomb_timer_config.cvar( 'bomb_timer_default_sound', 1, 'Default settings for new connecting players') bomb_timer_config.write() # Language Strings bomb_timer_ini = cfglib.AddonINI('%s/bomb_timer.ini' % es.getAddonPath('bomb_timer')) bomb_timer_ini.addGroup('text_E') bomb_timer_ini.addValueToGroup('text_E', 'en', '#greenBomb exploded.') bomb_timer_ini.addValueToGroup('text_E', 'de', '#greenBombe ist explodiert.') bomb_timer_ini.addGroup('text_D') bomb_timer_ini.addValueToGroup('text_D', 'en', '#greenBomb defused.') bomb_timer_ini.addValueToGroup('text_D', 'de', '#greenBombe wurde entschaerft.') bomb_timer_ini.addGroup('text_P') bomb_timer_ini.addValueToGroup('text_P', 'en', '#greenBomb planted.') bomb_timer_ini.addValueToGroup('text_P', 'de', '#greenBombe wurde gelegt.') for x in [30, 20, 10, 5]: bomb_timer_ini.addGroup('text_%d' % x) bomb_timer_ini.addValueToGroup('text_%d' % x, 'en', '#green%d seconds to explosion.' % x) bomb_timer_ini.addValueToGroup('text_%d' % x, 'de',