mirror of
https://github.com/hypervortex/VH-Bombsquad-Modded-Server-Files
synced 2025-11-07 17:36:08 +00:00
Update servercheck.py
This commit is contained in:
parent
21d077e25b
commit
c809d01a1d
1 changed files with 19 additions and 10 deletions
23
dist/ba_root/mods/tools/servercheck.py
vendored
23
dist/ba_root/mods/tools/servercheck.py
vendored
|
|
@ -232,25 +232,34 @@ def on_player_join_server(pbid, player_data, ip, device_id):
|
||||||
if ros["account_id"] == pbid:
|
if ros["account_id"] == pbid:
|
||||||
clid = ros["client_id"]
|
clid = ros["client_id"]
|
||||||
device_string = ros['display_string']
|
device_string = ros['display_string']
|
||||||
|
# Check if the IP is in the join dictionary
|
||||||
if ip in ipjoin:
|
if ip in ipjoin:
|
||||||
lastjoin = ipjoin[ip]["lastJoin"]
|
lastjoin = ipjoin[ip]["lastJoin"]
|
||||||
joincount = ipjoin[ip]["count"]
|
joincount = ipjoin[ip]["count"]
|
||||||
# Check if fast joining is enabled
|
# Check if fast joining is enabled
|
||||||
if settings["JoiningFast"]["enable"]:
|
if settings.get("JoiningFast", {}).get("enable", False):
|
||||||
max_join_count = int(settings["JoiningFast"]["JoiningCount"])
|
# Get the maximum allowed join count from settings
|
||||||
|
max_join_count = int(settings["JoiningFast"].get("JoiningCount", 5)) # Adjust this value as needed
|
||||||
|
# Check if the player is joining too fast
|
||||||
if now - lastjoin < 15:
|
if now - lastjoin < 15:
|
||||||
|
# Increment the join count
|
||||||
joincount += 1
|
joincount += 1
|
||||||
if joincount > max_join_count:
|
# Send a warning message to player
|
||||||
_ba.screenmessage("Joining too fast , slow down dude", # its not possible now tho, network layer will catch it before reaching here
|
ba.screenmessage(f"You are joining too fast ({joincount}/{max_join_count}). "
|
||||||
|
"Slow down or you will be kicked.",
|
||||||
color=(1, 0, 1), transient=True,
|
color=(1, 0, 1), transient=True,
|
||||||
clients=[clid])
|
clients=[clid])
|
||||||
logger.log(f'{pbid} || kicked for joining too fast')
|
if joincount == max_join_count: # This line checks against the maximum allowed join count
|
||||||
|
# Kick the player
|
||||||
|
ba.screenmessage("You were kicked for joining too fast.",
|
||||||
|
color=(1, 0, 0), transient=True,
|
||||||
|
clients=[clid])
|
||||||
ba.internal.disconnect_client(clid)
|
ba.internal.disconnect_client(clid)
|
||||||
_thread.start_new_thread(reportSpam, (pbid,))
|
_thread.start_new_thread(reportSpam, (pbid,))
|
||||||
return
|
return # Exit the function after kicking the player
|
||||||
else:
|
else:
|
||||||
joincount = 0
|
joincount = 0
|
||||||
|
# Update the join count and time for the IP
|
||||||
ipjoin[ip]["count"] = joincount
|
ipjoin[ip]["count"] = joincount
|
||||||
ipjoin[ip]["lastJoin"] = now
|
ipjoin[ip]["lastJoin"] = now
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue