From 436285578649c499c56688f3167b49cdb27e9704 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 21 Jun 2020 15:20:36 +0200 Subject: [PATCH] test --- main.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 5b62fba..ba3671c 100644 --- a/main.go +++ b/main.go @@ -9,8 +9,9 @@ import ( func main() { var ( - clients int = 0 - paused bool = true + clients int = 0 + paused bool = true + forcePaused bool = true ) conn, err := net.Dial("tcp", "poop.siteop.biz:3977") @@ -155,8 +156,8 @@ func main() { sp.Read(b[:p.PLength]) ok, err := regexp.MatchString("\\[udp\\] queried from (.*)", sp.Text) logErrorDebug(err, "match string") - if sp.Origin != "net\x00" || ok == false { - logInfoDebug("AdminPacketServerConsole :\n- Origin: %q\n- Text: %s\n- Regexp: %v\n- Text: %v", sp.Origin, sp.Text, ok, (sp.Origin != "net")) + if sp.Origin != "net" || ok == false { + logInfoDebug("AdminPacketServerConsole :\n- Origin: %q\n- Text: %s\n- Regexp: %v\n- Text: %v", sp.Origin, sp.Text) } case AdminPacketServerRConEnd: sp := PacketServerRConEnd{ @@ -173,7 +174,15 @@ func main() { b = c read -= int(p.PLength) - if paused && clients > 0 { + if !paused && forcePaused { + paused = false + px := PacketAdminRCon{ + Packet: Packet{PType: AdminPacketAdminRCon}, + Command: "pause", + } + _, err = conn.Write(px.Bytes()) + } + if paused && !forcePaused && clients > 0 { paused = false px := PacketAdminRCon{ Packet: Packet{PType: AdminPacketAdminRCon},