SA-MP Forums Archive
[FilterScript] mostplayeronline - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] mostplayeronline (/showthread.php?tid=549378)



mostplayeronline - mamalzeus - 06.12.2014

Hi !
i need a filterscript
when player connect to server show new account and most player online !
what's the code


Re: mostplayeronline - Alex Magaсa - 06.12.2014

1. Wrong section
2. Search on ****** next-time


Re: mostplayeronline - MohanedZzZ - 06.12.2014

Its not hard to use the search method in the fourms


Re: mostplayeronline - Ahammad - 06.12.2014

wrong section dude


Re: mostplayeronline - Abagail - 07.12.2014

Search next time. Because I am nice here you go(untested):
pawn Код:
new g_MaxPlayerOnline = 0;
public OnPlayerConnect(playerid)
{
      g_MaxPlayerOnline++;
      return true;
}
stock GetMostPlayersOnline()
{
      if(g_MaxPlayerOnline)
      {
            return g_MaxPlayerOnline;
      }
      else return 0;
}
It's really basic; doesn't save though.


Re: mostplayeronline - Kaperstone - 07.12.2014

@Abagail, it will return the current total players, not most players were online up until now

For this
pawn Код:
// Create two arrays holding numbers, starting with0
new g_MaxPlayerOnline = 0,
      g_TotalPlayerOnline = 0;
public OnPlayerConnect(playerid)
{
      // Total players online raise
      g_TotalPlayerOnline ++;
      // if there are more players online *now* than it before then we or raise g_MaxPlayerOnline or set it to the same number which g_TotalPlayerOnline holds, which is also only 1 decimal far away, because only one player is connecting at this point.
      if(g_TotalPlayerOnline > g_MaxPlayerOnline)
      {
            g_MaxPlayerOnline = g_TotalPlayerOnline;
      }
      return true;
}