[FilterScript] mostplayeronline
#1

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

1. Wrong section
2. Search on ****** next-time
Reply
#3

Its not hard to use the search method in the fourms
Reply
#4

wrong section dude
Reply
#5

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.
Reply
#6

@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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)