General > Developers Corner

Show player count on server in advert

(1/4) > >>

UnderYouFive:
How would you code an advert for ULX to show how many players are on another server? I know they have %host% and stuff like that and I was wondering what to do to get an advert to look like this? [Join our DarkRP server! Type !darkrp | Players 15/22]

Cobalt:
You need to code an html parser to read pages fetched from gametracker. Alternatively, you can do this with PHP.
http://wiki.garrysmod.com/page/http/Fetch

Use this url to get gametracker info for a server:

--- Code: ---Format( "http://www.gametracker.com/server_info/%s:%s", ip, port )
--- End code ---

You can probably find parsing regexes on facepunch.

UnderYouFive:
I'm sorry but I don't really understand can you please post the code? I need so it can look like this? [Join our DarkRP server! Type !darkrp | Players 15/22]

JamminR:
you originally didn't ask "Can someone please do my work for me?"
You asked "How can I do it?"
Those two questions are totally separate.
In the future, please ask the question you intend up front.

What you are wanting, data from another server, is not "easy" in Gmod.
Not impossible mind you, but would take any dev several lines of code to parse the data.
And easily broken anytime the host changes its data format method.

Neku:
Take a look at Cobalt's Portal addon. It's on his github profile.
Has a little to do with getting data from gametracker.

Navigation

[0] Message Index

[#] Next page

Go to full version