Skip to content

[Mod] List player IDs

CloudHopper edited this page Aug 14, 2011 · 1 revision

Description:

If you ever needed to find out someone's player ID for any purpose and were having trouble, here's some simple code to do that.

Usage:

/players [gibberish]

Code:

OnChat Code
case "players":
string players = "";
int counted = 0;
try
{
for (int abc = 0; abc < Main.player.Count(); abc++)
{
if (Main.player[abc].name != "")
{
players += abc + "-" + Main.player[abc].name + " ";
counted++;
if (counted > 3)
{
chatText(players);
players = "";
counted = 0;
}
}
}
}
catch {}
chatText(players);
break;

ChatText Function
public static void chatText(string text)
{
Main.NewText(text, System.Drawing.Color.OrangeRed.R,System.Drawing.Color.OrangeRed.G,System.Drawing.Color.OrangeRed.B);
}

~CloudHopper

Clone this wiki locally