SA-MP Forums Archive
No. Of Players In Textdraw - 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: No. Of Players In Textdraw (/showthread.php?tid=476046)



No. Of Players In Textdraw - AryanV - 16.11.2013

How To get The Number Of Online Players In Textdraw...?


Re: No. Of Players In Textdraw - Konstantinos - 16.11.2013

Using foreach would be:
pawn Код:
Iter_Count(Player)
If not, then loop and count:
pawn Код:
stock CountPlayers( )
{
    new
        count
    ;
   
    for( new i; i != MAX_PLAYERS; i++ ) if( IsPlayerConnected( i ) && !IsPlayerNPC( i ) ) count++;

    return count;
}



Re: No. Of Players In Textdraw - Avi Raj - 16.11.2013

https://sampforum.blast.hk/showthread.php?tid=168818
Use search button before Posting a Thread.


Re: No. Of Players In Textdraw - AryanV - 16.11.2013

i Dont Clearly UnderStand......


Re: No. Of Players In Textdraw - Konstantinos - 16.11.2013

Quote:
Originally Posted by AryanV
Посмотреть сообщение
i Dont Clearly UnderStand......
To the place you want to change the online players in the textdraw (either timer or OnPlayerConnect/OnPlayerDisconnect - depending on what you're using) format a string and pass as argument:

either
pawn Код:
Iter_Count(Player)
If you're using foreach

or
pawn Код:
CountPlayers( )
if you're not using foreach.

Then set the new string to the textdraw

Note: If you're not using foreach, don't forget to add the stock at the bottom.