Count players
#1

Hello! I've been searching around and I can only find scripts that counts how many players that are online. I need something else , which counts how many players that are in a specific virtual world. How can I do this?

Thanks in advance,

Kudoz
Reply
#2

could you help fix an bug and i will help you?
Reply
#3

A bug*

No, I'm not really doing this for helping others. I'm here to learn stuff at the moment. I've seen that you've posted that on several posts too, so how can I know that you can help us ALL? Nah man, I don't think you can, so no thanks. Lol
Reply
#4

Ok suit your self.
Reply
#5

Try this:
Код:
stock CheckPlayers(vworld,interior)
{
	for(new _i=0; _i<MAX_PLAYERS; _i++) 
	{
		new TotalPlayers;
		new msg[64];
		if(GetPlayerVirtualWorld(i) == vworld)
		{
			TotalPlayers++;
			format(msg,64,"Total Players In Virtual World %d: %d",vworld,TotalPlayers);
			SendClientMessageToAll(-1,msg);
		}
		
	}
}
Reply
#6

pawn Код:
stock CountPlayers(vw) {
    new iCount = 0;
    #if defined _FOREACH_LOCAL_VERSION
        foreach(new x : Player) {
            if (GetPlayerVirtualWorld(x) == vw) {
                iCount ++;
            }
        }
    #else
        for(new x = 0; x != MAX_PLAYERS; x++) {
            if (IsPlayerConnected(x) && GetPlayerVirtualWorld(x) == vw) {
                iCount ++;
            }
        }
    #endif
    return iCount;
}
Something like this? Not tested tho.
Reply
#7

Can't get any of them to work ;/
Reply
#8

Quote:
Originally Posted by Kudoz
Посмотреть сообщение
Can't get any of them to work ;/
I'm pretty sure the one I posted works fine, may I ask you how you used it?
Reply
#9

NVM.
Reply
#10

pawn Код:
playersInWorld(worldID)
{
    new playerCount++;

    for(new playerIndex; playerIndex < MAX_PLAYERS; playerIndex++)
    {
        if(GetPlayerVirtualWorld(playerIndex) == worldID)
        {
            playerCount++;
        }
    }

    return playerCount;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)