Get players and steam id with php rcon
I have rcon password.
I use SourceQuery but i dont understand how to get only player name and steam id without other shit inofmration. How to do that? I use this code in php. Quote:
Quote:
|
Re: Get players and steam id with php rcon
That is what the status command does for you. If you need just the player names and SteamIDs, you need to parse the status output.
|
Re: Get players and steam id with php rcon
Kinda weird your player has that unique id
|
Re: Get players and steam id with php rcon
Quote:
|
Re: Get players and steam id with php rcon
Quote:
|
Re: Get players and steam id with php rcon
Quote:
|
Re: Get players and steam id with php rcon
Quote:
|
Re: Get players and steam id with php rcon
1 Attachment(s)
"parse" means to break the information down into the parts that you want. All the information that you want is in the status output, you just need to get that data out of the whole "mess".
It looks like it shouldn't be too hard. First get each of the lines that contains a player and use str_getcsv() with the delimiter set to " " (a space) on that line. This should give you an array with the name at index 2 and the SteamID at index 4 of the returned array. Do that on each line while saving the name and SteamID into your new array that contains only the data you need. I'm sure you're capable of getting it to work just fine. Just take your time and test your code. For example, manually test each step of the code with hard coded test data to make sure that you know it works. Basically, you can work backwards from the smaller steps. I'd probably test simply using str_getcsv() on a single player line of the status output. Attached is a PHP function for parsing the status (change the extension to ".php" and then you can use require() to include it in your script). Simply pass your string to it and print it out to see how it's structured: PHP Code:
|
Re: Get players and steam id with php rcon
Im getting this output with this this code combined with yours.
PHP Code:
PHP Code:
|
Re: Get players and steam id with php rcon
You are not passing your status string to the function. You need to replace "$YourStatusString" with your variable.
|
All times are GMT -4. The time now is 12:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.