SA-MP Forums Archive
[FilterScript] [FS] Number of Players Online + Last logged in & OUT! - 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] [FS] Number of Players Online + Last logged in & OUT! (/showthread.php?tid=128479)

Pages: 1 2


Re: [FS] Number of Players Online + Last logged in. - Lejo - 28.02.2010

Nice.


Re: [FS] Number of Players Online + Last logged in. - adsy - 01.03.2010

if you have the problem of the last person who logged in not showing up and you have added the filterscript somewhere in the middle of your list to load at start in the cfg file then place it first.

example:
filterscripts whois base gl/gl_npcs gl/gl_realtime help teleport vehslash weather

instead of
filterscripts base gl/gl_npcs gl/gl_realtime help teleport vehslash weather whois


Re: [FS] Number of Players Online + Last logged in & OUT! - adsy - 04.03.2010

New Feature: Offlining Player Display (see first post)


Re: [FS] Number of Players Online + Last logged in & OUT! - Las Venturas CNR - 16.03.2010

Could someone plese help me? I only want the part that says how many people are online.
The rest I don't want. Thanks


EDIT: Never mind, found it. Cool FS by the way.


Re: [FS] Number of Players Online + Last logged in & OUT! - adsy - 17.03.2010

no problem.

ill label up the first post to say which is JUST the number of players.


Re: [FS] Number of Players Online + Last logged in & OUT! - GhOsT[X] - 26.03.2010

Isn't better to remove the SetTimer (with repeat on) and use TextDrawSetString instead (OnPlayerConnect and OnPlayerDisconnect)?

But g8 m8 congratula8


Re: [FS] Number of Players Online + Last logged in & OUT! - adsy - 03.04.2010

to be honest i was new to textdraws at the time. i like that idea. i might integrate it when i finish transferring stuff from my old hard drive.

ill create v2.2 or something with that, if it works (no doubt it will but testing is my favourite past time)


Re: [FS] Number of Players Online + Last logged in & OUT! - GhOsT[X] - 03.04.2010

tested it , congratz awesome script


Re: [FS] Number of Players Online - Winded - 03.04.2010

Quote:
Originally Posted by adsy
tested script with 2 players, doesnt work.

ill update it in a bit

done! & tested.
Forgot [MAX_PLAYERS]? Well you aint the only one who forgets that in their first script :P Just like me


Re: [FS] Number of Players Online + Last logged in & OUT! - adsy - 03.04.2010

it was actually maths, i was originally adding to a variable badly

ie variable + 1

but now i just use variable ++


Re: [FS] Number of Players Online + Last logged in & OUT! - Manuel20 - 11.04.2010

how must i make in the script wen i have an npc i dont want show the npc is online 1/10 players ... can every where help me


Re: [FS] Number of Players Online + Last logged in & OUT! - Manuel20 - 11.04.2010

what must i do ? the server ist empty 1 npc is on the server an shows 1/10 players but i want 0/10 players then the npc ist not a player^^ what missing in the script ?


Re: [FS] Number of Players Online + Last logged in & OUT! - adsy - 12.04.2010

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



Re: [FS] Number of Players Online + Last logged in & OUT! - [MWR]Blood - 13.04.2010

Good job!


Re: [FS] Number of Players Online + Last logged in & OUT! - ]V[ipeR - 08.07.2010

cool textdraw!and cool idea! 1+