SA-MP Forums Archive
Count players - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Count players (/showthread.php?tid=453681)



Count players - Kudoz - 25.07.2013

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


Re: Count players - NotePadGaming - 25.07.2013

could you help fix an bug and i will help you?


Re: Count players - Kudoz - 25.07.2013

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


Re: Count players - NotePadGaming - 25.07.2013

Ok suit your self.


Re: Count players - Paglia - 25.07.2013

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);
		}
		
	}
}



Re: Count players - Djole1337 - 25.07.2013

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.


Re: Count players - Kudoz - 25.07.2013

Can't get any of them to work ;/


Re: Count players - Djole1337 - 25.07.2013

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?


Re : Count players - Matnix - 25.07.2013

NVM.


Re: Count players - SuperViper - 26.07.2013

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

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

    return playerCount;
}