Hi,
I'm new here and started this night with my own plugin.
My C# knowledge is average but I can't understand why the text output in the wrong order.
Normaly i think the output should looks like this:Code:[ChatCommand("test")] void playerslist(BasePlayer player, string command, string[] args) { int count = 1; var catchactiveplayerlist = BasePlayer.activePlayerList as List<BasePlayer>; var catchsleeperplayerlist = BasePlayer.sleepingPlayerList as List<BasePlayer>; WebRequests webRequests = Interface.GetMod().GetLibrary<WebRequests>("WebRequests"); PrintToConsole("<color=cyan>PLAYERS ONLINE:</color>"); foreach (BasePlayer user in catchactiveplayerlist) { string[] ipaddress = user.net.connection.ipaddress.Split(':'); Interface.GetMod().GetLibrary<WebRequests>("WebRequests").EnqueueGet("http://ipinfo.io/" + ipaddress[0] + "/country", (code, response) => addnextPlayer(code, response, player, count), this); count++; } PrintToConsole("<color=white>--------------------------------------------------</color>"); PrintToConsole("<color=white>There are</color> <color=cyan>" + Convert.ToString(countonline) + "</color> <color=white>Players online.</color>"); } private void addnextPlayer(int code, string response, BasePlayer player, int count) { if (response == null || code != 200) { response = "undefined"; } PrintToConsole("<color=white>" + count.ToString("000") + " |</color><color=lime> " + player.displayName + "</color><color=white> | " + player.userID + " | " + response + "</color>\n"); }
PLAYERS ONLINE:
001 | playername | playerid | country
002 | playername | playerid | country
-------------------------------------------------
There are 2 Players online
But it looks like this:
PLAYERS ONLINE:
-------------------------------------------------
There are 2 Players online
002 | playername | playerid | country
003 | playername | playerid | country
and yes the webrequest works and i get my country information =).
I hope anyone can help
greetz Gobbles
[DOUBLEPOST=1435341600,1435295825][/DOUBLEPOST]Have nobody any idea about my problem?
Get county from activePlayerList (C#)
Discussion in 'Rust Development' started by Gobbler, Jun 26, 2015.
-
Wulf Community Admin
I don't see a wrong order, just different numbering.
-
The numbering is wrong and it print the list of the players after the line and the text "There are 2 Players online"

