Is it possible to grab stats of other servers (i.e. Players, map, name, gamemode) with lua?
The local server or any other server?
Other servers. Like I said.
EDIT: Actually both.
stats as in player count?
I’m a such of fast reader, You could always use MYSQL to save it every minute and then load it on the other server.
I guess I’ll end up doing that. How would I get the number of players from the local server?
Yeah I would like to know how to do this as well!
I’m glad I’m not the only one.
Does anyone know how Gametracker/HLSW pulls server information, and how to replicate in html or lua?
Did you even read?
This thread is full of stupid. You can’t get information from other servers, without the server networking it’s information to you. If you want your own servers player count you can do this.
local function PlayerCount()
Yeah you can
Thank you Disseminate, your post was most helpful.
I think what he was saying is that you can’t do it without a special module.
Yup, standard lua this isn’t possible.
I have no idea what to do with this (new to lua), but I’m probably going to use MySQL to pass the stats. The main reason i needed it is to show the server stats on my main server, but also to kill those servers after a set amount of time of having no players. This is what I have so far, but it does nothing. And it’ll probably show how new to lua I am >.<
function PlayerCheck() local Var = RealTime()+10 if #player.GetAll() != 0 then Var = RealTime()+10 elseif Var < RealTime() and #player.GetAll() == 0 then game.ConsoleCommand("quit") end end hook.Add("Think", "PlayerCheck", PlayerCheck)
Can someone help me with this? Also, is there a way to kill the server without having it restart?
EDIT: Just read over the wiki page and noticed that it only runs at first start or when players are on. Is there an alternative to GM:think()? or should I just use timers?
EDIT2: Also just noticed that timers only run when players are on the server…
local function PlayerCheck()
if #player.GetHumans()==0 then
if #player.GetBots()==0 then
hook.Add("PlayerInitialSpawn","CancelKillServer",function(ply) if !ply:IsBot() then timer.Destroy("KillServer") for k,v in pairs(player.GetBots()) do v:Kick("") end end end) end end)
You’ll have to disable your server watchdog to keep it from restarting.