Check if a certain player is online? #2098
Answered
by
bartico6
LuanIllogical
asked this question in
Q&A
-
Hi! I'm starting out on plugins and I wanted to know if there's a way to check if a specific player/user is online. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
bartico6
Jul 21, 2020
Replies: 1 comment 3 replies
-
You would do so by looping over all player indexes (0 to for(int i = 0; i < Main.maxPlayers; i++)
{
if(Main.players[i].active)
{
var tp = TShock.Players[i];
//do check logic here
}
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
LuanIllogical
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You would do so by looping over all player indexes (0 to
Terraria.Main.maxPlayers
) and pulling an object from TShock.Players for each of those indexes and seeing if it has the properties you want: