def genRaceinfoPop(popupname, callback, userid, race): checkPop(popupname) raceinfop = popuplib.create("raceinfo_menu_%s" % userid) raceinfop.menuselect = raceinfo_handler raceinfop.addline("->%s. %s (%s levels/%s skills)" % (race, es.keygetvalue("wcsraces", race, "name"), es.keygetvalue("wcsraces", race, "numberoflevels"), es.keygetvalue("wcsraces", race, "numberofskills"))) raceinfop.addline("Credits: %s" % es.keygetvalue("wcsraces", race, "author")) raceinfop.addline("------------------------") numofskills = int(es.keygetvalue("wcsraces", race, "numberofskills")) counter = 1 scounter = 0 skillnames = es.keygetvalue("wcsraces", race, "skillnames").split("|") skilldescr = es.keygetvalue("wcsraces", race, "skilldescr").split("|") while (counter <= numofskills): raceinfop.addline("->%s. %s" % (counter, skillnames[scounter])) raceinfop.addline("%s" % skilldescr[scounter]) scounter += 1 counter += 1 raceinfop.addline("------------------------") raceinfop.addline("->8. Back") raceinfop.addline("->9. Next") gamethread.delayed(0.0001, raceinfop.send, (userid)) es.keysetvalue("wcsuserdata", userid, "raceinfo", race)
def cphone_select(userid, choice, popupname): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if choice == 10: es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileclose.mp3", 1.0) return if popupname.startswith("cphonecall"): ban_time = int(es.keygetvalue(steamid, "player_data", "ban_time")) wait_queue = int(sv('wait_queue')) if story == 0: port = find_servers() if not port: esc.tell(userid, "#255,255,255* 모든 서버가 꽉 차있습니다.") elif steamid != "142119022" and steamid != "149373723": esc.tell(userid, "#255,255,255* 서버가 개방된 상태이나 어드민만 입장할 수 있습니다.") elif ban_time > 0: esc.tell(userid, "#255,255,255* 현재 서버 입장이 밴된 상태입니다. %s초 남았습니다." %(ban_time)) elif wait_queue > 0: esc.tell(userid, "#255,255,255* 누군가가 이미 서버를 준비를 요청했기에 서버를 동시에 준비할 수 없었습니다. 다시 시도해주세요.") else: es.set("wait_queue", timerz_count + 2) dlg = msglib.VguiDialog(title="서버 접속", msg="themessage", mode=msglib.VguiMode.MENU) dlg["msg"] = "서버 접속" dlg['time'] = 10 rp = random.randint(10000,99999) dlg.addOption(msg="서버에 접속합니다.", command="connect 1.214.121.137:%s;password random%s;wait 200;password haha" %(port, rp)) dlg.send(userid) rcon_msg("1.214.121.137:%s" %(port), "es_xdoblock the_killers/server_wait;rcon changelevel cs_gentech_final_zv1;rcon sv_password random%s" %(rp)) es.keysetvalue(steamid, "player_data", "story", 1) es.keysetvalue(steamid, "player_data", "ban_time", 11) esc.msg("#255,255,255[Debug] %s Port is Idle. breaking the while.." %(port)) esc.msg("#255,255,255[Debug] %s User requested to %s port" %(es.getplayername(userid), port)) if popupname.startswith("cphonemenu"): cphone = popuplib.easymenu('cphonecall_%s' %(userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 0: cphone.addoption(0, "오랫동안 삐쩍 말라있었군, 네 형의 죽음 때문인가? 그렇지 않아?", 0) for i in range(1,6 + 1): cphone.addoption(0, " ", 0) cphone.addoption(0, "너도 의심했다시피, 네 형은 죽지 않았다. 그저 뱀년들의 간단한 트릭일 뿐이지.", 0) for i in range(1,6 + 1): cphone.addoption(0, " ", 0) cphone.addoption(0, "네 형을 만나고 싶다면 인천 남구로 와라. 그 곳에 네가 몰랐던 비밀들이 밝혀질 터이니..", 0) for i in range(1,6 + 1): cphone.addoption(0, " ", 0) for i in range(1,6 + 1): cphone.addoption(0, " ", 0) cphone.addoption(story, "그 곳으로 향한다.", 1) cphone.send(userid)
def Getplayer2(args): userid = str(args[0]) key = es.getplayersteamid(userid) if key == "BOT": name = es.getplayername(userid) name = name.upper() key = "BOT_" + name for value in wcsusers[key]: if "race_" in value: levels = wcsusers[key][value] level = levels.split('|') es.keysetvalue('wcsuserdata', userid, value, level[0])
def banPlayerMenu(playerid, selectedBanLength, popupid): # Now set the ban length selected to the correct admin in the admin keylist # Stored to the keylist so that it can be "passed" on # And to prevent other admins from stomping on each other es.keysetvalue('clanMembers', es.getplayersteamid(playerid), 'banLength', selectedBanLength) # Create keymenu called banmenu for admin to select a player from banmenu = keymenulib.create("banmenu", "userToBan", banInGame, "playerlist", "#keyvalue name", "#key", "Player List") banmenu.send(playerid) # Delete the playerlist es.server.queuecmd('es_xkeygroupdelete playerlist')
def banLengthList(playerid, selectedBanReason, popupid): # Now set the ban reason selected to the correct admin in the admin keylist # Stored to the keylist so that it can be "passed" on # And to prevent other admins from stomping on each other es.keysetvalue('clanMembers', es.getplayersteamid(playerid), 'banReason', selectedBanReason) if es.exists('keygroup', 'GlobalBan_Length'): # Open the keygroup that contains all ban lengths es.keygroupdelete('GlobalBan_Length') es.keygroupload('GlobalBan_Length', '|GlobalBan') # Create keymenu called banLengthMenu for user to select from banLengthMenu = keymenulib.create("banLengthMenu", "selectedBanLength", banPlayerMenu, "GlobalBan_Length", "#keyvalue readable", "#key", "Ban Lengths") banLengthMenu.send(playerid)
def keygroupsort_cmd(args): if len(args) > 1: keygroup = args[0] if es.exists('keygroup', keygroup): dc = {} kv = keyvalues.getKeyGroup(keygroup) sortfield = args[1] if es.exists('keyvalue', keygroup, kv.keys()[0], sortfield) or keygroup == sortfield: if len(args) > 3: sortorder = 'asc' if args[2].lower() == 'asc' else 'des' sorttype = '#alpha' if args[3].lower() == '#alpha' else '#numeric' else: sortorder = 'des' sorttype = '#numeric' for key in kv.keys(): dc[key] = {} for keyvalue in kv[key].keys(): dc[key][keyvalue] = kv[key][keyvalue] if keygroup == sortfield: if sortorder == 'asc' and sorttype == '#alpha': keylist = sorted(dc.keys()) elif sortorder == 'des' and sorttype == '#alpha': keylist = sorted(dc.keys(), reverse=True) elif sortorder == 'asc' and sorttype == '#numeric': keylist = sorted(dc.keys(), key=lambda x: int(x) if str(x).isdigit() else x) else: keylist = sorted(dc.keys(), key=lambda x: int(x) if str(x).isdigit() else x, reverse=True) else: if sortorder == 'asc' and sorttype == '#alpha': keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: x[1][sortfield])) elif sortorder == 'des' and sorttype == '#alpha': keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: x[1][sortfield], reverse=True)) elif sortorder == 'asc' and sorttype == '#numeric': keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield])) else: keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield], reverse=True)) # Let's re-create our keygroup with classic ES commands es.keygroupdelete(keygroup) es.keygroupcreate(keygroup) for key in keylist: es.keycreate(keygroup, key) for keyvalue in dc[key].keys(): es.keysetvalue(keygroup, key, keyvalue, dc[key][keyvalue]) else: es.dbgmsg(0, 'keygroupsort: Invalid field to sort provided: %s' % sortfield) else: es.dbgmsg(0, 'keygroupsort: Invalid keygroup provided: %s' % keygroup) else: es.dbgmsg(0, 'keygroupsort: Not enough arguments to keygroupsort. Syntax: keygroupsort <keygroup> <field to sort> [<des/asc #numeric/#alpha>]')
def keygroupsort_cmd(args): if len(args) > 1: keygroup = args[0] if es.exists('keygroup', keygroup): dc = {} kv = keyvalues.getKeyGroup(keygroup) sortfield = args[1] if es.exists('keyvalue', keygroup, list(kv.keys())[0], sortfield) or keygroup == sortfield: if len(args) > 3: sortorder = 'asc' if args[2].lower() == 'asc' else 'des' sorttype = '#alpha' if args[3].lower() == '#alpha' else '#numeric' else: sortorder = 'des' sorttype = '#numeric' for key in list(kv.keys()): dc[key] = {} for keyvalue in list(kv[key].keys()): dc[key][keyvalue] = kv[key][keyvalue] if keygroup == sortfield: if sortorder == 'asc' and sorttype == '#alpha': keylist = sorted(dc.keys()) elif sortorder == 'des' and sorttype == '#alpha': keylist = sorted(list(dc.keys()), reverse=True) elif sortorder == 'asc' and sorttype == '#numeric': keylist = sorted(list(dc.keys()), key=lambda x: int(x) if str(x).isdigit() else x) else: keylist = sorted(list(dc.keys()), key=lambda x: int(x) if str(x).isdigit() else x, reverse=True) else: if sortorder == 'asc' and sorttype == '#alpha': keylist = [x[0] for x in sorted(list(dc.items()), key=lambda x: x[1][sortfield])] elif sortorder == 'des' and sorttype == '#alpha': keylist = [x[0] for x in sorted(list(dc.items()), key=lambda x: x[1][sortfield], reverse=True)] elif sortorder == 'asc' and sorttype == '#numeric': keylist = [x[0] for x in sorted(list(dc.items()), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield])] else: keylist = [x[0] for x in sorted(list(dc.items()), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield], reverse=True)] # Let's re-create our keygroup with classic ES commands es.keygroupdelete(keygroup) es.keygroupcreate(keygroup) for key in keylist: es.keycreate(keygroup, key) for keyvalue in list(dc[key].keys()): es.keysetvalue(keygroup, key, keyvalue, dc[key][keyvalue]) else: es.dbgmsg(0, 'keygroupsort: Invalid field to sort provided: %s' % sortfield) else: es.dbgmsg(0, 'keygroupsort: Invalid keygroup provided: %s' % keygroup) else: es.dbgmsg(0, 'keygroupsort: Not enough arguments to keygroupsort. Syntax: keygroupsort <keygroup> <field to sort> [<des/asc #numeric/#alpha>]')
def Commander4(userid, args): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if args[0] == "cheer": if eventscripts_currentmap in NPC_MAPS: if est.isalive(userid): check = popuplib.active(userid) if check['count'] == 0: es.playsound( userid, "zeisenproject/the-killers/sounds/sndMobileopen.mp3", 1.0) cphone = popuplib.easymenu('cphonemenu_%s' % (userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 1: es.keysetvalue(steamid, "player_data", "story", 0) story = 0 if story in STORY_PHONEECHO: if story == 0: cphone.addoption("전화 받기 (형)", "전화 받기 (형)") else: cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)") cphone.send(userid) if steamid == "142119022": if args[0] == "!getloc": es.tell(userid, es.getplayerlocation(userid)) if args[0] == "!helpz": esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션") if args[0] == "!make_npc": model = args[1] if model == "!robot": model = "props/cs_office/vending_machine" name = args[2] seq = args[3] ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]") x, y, z = es.getplayerlocation(userid) esc.tell( userid, "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)" % (model, name, seq, x, y, z, ang)) npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) es.setindexprop( npcindex, "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup", 2) return True
def timerz_command(): global timerz_count timerz_count += 1 steamid_list = {} wait_queue = int(sv('wait_queue')) if wait_queue > 0 and wait_queue >= timerz_count: es.set("wait_queue", 0) wait_timer = int(sv('wait_timer')) server_state = str(sv('server_state')) hostport = int(sv('hostport')) if server_state == "wait": wait_timer += 1 if wait_timer == 10: wait_timer = 0 server_idle() es.set("wait_timer", wait_timer) else: wait_timer = 0 es.set("wait_timer", 0) for userid in es.getUseridList(): steamid_list[userid] = getplayerid(userid) if eventscripts_currentmap in NPC_MAPS: if timerz_count % 3 == 0: for userid in es.getUseridList(): steamid = steamid_list[userid] if steamid != "BOT": if est.isalive(userid): story = int( es.keygetvalue(steamid, "player_data", "story")) ban_time = int( es.keygetvalue(steamid, "player_data", "ban_time")) if ban_time > 0: ban_time -= 1 es.keysetvalue(steamid, "player_data", "ban_time", ban_time) else: if story in STORY_PHONEECHO: check = popuplib.active(userid) if check['count'] == 0: es.playsound( userid, "zeisenproject/the-killers/sounds/sndPhoneCall.wav", 1.0) refresh_hudhint()
def keygrouprand_cmd(args): if len(args) > 0: keygroup = args[0] if es.exists('keygroup', keygroup): if len(args) > 1: target = args[1] else: target = '#all' if target in ['#key', '#keyvalue', '#all']: dc = {} kv = keyvalues.getKeyGroup(keygroup) if len(args) > 2 and args[2].isdigit(): keylimit = int(args[2]) else: keylimit = len(list(kv.keys())) for key in list(kv.keys()): dc[key] = {} for keyvalue in list(kv[key].keys()): dc[key][keyvalue] = kv[key][keyvalue] if target == '#all' or target == '#key': keylist = random.sample(list(dc.keys()), keylimit) else: keylist = list(dc.keys())[:keylimit] # Let's re-create our keygroup with classic ES commands es.keygroupdelete(keygroup) es.keygroupcreate(keygroup) for key in keylist: es.keycreate(keygroup, key) if target == '#all' or target == '#keyvalue': for keyvalue in random.sample(list(dc[key].keys()), len(dc[key])): es.keysetvalue(keygroup, key, keyvalue, dc[key][keyvalue]) else: for keyvalue in list(dc[key].keys()): es.keysetvalue(keygroup, key, keyvalue, dc[key][keyvalue]) else: es.dbgmsg(0, 'keygrouprand: Invalid target provided: %s' % target) else: es.dbgmsg(0, 'keygrouprand: Invalid keygroup provided: %s' % keygroup) else: es.dbgmsg(0, 'keygrouprand: Not enough arguments to keygrouprand. Syntax: keygrouprand <keygroup> [#key/#keyvalue/#all] [keylimit]')
def timerz_command(): global timerz_count timerz_count += 1 steamid_list = {} wait_queue = int(sv('wait_queue')) if wait_queue > 0 and wait_queue >= timerz_count: es.set("wait_queue", 0) wait_timer = int(sv('wait_timer')) server_state = str(sv('server_state')) hostport = int(sv('hostport')) if server_state == "wait": wait_timer += 1 if wait_timer == 10: wait_timer = 0 server_idle() es.set("wait_timer", wait_timer) else: wait_timer = 0 es.set("wait_timer", 0) for userid in es.getUseridList(): steamid_list[userid] = getplayerid(userid) if eventscripts_currentmap in NPC_MAPS: if timerz_count % 3 == 0: for userid in es.getUseridList(): steamid = steamid_list[userid] if steamid != "BOT": if est.isalive(userid): story = int(es.keygetvalue(steamid, "player_data", "story")) ban_time = int(es.keygetvalue(steamid, "player_data", "ban_time")) if ban_time > 0: ban_time -= 1 es.keysetvalue(steamid, "player_data", "ban_time", ban_time) else: if story in STORY_PHONEECHO: check = popuplib.active(userid) if check['count'] == 0: es.playsound(userid, "zeisenproject/the-killers/sounds/sndPhoneCall.wav", 1.0) refresh_hudhint()
def Commander4(userid, args): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if args[0] == "cheer": if eventscripts_currentmap in NPC_MAPS: if est.isalive(userid): check = popuplib.active(userid) if check['count'] == 0: es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileopen.mp3", 1.0) cphone = popuplib.easymenu('cphonemenu_%s' %(userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 1: es.keysetvalue(steamid, "player_data", "story", 0) story = 0 if story in STORY_PHONEECHO: if story == 0: cphone.addoption("전화 받기 (형)", "전화 받기 (형)") else: cphone.addoption("전화 받기 (알수없음)", "전화 받기 (알수없음)") cphone.send(userid) if steamid == "142119022": if args[0] == "!getloc": es.tell(userid, es.getplayerlocation(userid)) if args[0] == "!helpz": esc.tell(userid, "#255,255,255!make_npc 모델 이름 모션") if args[0] == "!make_npc": model = args[1] if model == "!robot": model = "props/cs_office/vending_machine" name = args[2] seq = args[3] ang = es.getplayerprop(userid, "CCSPlayer.m_angEyeAngles[1]") x,y,z = es.getplayerlocation(userid) esc.tell(userid, "create_npc('%s', '%s', %s, %s, %s, %s, 255, 255, 255, 255, %s)" %(model, name, seq, x, y, z, ang)) npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) #npcindex = create_npc(model, name, seq, x, y, z, 255, 255, 255, 255, ang) es.setindexprop(npcindex, "CAI_BaseNPC.baseclass.baseclass.baseclass.baseclass.baseclass.m_CollisionGroup", 2) return True
def spendskills_handler(userid, choice, popupname): if es.exists("key", "wcsuserdata", userid): allowed = 0 race = es.keygetvalue("wcsuserdata", userid, "race") unused = int(es.keygetvalue("wcsuserdata", userid, "unused")) level = int(es.keygetvalue("wcsuserdata", userid, "level")) ultimatelevel = es.getInt("wcs_ultimatelevel") numoflevels = int(es.keygetvalue("wcsraces", race, "numberoflevels")) numofskills = int(es.keygetvalue("wcsraces", race, "numberofskills")) skillnames = es.keygetvalue("wcsraces", race, "skillnames").split("|") if choice != 10: if unused > 0: if choice <= numofskills: skill = "skill_%s" % choice skilllevel = int( es.keygetvalue("wcsuserdata", userid, skill)) if skilllevel < numoflevels: if choice == numofskills: if level >= ultimatelevel: allowed = 1 else: allowed = 1 if allowed == 1: skilllevel += 1 unused -= 1 es.keysetvalue("wcsuserdata", userid, skill, skilllevel) es.keysetvalue("wcsuserdata", userid, "unused", unused) skillname = skillnames[choice - 1] if skilllevel == 1: es.tell( userid, "#multi", "#lightgreenCongratulations, your new skill#green %s#lightgreen, is now level#green %s#lightgreen. Some skills are activated#green next round." % (skillname, skilllevel)) else: es.tell( userid, "#multi", "#lightgreenYour skill#green %s#lightgreen, is now level#green %s#lightgreen." % (skillname, skilllevel)) es.keysetvalue("wcsuserdata", userid, "skillcheck", 1) else: es.tell(userid, "#multi", "#lightgreenYou have no free#green Skill Points") if unused > 0: es.delayed(0.1, "wcs_spendskillsmenu %s" % userid)
def cphone_select(userid, choice, popupname): steamid = getplayerid(userid) story = int(es.keygetvalue(steamid, "player_data", "story")) if choice == 10: es.playsound(userid, "zeisenproject/the-killers/sounds/sndMobileclose.mp3", 1.0) return if popupname.startswith("cphonecall"): ban_time = int(es.keygetvalue(steamid, "player_data", "ban_time")) wait_queue = int(sv('wait_queue')) if story == 0: port = find_servers() if not port: esc.tell(userid, "#255,255,255* 모든 서버가 꽉 차있습니다.") elif steamid != "142119022" and steamid != "149373723": esc.tell(userid, "#255,255,255* 서버가 개방된 상태이나 어드민만 입장할 수 있습니다.") elif ban_time > 0: esc.tell( userid, "#255,255,255* 현재 서버 입장이 밴된 상태입니다. %s초 남았습니다." % (ban_time)) elif wait_queue > 0: esc.tell( userid, "#255,255,255* 누군가가 이미 서버를 준비를 요청했기에 서버를 동시에 준비할 수 없었습니다. 다시 시도해주세요." ) else: es.set("wait_queue", timerz_count + 2) dlg = msglib.VguiDialog(title="서버 접속", msg="themessage", mode=msglib.VguiMode.MENU) dlg["msg"] = "서버 접속" dlg['time'] = 10 rp = random.randint(10000, 99999) dlg.addOption( msg="서버에 접속합니다.", command= "connect 1.214.121.137:%s;password random%s;wait 200;password haha" % (port, rp)) dlg.send(userid) rcon_msg( "1.214.121.137:%s" % (port), "es_xdoblock the_killers/server_wait;rcon changelevel cs_gentech_final_zv1;rcon sv_password random%s" % (rp)) es.keysetvalue(steamid, "player_data", "story", 1) es.keysetvalue(steamid, "player_data", "ban_time", 11) esc.msg( "#255,255,255[Debug] %s Port is Idle. breaking the while.." % (port)) esc.msg("#255,255,255[Debug] %s User requested to %s port" % (es.getplayername(userid), port)) if popupname.startswith("cphonemenu"): cphone = popuplib.easymenu('cphonecall_%s' % (userid), None, cphone_select) cphone.settitle("@ Cell Phone") cphone.c_stateformat[False] = "%2" if story == 0: cphone.addoption(0, "오랫동안 삐쩍 말라있었군, 네 형의 죽음 때문인가? 그렇지 않아?", 0) for i in range(1, 6 + 1): cphone.addoption(0, " ", 0) cphone.addoption(0, "너도 의심했다시피, 네 형은 죽지 않았다. 그저 뱀년들의 간단한 트릭일 뿐이지.", 0) for i in range(1, 6 + 1): cphone.addoption(0, " ", 0) cphone.addoption( 0, "네 형을 만나고 싶다면 인천 남구로 와라. 그 곳에 네가 몰랐던 비밀들이 밝혀질 터이니..", 0) for i in range(1, 6 + 1): cphone.addoption(0, " ", 0) for i in range(1, 6 + 1): cphone.addoption(0, " ", 0) cphone.addoption(story, "그 곳으로 향한다.", 1) cphone.send(userid)
def keygroupsort_cmd(args): if len(args) > 1: keygroup = args[0] if es.exists("keygroup", keygroup): dc = {} kv = keyvalues.getKeyGroup(keygroup) sortfield = args[1] if es.exists("keyvalue", keygroup, kv.keys()[0], sortfield) or keygroup == sortfield: if len(args) > 3: sortorder = "asc" if args[2].lower() == "asc" else "des" sorttype = "#alpha" if args[3].lower() == "#alpha" else "#numeric" else: sortorder = "des" sorttype = "#numeric" for key in kv.keys(): dc[key] = {} for keyvalue in kv[key].keys(): dc[key][keyvalue] = kv[key][keyvalue] if keygroup == sortfield: if sortorder == "asc" and sorttype == "#alpha": keylist = sorted(dc.keys()) elif sortorder == "des" and sorttype == "#alpha": keylist = sorted(dc.keys(), reverse=True) elif sortorder == "asc" and sorttype == "#numeric": keylist = sorted(dc.keys(), key=lambda x: int(x) if str(x).isdigit() else x) else: keylist = sorted(dc.keys(), key=lambda x: int(x) if str(x).isdigit() else x, reverse=True) else: if sortorder == "asc" and sorttype == "#alpha": keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: x[1][sortfield])) elif sortorder == "des" and sorttype == "#alpha": keylist = map(lambda x: x[0], sorted(dc.items(), key=lambda x: x[1][sortfield], reverse=True)) elif sortorder == "asc" and sorttype == "#numeric": keylist = map( lambda x: x[0], sorted( dc.items(), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield], ), ) else: keylist = map( lambda x: x[0], sorted( dc.items(), key=lambda x: int(x[1][sortfield]) if str(x[1][sortfield]).isdigit() else x[1][sortfield], reverse=True, ), ) # Let's re-create our keygroup with classic ES commands es.keygroupdelete(keygroup) es.keygroupcreate(keygroup) for key in keylist: es.keycreate(keygroup, key) for keyvalue in dc[key].keys(): es.keysetvalue(keygroup, key, keyvalue, dc[key][keyvalue]) else: es.dbgmsg(0, "keygroupsort: Invalid field to sort provided: %s" % sortfield) else: es.dbgmsg(0, "keygroupsort: Invalid keygroup provided: %s" % keygroup) else: es.dbgmsg( 0, "keygroupsort: Not enough arguments to keygroupsort. Syntax: keygroupsort <keygroup> <field to sort> [<des/asc #numeric/#alpha>]", )
def keysetvalue(argv): es.keysetvalue(*argv)
def make_player(steamid): es.keygroupdelete(steamid) es.keygroupcreate(steamid) es.keycreate(steamid, "player_data") count = 0 while count < 200: count += 1 es.keysetvalue(steamid, "player_data", "item%s" %(count), 0) es.keysetvalue(steamid, "player_data", "callname", "[Beginner]") es.keysetvalue(steamid, "player_data", "xp", 0) es.keysetvalue(steamid, "player_data", "nextxp", 9999) es.keysetvalue(steamid, "player_data", "skin", "sas") es.keysetvalue(steamid, "player_data", "primary_weapon", "none") es.keysetvalue(steamid, "player_data", "secondary_weapon", "none") es.keysetvalue(steamid, "player_data", "gore", 1) es.keysetvalue(steamid, "player_data", "remember_map", 0) es.keysetvalue(steamid, "player_data", "ban_time", 0) es.keysetvalue(steamid, "player_data", "story", 0)
def make_player(steamid): es.keygroupdelete(steamid) es.keygroupcreate(steamid) es.keycreate(steamid, "player_data") count = 0 while count < 200: count += 1 es.keysetvalue(steamid, "player_data", "item%s" % (count), 0) es.keysetvalue(steamid, "player_data", "callname", "[Beginner]") es.keysetvalue(steamid, "player_data", "xp", 0) es.keysetvalue(steamid, "player_data", "nextxp", 9999) es.keysetvalue(steamid, "player_data", "skin", "sas") es.keysetvalue(steamid, "player_data", "primary_weapon", "none") es.keysetvalue(steamid, "player_data", "secondary_weapon", "none") es.keysetvalue(steamid, "player_data", "gore", 1) es.keysetvalue(steamid, "player_data", "remember_map", 0) es.keysetvalue(steamid, "player_data", "ban_time", 0) es.keysetvalue(steamid, "player_data", "story", 0)