added chat command for ping and hideid

/ping , /ping 113 , /hideid /showid
This commit is contained in:
Ayush Saini 2022-11-20 23:10:06 +05:30
parent 23c0fa7a9b
commit 7f11eca20b
6 changed files with 487 additions and 450 deletions

View file

@ -34,6 +34,8 @@ Here you can ban player , mute them , disable their kick votes
- Rank System. - Rank System.
- Chat commands. - Chat commands.
- V2 Account with cloud console for server. - V2 Account with cloud console for server.
- check clients ping , use /ping chat command to check ping of any player._ba.get_client_ping().
- Hide player specs from cleints, chatcommand /hideid /showid .
- Easy role management , create 1000 of roles as you wish add specific chat command to the role , give tag to role ..many more. - Easy role management , create 1000 of roles as you wish add specific chat command to the role , give tag to role ..many more.
- Rejoin cooldown. - Rejoin cooldown.
- Leaderboard , top 3 rank players name on top right corner. - Leaderboard , top 3 rank players name on top right corner.

View file

@ -6,7 +6,7 @@ import ba, _ba, time, setting
import ba.internal import ba.internal
import _thread import _thread
from tools import playlist from tools import playlist
Commands = ['lm', 'gp', 'party', 'quit', 'kickvote','maxplayers','playlist','ban','kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause', 'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand','getroles', 'removecmd', 'changetag','customtag','customeffect','add', 'spectators', 'lobbytime'] Commands = ['showid','hideid','lm', 'gp', 'party', 'quit', 'kickvote','maxplayers','playlist','ban','kick', 'remove', 'end', 'quit', 'mute', 'unmute', 'slowmo', 'nv', 'dv', 'pause', 'cameramode', 'createrole', 'addrole', 'removerole', 'addcommand', 'addcmd', 'removecommand','getroles', 'removecmd', 'changetag','customtag','customeffect','add', 'spectators', 'lobbytime']
CommandAliases = ['max','rm', 'next', 'restart', 'mutechat', 'unmutechat', 'sm', 'slow', 'night', 'day', 'pausegame', 'camera_mode', 'rotate_camera','effect'] CommandAliases = ['max','rm', 'next', 'restart', 'mutechat', 'unmutechat', 'sm', 'slow', 'night', 'day', 'pausegame', 'camera_mode', 'rotate_camera','effect']
@ -36,7 +36,10 @@ def ExcelCommand(command, arguments, clientid, accountid):
end(arguments) end(arguments)
elif command == 'kickvote': elif command == 'kickvote':
kikvote(arguments, clientid) kikvote(arguments, clientid)
elif command == 'hideid':
hide_player_spec()
elif command == "showid":
show_player_spec()
elif command == 'lm': elif command == 'lm':
last_msgs(clientid) last_msgs(clientid)
@ -109,6 +112,13 @@ def ExcelCommand(command, arguments, clientid, accountid):
elif command == 'lobbytime': elif command == 'lobbytime':
change_lobby_check_time(arguments) change_lobby_check_time(arguments)
def hide_player_spec():
_ba.hide_player_device_id(True)
def show_player_spec():
_ba.hide_player_device_id(False)
def changepartysize(arguments): def changepartysize(arguments):
if len(arguments)==0: if len(arguments)==0:
ba.internal.chatmessage("enter number") ba.internal.chatmessage("enter number")

View file

@ -4,7 +4,7 @@ import ba.internal
from stats import mystats from stats import mystats
from ba._general import Call from ba._general import Call
import _thread import _thread
Commands = ['me', 'list', 'uniqeid'] Commands = ['me', 'list', 'uniqeid','ping']
CommandAliases = ['stats', 'score', 'rank', 'myself', 'l', 'id', 'pb-id', 'pb', 'accountid'] CommandAliases = ['stats', 'score', 'rank', 'myself', 'l', 'id', 'pb-id', 'pb', 'accountid']
@ -31,10 +31,30 @@ def ExcelCommand(command, arguments, clientid, accountid):
elif command in ['uniqeid', 'id', 'pb-id', 'pb' , 'accountid']: elif command in ['uniqeid', 'id', 'pb-id', 'pb' , 'accountid']:
accountid_request(arguments, clientid, accountid) accountid_request(arguments, clientid, accountid)
elif command in ['ping']:
get_ping(arguments, clientid)
def get_ping(arguments, clientid):
if arguments == [] or arguments == ['']:
send(f"Your ping {_ba.get_client_ping(clientid)}ms ", clientid)
else:
try:
session = ba.internal.get_foreground_host_session()
for index, player in enumerate(session.sessionplayers):
name = player.getname(full=True,icon = False),
if player.inputdevice.client_id == int(arguments[0]):
ping = _ba.get_client_ping(int(arguments[0]))
send(f" {name}'s ping {ping}ms", clientid)
except:
return
def stats(ac_id,clientid): def stats(ac_id,clientid):
stats=mystats.get_stats_by_id(ac_id) stats=mystats.get_stats_by_id(ac_id)
if stats: if stats:
@ -87,4 +107,3 @@ def accountid_request(arguments, clientid, accountid):
except: except:
return return

View file

@ -89,6 +89,7 @@ def bootstraping():
_ba.set_server_name(settings["HostName"]) _ba.set_server_name(settings["HostName"])
_ba.set_transparent_kickvote(settings["ShowKickVoteStarterName"]) _ba.set_transparent_kickvote(settings["ShowKickVoteStarterName"])
_ba.set_kickvote_msg_type(settings["KickVoteMsgType"]) _ba.set_kickvote_msg_type(settings["KickVoteMsgType"])
_ba.hide_player_device_id(settings["Anti-IdRevealer"])
# check for auto update stats # check for auto update stats
_thread.start_new_thread(mystats.refreshStats, ()) _thread.start_new_thread(mystats.refreshStats, ())
@ -122,6 +123,8 @@ def bootstraping():
if settings["whitelist"]: if settings["whitelist"]:
pdata.load_white_list() pdata.load_white_list()
#
import_discord_bot() import_discord_bot()
import_games() import_games()
import_dual_team_score() import_dual_team_score()

View file

@ -5,7 +5,7 @@ import ba.internal
import time import time
last_end_vote_start_time = 0 last_end_vote_start_time = 0
end_vote_duration = 30 end_vote_duration = 50
game_started_on = 0 game_started_on = 0
min_game_duration_to_start_end_vote = 30 min_game_duration_to_start_end_vote = 30
@ -66,6 +66,8 @@ def required_votes(players):
return 4 return 4
elif players == 8: elif players == 8:
return 4 return 4
elif players == 10:
return 5
else: else:
return players - 4 return players - 4
@ -90,7 +92,7 @@ def update_vote_text(votes_needed):
votes_needed) votes_needed)
})).autoretain() })).autoretain()
activity.end_vote_text = node activity.end_vote_text = node
ba.timer(10, remove_vote_text) ba.timer(20, remove_vote_text)
def remove_vote_text(): def remove_vote_text():

View file

@ -1,6 +1,7 @@
{ {
"whitelist": false, "whitelist": false,
"useV2Account": false, "useV2Account": false,
"Anti-IdRevealer": false,
"ChatCommands": { "ChatCommands": {
"BrodcastCommand": true "BrodcastCommand": true
}, },