Skip to content

Check if a certain player is online? #2098

Answered by bartico6
LuanIllogical asked this question in Q&A
Discussion options

You must be logged in to vote

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:

for(int i = 0; i < Main.maxPlayers; i++)
{
    if(Main.players[i].active)
    {
        var tp = TShock.Players[i];
        //do check logic here
    }
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@bartico6
Comment options

@LuanIllogical
Comment options

@bartico6
Comment options

Answer selected by LuanIllogical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants