23.04.2016, 12:22
go-samp-query - Golang package for working with Query Mechanism (SA:MP)
InstallInstall the package with:
Code:
go get github.com/urShadow/go-samp-query
Code:
import "github.com/urShadow/go-samp-query"
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) }
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) }
Quote:
No Plagiarism - Do not try to pass something someone else has made as your own. |
Author: urShadow