The online racing simulator
Get player name InSim.NET
(2 posts, started )
Get player name InSim.NET
Hello,

Does anyone know how to get the playername of the client when the username is known?
I'm programming a new version of a program that is meant for use on [TC] cruise servers (http://forum.city-driving.co.uk/showthread.php?tid=22262). I want an boolean variabele to check if the player name contains a specific string.

So the question is: how to get the player name of a user with known username?

Thanks in advance!

Regards, Wouter (i-love-cruise)
try using foreach. Here's a example that should work.

string pname = "";
bool istow = false;
foreach(YourClientClass C in AllConnections)
{
if(C.Username == "Username")
{
pname = C.PlayerName;
}
}
if(pname.Contains("[MED]") || pname.Contains("[TOW]") || pname.Contains("[RES]"){istow = true;}
else{istow = false;}

Get player name InSim.NET
(2 posts, started )
FGED GREDG RDFGDR GSFDG