GetPlayerCount
#1

pawn Код:
GetPlayerCount()
I've seen this on a website but it's not working with me.. or is there another way to get the player which are online?
Reply
#2

Why do you want to get the players that are online?
Reply
#3

A quick way would to do:
pawn Код:
stock GetPlayerCount()
{
    new amount=0;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            amount++;
        }
    }
    return amount;
}
I would rather use Foreach but yea it's the quickest way, and i don't really see a reason to use this you could just press TAB?
Reply
#4

Lol freshkilla speaks?
Reply
#5

Or using foreach:
pawn Код:
stock GetConnectedPlayers() return Iter_Count(Character);
Reply
#6

Hey Garsino if you want to get the X/Y/Z where you died, before you spawn back, and then spawn to the same location that you died, where do you put the command GetPlayerPos? And where to SetPlayerPos?
Appreciated.
Reply
#7

Quote:
Originally Posted by maramizo
Посмотреть сообщение
Hey Garsino if you want to get the X/Y/Z where you died, before you spawn back, and then spawn to the same location that you died, where do you put the command GetPlayerPos? And where to SetPlayerPos?
Appreciated.
GetPlayerPos in OnPlayerDeath. Then you use SetSpawnInfo in OnPlayerDeath (setting the pos to the pos you got in GetPlayerPos).
Reply
#8

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
GetPlayerPos in OnPlayerDeath. Then you use SetSpawnInfo in OnPlayerDeath (setting the pos to the pos you got in GetPlayerPos).
Thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)