Skip to content

Commit

Permalink
fixed get_playername correctly for player logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
MusclePr committed Apr 22, 2024
1 parent 3150a39 commit 0d31f45
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/player_logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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][0-9]//g'
echo "${player_info}" | sed -E 's/,([0-9A-Z]+),[0-9]+//g'
}

# Prefer REST API
Expand All @@ -30,9 +30,9 @@ done
while true; do
server_pid=$(pidof PalServer-Linux-Shipping)
if [ -n "${server_pid}" ]; then
# 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 current_player_list < <( get_players_list | tail -n +2 | 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' | sort )
# 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 or 32x zeros) while loading
# Player ID is also 00000000 (8x zeros or 32x zeros) when in character creation
mapfile -t current_player_list < <( get_players_list | tail -n +2 | sed -E '/,(0{8}|0{32}),[0-9]+/d' | sort )

# If there are current players then some may have joined
if [ "${#current_player_list[@]}" -gt 0 ]; then
Expand Down

0 comments on commit 0d31f45

Please sign in to comment.