Jump to content

Programmatically obtaining who joins the game???


DannyTom
 Share

Recommended Posts

Is there a way to query the server or have some kind of connection that will say when someone joins the game? I am working on a discord bot for such a thing for official public servers and wanted to see if that is even possible... I am able to currently poll the server for the players that are currently on using A2S under python - I'd like for my tribe to see who joins the server when we are in discord

Link to comment
Share on other sites

You've got no chance with public servers, RCON needs a password.  I assumed you were talking about your own server.

A2S doesn't entirely work because EPIC accounts don't get listed by the Steam API, and it can't distinguish between two players with the same name.

www.battlemetrics.com
https://developer.valvesoftware.com/wiki/Server_queries

Link to comment
Share on other sites

On 10/7/2022 at 12:33 AM, Larkfields said:

You've got no chance with public servers, RCON needs a password.  I assumed you were talking about your own server.

A2S doesn't entirely work because EPIC accounts don't get listed by the Steam API, and it can't distinguish between two players with the same name.

www.battlemetrics.com
https://developer.valvesoftware.com/wiki/Server_queries

Thanks. Ya i do know about epic and battlemetrics 
i was speaking of public so as how battlemetrics shows when someone logs in, surely that is replicatable and ive heard of some big tribes having a way for a bot to post in discord , when someone logs into the server..

Link to comment
Share on other sites

  • 4 weeks later...

You definitely don't need the rcon password for some information like player lists. I've not looked into what exactly it's doing but I use php source query on our clusters website ( http://www.arkultrapc.com ) to get player lists and no where are the rcon passwords set in it. I'm not at home so can't check the code but if you find it on github you'll be able to check the php function to see what he's doing to get it.

 

Edit: sorry, re-reading the thread, I may have told you something you already knew. I'm not sure about actual join/leave triggers. I just query the servers every 5 minutes for our website.

Edited by IanHighlander
Link to comment
Share on other sites

15 hours ago, IanHighlander said:

You definitely don't need the rcon password for some information like player lists. I've not looked into what exactly it's doing but I use php source query on our clusters website ( http://www.arkultrapc.com ) to get player lists and no where are the rcon passwords set in it. I'm not at home so can't check the code but if you find it on github you'll be able to check the php function to see what he's doing to get it.

 

Edit: sorry, re-reading the thread, I may have told you something you already knew. I'm not sure about actual join/leave triggers. I just query the servers every 5 minutes for our website.

so you query every 5 mins and compare it to the last query to see what changed as far as join/leave?

Link to comment
Share on other sites

On 11/7/2022 at 1:43 AM, DannyTom said:

so you query every 5 mins and compare it to the last query to see what changed as far as join/leave?

Nothing quite so clever I'm afraid. Every five minutes the json files on the webserver get updated with current stats. To see the change on the website you'd have to refresh. I couldn't be bothered to code in an Ajax refresh if I'm honest given how few people will use the site.

Link to comment
Share on other sites

  • 2 weeks later...
On 11/12/2022 at 8:33 AM, IanHighlander said:

Nothing quite so clever I'm afraid. Every five minutes the json files on the webserver get updated with current stats. To see the change on the website you'd have to refresh. I couldn't be bothered to code in an Ajax refresh if I'm honest given how few people will use the site.

Well dang.. i was hoping to be able to add a live join/leave for my discord bot but since the A2S doesnt work like that, i may have to rethink doing much more work beyond what I already have for the bot

Link to comment
Share on other sites

On 11/12/2022 at 8:33 AM, IanHighlander said:

Nothing quite so clever I'm afraid. Every five minutes the json files on the webserver get updated with current stats. To see the change on the website you'd have to refresh. I couldn't be bothered to code in an Ajax refresh if I'm honest given how few people will use the site.

Checking out your site to steal any ideas ... 

  • Haha 1
Link to comment
Share on other sites

  • Volunteer Moderator
7 hours ago, DannyTom said:

Dang that seems like a lot of work

It's not hard really. Python has a couple packages you can use to do it.

Watchdog for monitoring changes in a directory:

https://pypi.org/project/watchdog/

Then you can parse the file that changed:

https://www.pythontutorial.net/python-basics/python-read-text-file/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...