Skip to content

Commit

Permalink
Use rconcmd listplayers for online players with epic
Browse files Browse the repository at this point in the history
  • Loading branch information
klightspeed committed Jul 29, 2020
1 parent b230c4f commit 89e80de
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tools/arkmanager
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,13 @@ function isTheServerOnline(){
# Check if anybody is connected to the server
#
function numPlayersConnected(){
if [[ -n "$arkflag_crossplay" || -n "$arkflag_epiconly" ]]; then
players="$(rconcmd listplayers 2>/dev/null)"
if [[ "$players" == '"'?*'"' ]]; then
echo "$players" | wc -l
fi
fi
if [ -n "$arkUsePlayerList" ]; then
perl -MSocket -e '
my $port = int($ARGV[0]);
Expand Down Expand Up @@ -3253,7 +3260,9 @@ printStatus(){
echo -e "$NORMAL" "Server running: " "$RED" "No" "$NORMAL"
fi
if isTheServerUp ;then
if [ -n "$arkflag_epiconly" ]; then
echo -e "$NORMAL" "Cannot check server status with -epiconly"
elif isTheServerUp ;then
echo -e "$NORMAL" "Server listening: " "$RED" "No" "$NORMAL"
else
echo -e "$NORMAL" "Server listening: " "$GREEN" "Yes" "$NORMAL"
Expand All @@ -3269,7 +3278,7 @@ printStatus(){
my $players = ord(substr($rest, 2, 1));
my $maxplayers = ord(substr($rest, 3, 1));
print "Server Name: $servername\n";
print "Players: $players / $maxplayers\n";
print "Steam Players: $players / $maxplayers\n";
send($socket, "\xff\xff\xff\xff\x55\xff\xff\xff\xff", 0, $sockaddr);
$data = "";
recv($socket, $data, 1400, 0) or (print "Challenge request failed" and exit(1));
Expand All @@ -3291,7 +3300,7 @@ printStatus(){
$active = $active + 1;
}
}
print "Active Players: $active\n";
print "Active Steam Players: $active\n";
' "$(getQueryPort)" "$(getMultiHomeIP)"
if isTheServerOnline; then
Expand All @@ -3303,6 +3312,13 @@ printStatus(){
fi
fi
if [[ -n "$arkflag_crossplay" || -n "$arkflag_epiconly" ]]; then
players="$(rconcmd listplayers 2>/dev/null)"
if [[ "$players" == '"'?*'"' ]]; then
echo "Active Players: $(echo "$players" | wc -l)"
fi
fi
instver="$(getCurrentVersion)"
echo -e "$NORMAL" "Server build ID: " "$GREEN" $instver "$NORMAL"
instbeta="$(getCurrentBranch)"
Expand Down

0 comments on commit 89e80de

Please sign in to comment.