mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-12 10:58:28 +00:00
Merge pull request #561 from FezVrasta/1.6-dev.unstable
* Fix `A2S_PLAYERS` query usage - count players that are named * Add `installmods` command to install all mods that are specified in the config
This commit is contained in:
commit
01031e7239
@ -226,6 +226,10 @@ instances.
|
||||
`checkupdate`::
|
||||
Checks if an ARK server update is available
|
||||
|
||||
`installmods`::
|
||||
Installs all mods specified in the instance config into the
|
||||
`ShooterGame/Content/Mods` directory
|
||||
|
||||
`installmod <modnum>`::
|
||||
Installs the specified mod into the `ShooterGame/Content/Mods`
|
||||
directory
|
||||
|
||||
@ -616,7 +616,17 @@ function numPlayersConnected(){
|
||||
}
|
||||
ord(substr($data, 4, 1)) != 0x44 and (print "-1" and exit(1));
|
||||
my $players = ord(substr($data, 5, 1));
|
||||
print "$players\n";
|
||||
my $active = 0;
|
||||
my $pdata = substr($data, 6);
|
||||
for my $i (0 .. $players) {
|
||||
my $idx = ord(substr($pdata, 0, 1));
|
||||
my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2);
|
||||
$pdata = substr($rest, 8);
|
||||
if ($name ne "") {
|
||||
$active = $active + 1;
|
||||
}
|
||||
}
|
||||
print "$active\n";
|
||||
' "$(getQueryPort)" "${ark_MultiHome:-127.0.0.1}"
|
||||
else
|
||||
perl -MSocket -e '
|
||||
@ -1792,6 +1802,15 @@ doInstallMod(){
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Downloads and installs all requested mods
|
||||
#
|
||||
doInstallAllMods(){
|
||||
for modid in $(getModIds); do
|
||||
doInstallMod "$modid"
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Removes mod from mods directory
|
||||
#
|
||||
@ -2114,7 +2133,17 @@ printStatus(){
|
||||
}
|
||||
ord(substr($data, 4, 1)) != 0x44 and (print ("A2S_PLAYERS Response: : " . unpack("H*", $data)) and exit(1));
|
||||
my $players = ord(substr($data, 5, 1));
|
||||
print "Active Players: $players\n";
|
||||
my $active = 0;
|
||||
my $pdata = substr($data, 6);
|
||||
for my $i (0 .. $players) {
|
||||
my $idx = ord(substr($pdata, 0, 1));
|
||||
my ($name, $rest) = split(/\x00/, substr($pdata, 1), 2);
|
||||
$pdata = substr($rest, 8);
|
||||
if ($name ne "") {
|
||||
$active = $active + 1;
|
||||
}
|
||||
}
|
||||
print "Active Players: $active\n";
|
||||
' "$(getQueryPort)" "${ark_MultiHome:-127.0.0.1}"
|
||||
|
||||
if isTheServerOnline; then
|
||||
@ -2456,6 +2485,9 @@ main(){
|
||||
installmod)
|
||||
doInstallMod "${args[@]}"
|
||||
;;
|
||||
installmods)
|
||||
doInstallAllMods
|
||||
;;
|
||||
uninstallmod)
|
||||
doUninstallMod "${args[@]}"
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user