kick annoying kids, ping all command

This commit is contained in:
Ayush Saini 2023-03-24 23:16:26 +05:30
parent 7897eebd19
commit 7f95481c26
5 changed files with 29 additions and 2 deletions

View file

@ -39,7 +39,8 @@ def ExcelCommand(command, arguments, clientid, accountid):
def get_ping(arguments, clientid):
if arguments == [] or arguments == ['']:
send(f"Your ping {_ba.get_client_ping(clientid)}ms ", clientid)
elif arguments[0] == 'all':
pingall(clientid)
else:
try:
session = ba.internal.get_foreground_host_session()
@ -67,6 +68,20 @@ def stats(ac_id, clientid):
def fetch_send_stats(ac_id, clientid):
_thread.start_new_thread(stats, (ac_id, clientid,))
def pingall(clientid):
"""Returns The List Of Players Clientid and index"""
p = u'{0:^16}{1:^34}ms'
seprator = '\n______________________________\n'
list = p.format('Name', 'Ping (ms)')+seprator
session = ba.internal.get_foreground_host_session()
for index, player in enumerate(session.sessionplayers):
list += p.format(player.getname(icon=True),
_ba.get_client_ping(int(player.inputdevice.client_id)))+"\n"
send(list, clientid)
def list(clientid):
"""Returns The List Of Players Clientid and index"""

View file

@ -190,7 +190,8 @@ def add_profile(
cid = ros['client_id']
ip = _ba.get_client_ip(cid)
serverdata.clients[account_id]["lastIP"] = ip
serverdata.recents.append({"client_id":cid,"deviceId":display_string,"pbid": account_id})
serverdata.recents = serverdata.recents[-20:]
device_id = _ba.get_client_public_device_uuid(cid)
if(device_id==None):
device_id = _ba.get_client_device_uuid(cid)

View file

@ -35,6 +35,17 @@ class checkserver(object):
deviceClientMap = {}
for ros in ba.internal.get_game_roster():
ip = _ba.get_client_ip(ros["client_id"])
device_id = _ba.get_client_public_device_uuid(ros["client_id"])
if device_id not in deviceClientMap:
deviceClientMap[device_id] = [ros["client_id"]]
else:
deviceClientMap[device_id].append(ros["client_id"])
if len(deviceClientMap[device_id]) >= settings['maxAccountPerIP']:
_ba.chatmessage(f"Only {settings['maxAccountPerIP']} player per IP allowed, disconnecting this device.", clients=[ros["client_id"]])
ba.internal.disconnect_client(ros["client_id"])
logger.log(" Player disconnected, reached max players per device ||"+ ros["account_id"] ,
"playerjoin")
continue
if ip not in ipClientMap:
ipClientMap[ip] = [ros["client_id"]]
else:

Binary file not shown.

Binary file not shown.