mirror of
https://github.com/hypervortex/VH-Bombsquad-Modded-Server-Files
synced 2025-11-07 17:36:08 +00:00
Update Management.py
This commit is contained in:
parent
b3878f6550
commit
17fe95b460
1 changed files with 76 additions and 31 deletions
|
|
@ -229,17 +229,28 @@ def partyname(arguments, client_id, ac_id):
|
||||||
|
|
||||||
|
|
||||||
def kick(arguments, clientid, ac_id):
|
def kick(arguments, clientid, ac_id):
|
||||||
cl_id = int(arguments[0])
|
try:
|
||||||
for me in ba.internal.get_game_roster():
|
# Extract client IDs
|
||||||
if me["client_id"] == clientid:
|
cl_ids = [int(arg) for arg in arguments]
|
||||||
myself = me["display_string"]
|
|
||||||
for ros in ba.internal.get_game_roster():
|
# Get display string of the player issuing the command
|
||||||
if ros["client_id"] == cl_id:
|
for me in ba.internal.get_game_roster():
|
||||||
logger.log(f'kicked {ros["display_string"]}')
|
if me["client_id"] == clientid:
|
||||||
sendchat(f'{myself} kicked {ros["display_string"]} Goodbye 👋')
|
myself = me["display_string"]
|
||||||
ba.internal.disconnect_client(cl_id) # Disconnect the player being kicked
|
break
|
||||||
return
|
|
||||||
|
# Iterate over the provided client IDs
|
||||||
|
for cl_id in cl_ids:
|
||||||
|
for ros in ba.internal.get_game_roster():
|
||||||
|
if ros["client_id"] == cl_id:
|
||||||
|
logger.log(f'kicked {ros["display_string"]}')
|
||||||
|
sendchat(f'{myself} kicked {ros["display_string"]} Goodbye 👋')
|
||||||
|
ba.internal.disconnect_client(cl_id) # Disconnect the player being kicked
|
||||||
|
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def kikvote(arguments, clientid):
|
def kikvote(arguments, clientid):
|
||||||
if arguments == [] or arguments == [''] or len(arguments) < 2:
|
if arguments == [] or arguments == [''] or len(arguments) < 2:
|
||||||
|
|
@ -324,25 +335,33 @@ def end(arguments):
|
||||||
|
|
||||||
def ban(arguments, clientid, ac_id):
|
def ban(arguments, clientid, ac_id):
|
||||||
try:
|
try:
|
||||||
cl_id = int(arguments[0])
|
# Extract client IDs and duration
|
||||||
duration = int(arguments[1]) if len(arguments) >= 2 else 0.5
|
cl_ids = [int(arg) for arg in arguments]
|
||||||
|
duration = int(arguments[-1]) if len(arguments) >= 2 else 0.5
|
||||||
|
|
||||||
|
# Get display string of the player issuing the command
|
||||||
for me in ba.internal.get_game_roster():
|
for me in ba.internal.get_game_roster():
|
||||||
if me["client_id"] == clientid:
|
if me["client_id"] == clientid:
|
||||||
myself = me["display_string"]
|
myself = me["display_string"]
|
||||||
for ros in ba.internal.get_game_roster():
|
break
|
||||||
if ros["client_id"] == cl_id:
|
|
||||||
pdata.ban_player(ros['account_id'], duration,
|
# Iterate over the provided client IDs
|
||||||
"by chat command")
|
for cl_id in cl_ids:
|
||||||
logger.log(f'banned {ros["display_string"]} by chat command')
|
for ros in ba.internal.get_game_roster():
|
||||||
sendchat(f'{myself} banned {ros["display_string"]} Goodbye 👋')
|
if ros["client_id"] == cl_id:
|
||||||
ba.internal.disconnect_client(cl_id) # Changed here
|
pdata.ban_player(ros['account_id'], duration, "by chat command")
|
||||||
|
logger.log(f'banned {ros["display_string"]} by chat command')
|
||||||
|
sendchat(f'{myself} banned {ros["display_string"]} Goodbye 👋')
|
||||||
|
|
||||||
|
# Disconnect the banned player
|
||||||
|
ba.internal.disconnect_client(cl_id)
|
||||||
|
|
||||||
## backup part
|
## backup part
|
||||||
for account in serverdata.recents: # backup case if player left the server
|
for account in serverdata.recents: # backup case if player left the server
|
||||||
if account['client_id'] == int(arguments[0]):
|
if account['client_id'] in cl_ids:
|
||||||
pdata.ban_player(
|
pdata.ban_player(account["pbid"], duration, "by chat command")
|
||||||
account["pbid"], duration, "by chat command")
|
logger.log(f'banned {account["deviceId"]} by chat command, recents')
|
||||||
logger.log(
|
|
||||||
f'banned {account["deviceId"]} by chat command, recents')
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -738,20 +757,46 @@ def remove_custom_tag(arguments):
|
||||||
|
|
||||||
def remove_custom_effect(arguments):
|
def remove_custom_effect(arguments):
|
||||||
try:
|
try:
|
||||||
|
# Extract effect(s) and client ID(s)
|
||||||
|
if arguments[0].lower() == "all":
|
||||||
|
client_ids = [int(arg) for arg in arguments[1:]]
|
||||||
|
effects = None # No specific effects to remove
|
||||||
|
else:
|
||||||
|
effects = arguments[:-1] # All arguments except the last one (which is the client ID)
|
||||||
|
client_ids = [int(arguments[-1])] # Convert client ID to integer
|
||||||
|
|
||||||
session = ba.internal.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
|
||||||
if i.inputdevice.client_id == int(arguments[0]):
|
# Iterate over each client ID
|
||||||
pdata.remove_effect(i.get_v1_account_id())
|
for client_id in client_ids:
|
||||||
|
for player in session.sessionplayers:
|
||||||
|
if player.inputdevice.client_id == client_id:
|
||||||
|
if effects:
|
||||||
|
# Remove specified effects for the player
|
||||||
|
for effect in effects:
|
||||||
|
pdata.remove_effect(player.get_v1_account_id(), effect)
|
||||||
|
else:
|
||||||
|
# Remove all effects for the player
|
||||||
|
pdata.remove_all_effects(player.get_v1_account_id())
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def set_custom_effect(arguments):
|
def set_custom_effect(arguments):
|
||||||
try:
|
try:
|
||||||
|
# Extract effect(s) and client ID(s)
|
||||||
|
effects = arguments[:-1] # All arguments except the last one (which is the client ID)
|
||||||
|
client_ids = [int(arg) for arg in arguments[-1].split(',')] # Split client IDs if multiple are provided
|
||||||
|
|
||||||
session = ba.internal.get_foreground_host_session()
|
session = ba.internal.get_foreground_host_session()
|
||||||
for i in session.sessionplayers:
|
|
||||||
if i.inputdevice.client_id == int(arguments[1]):
|
# Iterate over each client ID
|
||||||
pdata.set_effect(arguments[0], i.get_v1_account_id())
|
for client_id in client_ids:
|
||||||
|
for i in session.sessionplayers:
|
||||||
|
if i.inputdevice.client_id == client_id:
|
||||||
|
# Iterate over each effect and set it for the player
|
||||||
|
for effect in effects:
|
||||||
|
pdata.set_effect(effect, i.get_v1_account_id())
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue