[Tool/Web/Other] [Golang] Package for working with Query/RCON Mechanism - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (
https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] [Golang] Package for working with Query/RCON Mechanism (
/showthread.php?tid=605696)
[Golang] Package for working with Query/RCON Mechanism -
povargek - 23.04.2016
go-samp-query - Golang package for working with Query Mechanism (SA:MP)
Install
Install the package with:
Code:
go get github.com/urShadow/go-samp-query
Import it with:
Code:
import "github.com/urShadow/go-samp-query"
Examples
Send RCON cmd:
Code:
package main
import (
"fmt"
"github.com/urShadow/go-samp-query"
)
func main() {
server, err := squery.New("127.0.0.1:7777")
if err != nil {
fmt.Println("Error:", err)
return
}
response, err := server.SendRCON("rconpassword", "echo Hello, World!")
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println(response)
}
Get server info:
Code:
package main
import (
"fmt"
"github.com/urShadow/go-samp-query"
)
func main() {
server, _ := squery.New("127.0.0.1:7777")
info, _ := server.GetInfo()
fmt.Println(info.Players, info.Maxplayers, info.Hostname)
}
Repository with this:
https://github.com/urShadow/go-samp-query
Quote:
No Plagiarism - Do not try to pass something someone else has made as your own.
|
Warning:
I am not the author!!!!
Author: urShadow