[FilterScript] [FS] Number of Players Online + Last logged in & OUT!
#33

the following should be ok for you


Code:
#include <a_samp>
#define SEC1 1000
#define SEC2 2000
#define SEC5 5000

new Text:PlayersOnServer;
new Text:LastPOnServer;
new string[32];
new string2[50];
new PName[MAX_PLAYER_NAME];
new MaxP;
new totalon;
new on‌off = 0;

public OnFilterScriptInit()
{
 print("\n--------------------------------------");
 print(" Show Players who are online by Adsy ");
 print("--------------------------------------\n");	
 MaxP = GetMaxPlayers();
 drawagain();
 SetTimer("pOnline", SEC2, 1);
 return 1;
}

public OnPlayerConnect(playerid){
 GetPlayerName(playerid, PName, sizeof(PName));
 on‌off = 1;
 return 0;
}

public OnPlayerDisconnect(playerid, reason){
 GetPlayerName(playerid, PName, sizeof(PName));
 on‌off = 0;
 return 0;
}

public OnFilterScriptExit()
{
  for(new i=0; i<MAX_PLAYERS; i++) {
    TextDrawHideForPlayer(i, PlayersOnServer);
    TextDrawHideForPlayer(i, LastPOnServer);
  }
return 1;
}

forward drawagain();
public drawagain(){
  if(PlayersOnServer){
    TextDrawDestroy(PlayersOnServer);
  }
  if(LastPOnServer){
    TextDrawDestroy(LastPOnServer);
  }
  format(string, sizeof(string), "%i/%i Online", totalon, MaxP);
  if(onoff == 1){
    format(string2, sizeof(string2), "Last on: %s", PName);
  }
  if(onoff == 0){
    format(string2, sizeof(string2), "Last off: %s", PName);
  }
  PlayersOnServer = TextDrawCreate(30,326, string);
  LastPOnServer = TextDrawCreate(30,318, string2);
  return 0;
}

forward pOnline();
public pOnline(){
  totalon = 0;
  for(new i=0; i<MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i)) {
      if(!IsPlayerNPC(i)){
        if(totalon == 0){
          totalon = 1;
        }
        else if (totalon > 0){
          totalon++;
        }
      }
    }
  }
  drawagain();
  TextDrawFont(PlayersOnServer,2);
  TextDrawUseBox(PlayersOnServer,0);
  TextDrawColor(PlayersOnServer,0xFFFFFFFF);
  TextDrawAlignment(PlayersOnServer, 1);
  TextDrawLetterSize(PlayersOnServer, 0.6, 0.8);
  TextDrawFont(LastPOnServer,1);
  TextDrawUseBox(LastPOnServer,0);
  TextDrawColor(LastPOnServer,0xFFFFFFFF);
  TextDrawAlignment(LastPOnServer, 1);
  TextDrawLetterSize(LastPOnServer, 0.5, 0.8);
  for(new i=0; i<MAX_PLAYERS; i++) {
    if(IsPlayerConnected(i) && GetPlayerInterior(i) < 1) {
      TextDrawShowForPlayer(i, PlayersOnServer);
      TextDrawShowForPlayer(i, LastPOnServer);
    }
    else{
      TextDrawHideForPlayer(i, PlayersOnServer);
      TextDrawHideForPlayer(i, LastPOnServer);
    }
  }
  return 1;
}
Reply


Messages In This Thread
[FS] Number of Players Online + Last logged in & OUT! - by adsy - 17.02.2010, 23:29
Re: [FS] Number of Players Online - by DiddyBop - 18.02.2010, 00:57
Re: [FS] Number of Players Online - by adsy - 18.02.2010, 06:34
Re: [FS] Number of Players Online - by V1ceC1ty - 18.02.2010, 06:58
Re: [FS] Number of Players Online - by adsy - 18.02.2010, 11:28
Re: [FS] Number of Players Online - by adsy - 18.02.2010, 16:39
Re: [FS] Number of Players Online (Now Working). - by Ricop522 - 18.02.2010, 20:01
Re: [FS] Number of Players Online (Now Working). - by max1101 - 18.02.2010, 20:01
Re: [FS] Number of Players Online (Now Working). - by gotenks918 - 18.02.2010, 20:02
Re: [FS] Number of Players Online (Now Working). - by Correlli - 18.02.2010, 20:15
Re: [FS] Number of Players Online (Now Working). - by adsy - 18.02.2010, 22:19
Re: [FS] Number of Players Online (Now Working). - by [BG]KiLLeR - 19.02.2010, 20:13
Re: [FS] Number of Players Online (Now Working). - by Julien209-hackedagain - 20.02.2010, 05:20
Re: [FS] Number of Players Online (Now Working). - by Blackmorth - 20.02.2010, 08:57
Re: [FS] Number of Players Online (Now Working). - by adsy - 20.02.2010, 09:59
Re: [FS] Number of Players Online (Now Working). - by hab2ever - 27.02.2010, 11:16
Re: [FS] Number of Players Online (Now Working). - by Lejo - 27.02.2010, 22:59
Re: [FS] Number of Players Online (Now Working). - by Fedee! - 27.02.2010, 23:06
Re: [FS] Number of Players Online (Now Working). - by adsy - 27.02.2010, 23:11
Re: [FS] Number of Players Online + Last Online! - by adsy - 27.02.2010, 23:52
Re: [FS] Number of Players Online + Last logged in. - by Lejo - 28.02.2010, 05:53
Re: [FS] Number of Players Online + Last logged in. - by adsy - 01.03.2010, 22:22
Re: [FS] Number of Players Online + Last logged in & OUT! - by adsy - 04.03.2010, 16:10
Re: [FS] Number of Players Online + Last logged in & OUT! - by World War III - 16.03.2010, 20:50
Re: [FS] Number of Players Online + Last logged in & OUT! - by adsy - 17.03.2010, 11:33
Re: [FS] Number of Players Online + Last logged in & OUT! - by GhOsT[X] - 26.03.2010, 12:43
Re: [FS] Number of Players Online + Last logged in & OUT! - by adsy - 03.04.2010, 00:24
Re: [FS] Number of Players Online + Last logged in & OUT! - by GhOsT[X] - 03.04.2010, 09:57
Re: [FS] Number of Players Online - by Winded - 03.04.2010, 11:37
Re: [FS] Number of Players Online + Last logged in & OUT! - by adsy - 03.04.2010, 20:36
Re: [FS] Number of Players Online + Last logged in & OUT! - by Manuel20 - 11.04.2010, 08:58
Re: [FS] Number of Players Online + Last logged in & OUT! - by Manuel20 - 11.04.2010, 10:03
Re: [FS] Number of Players Online + Last logged in & OUT! - by adsy - 12.04.2010, 23:10
Re: [FS] Number of Players Online + Last logged in & OUT! - by ikarus - 13.04.2010, 10:14
Re: [FS] Number of Players Online + Last logged in & OUT! - by ]V[ipeR - 08.07.2010, 18:27

Forum Jump:


Users browsing this thread: 7 Guest(s)