From 2ba2023923078ee041a79c8833621b6b4bae3ecd Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Wed, 21 Feb 2024 18:42:05 -0500 Subject: [PATCH] Fixed for any size player id --- scripts/player_logging.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/player_logging.sh b/scripts/player_logging.sh index 8bdc80eb3..d311ef76c 100644 --- a/scripts/player_logging.sh +++ b/scripts/player_logging.sh @@ -9,15 +9,16 @@ get_steamid(){ get_playername(){ local player_info="${1}" - echo "${player_info}" | sed -E 's/,[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]//g' + echo "${player_info}" | sed -E 's/,([0-9]+),[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]//g' } old_player_list=( ) while true; do mapfile -t server_pids < <(pgrep PalServer-Linux) if [ "${#server_pids[@]}" -ne 0 ]; then - # Player IDs are usally 9 digits however when a player joins for the first time for a given boot their ID is temporary 00000000 (8x zeros) - mapfile -t new_player_list < <( get_players_list | sed -E 's/,([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|00000000),([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])/,\2/g' ) + # Player IDs are usally 9 or 10 digits however when a player joins for the first time for a given boot their ID is temporary 00000000 (8x zeros) while loading + # Player ID is also 00000000 (8x zeros) when in character creation + mapfile -t new_player_list < <( get_players_list | sed '/,00000000,[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/d' ) # No players if [ "${#new_player_list[@]}" -gt 0 ] && [ "${#old_player_list[@]}" -gt 0 ]; then mapfile -t players_change_list < <( comm -23 \