#IMPORTS import es import cmdlib import popuplib import psyco psyco.full() #INFO info = es.AddonInfo() info.name = "Server Modes" info.version = "0.6" info.author = "Tyjuji" info.url = "none yet" info.basename = "servermodes" info.description = "Switch between ffa,jail and cw" #here goes the settings #only edit this if you dont the have mani admin plugin #remove if you have another script that uses basic_auth BASIC_AUTH_ADMIN_LIST = "STEAM_ID_LAN;STEAM_0:0:00000;" #STEAM_ID_LAN is required if you want to use it in rcon and console #Remember the ; at the end of the STEAMID list #### DONT TOUCH BELOW!!! #### def load(): #load function es.reload('popup') global thePopup #popup stuff thePopup = popuplib.create('smodes_popup') thePopup.addline('1. Exec FFA Config') thePopup.addline('2. Exec CW Config') thePopup.addline('3. Exec Jail Config') thePopup.select(1, 'servermodes_ffa') thePopup.select(2, 'servermodes_cw') thePopup.select(3, 'servermodes_jail') if es.exists('variable', 'mani_admin_plugin_version'): #the included auth switcher es.load('examples/auth/mani_basic_auth') else: es.load('examples/auth/basic_auth') es.set("BASIC_AUTH_ADMIN_LIST", BASIC_AUTH_ADMIN_LIST) es.doblock("servermodes/regcmds") es.msg(userid) def regcmds(): #the regcmds i put them in a seperate funtion to have a better overview if not es.exists('command', 'servermodes_ver'): es.regcmd('servermodes_ver', 'none', 'version cvar') es.set("servermodes_ver", info.version) if not es.exists('command', 'servermodes_ffa'): es.regcmd('servermodes_ffa', 'servermodes_ffa', 'The Server Modes FFA config') if not es.exists('command', 'servermodes_cw'): es.regcmd('servermodes_cw', 'servermodes_cw', 'The Server Modes CW config') if not es.exists('command', 'servermodes_jail'): es.regcmd('servermodes_jail', 'servermodes_jail', 'The Server modes Jail config') if not es.exists('saycommand', '!ffa'): cmdlib.registerSayCommand('!ffa', servermodes_ffa, 'The say ffa command', 'use_servermodes_ffa', 'ADMIN', saycmd_noauth) if not es.exists('saycommand', '!cw'): cmdlib.registerSayCommand('!cw', servermodes_cw, 'The say cw command', 'use_servermodes_cw', 'ADMIN', saycmd_noauth) if not es.exists('saycommand', '!jail'): cmdlib.registerSayCommand('!jail', servermodes_jail, 'The say jail command', 'use_servermodes_jail', 'ADMIN', saycmd_noauth) if not es.exists('saycommand', '!smodes'): cmdlib.registerSayCommand('!smodes', popupsender, 'The popup sender', 'use_smodespopup', 'ADMIN', saycmd_noauth) if not es.exists('command', 'servermodes_mode'): es.regcmd('servermodes_mode', 'none', 'The NONE') userid = es.getcmduserid() def popupsender(ev, userid): thePopup.send(userid) def servermodes_mode(): es.ServerCommand('echo The Cookie Is A Lie! O.o') def none(): es.ServerCommand('echo The Cookie Was A Lie? O.o') def servermodes_ffa(ev, userid): #the ffa function es.msg('Changing to FFA Config') es.ServerCommand('exec servermodesffa.cfg') es.unload('hosties') es.set('servermodes_mode', 1) def servermodes_cw(ev, userid): #the cw function es.msg('Changing to CW config') es.ServerCommand('exec servermodescw.cfg') es.unload('hosties') es.set('servermodes_mode', 2) def servermodes_jail(ev, userid): #and the jail function es.msg('Changing to Jail config') es.ServerCommand('exec servermodesjail.cfg') es.load('hosties') es.set('servermodes_mode', 3) def es_map_start(ev): if servermodes_mode == 1: es.doblock("servermodes/servermodes_ffa()") #on map start it will change the settings to ffa mode elif servermodes_mode == 2: es.doblock("servermodes/servermodes_cw()") #same as above just to cw settings elif servermodes_mode == 3: es.doblock("servermodes/servermodes_jail()") #same as above just to jail settings def saycmd_noauth(userid, args): #the noauth function es.tell(userid, '#multi #green [Server Modes]#lightgreen You are not Authorized!!!') def unload(): #unload function OFC thePopup.delete() cmdlib.unregisterSayCommand('!smodes') cmdlib.unregisterSayCommand('!ffa') cmdlib.unregisterSayCommand('!cw') cmdlib.unregisterSayCommand('!jail')