SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 11/04/2010, 08:58 AM   #31
Manuel20
Little Clucker
 
Join Date: Jan 2010
Posts: 16
Reputation: 0
Default Re: [FS] Number of Players Online + Last logged in & OUT!

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
Manuel20 is offline   Reply With Quote
Old 11/04/2010, 10:03 AM   #32
Manuel20
Little Clucker
 
Join Date: Jan 2010
Posts: 16
Reputation: 0
Default Re: [FS] Number of Players Online + Last logged in & OUT!

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 ?
Manuel20 is offline   Reply With Quote
Old 12/04/2010, 11:10 PM   #33
adsy
Huge Clucker
 
Join Date: Aug 2008
Posts: 410
Reputation: 3
Default Re: [FS] Number of Players Online + Last logged in & OUT!

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 onoff = 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));
 onoff = 1;
 return 0;
}

public OnPlayerDisconnect(playerid, reason){
 GetPlayerName(playerid, PName, sizeof(PName));
 onoff = 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;
}
adsy is offline   Reply With Quote
Old 13/04/2010, 10:14 AM   #34
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,268
Reputation: 105
Default Re: [FS] Number of Players Online + Last logged in & OUT!

Good job!
__________________
[MWR]Blood is offline   Reply With Quote
Old 08/07/2010, 06:27 PM   #35
]V[ipeR
Little Clucker
 
]V[ipeR's Avatar
 
Join Date: Jul 2010
Posts: 27
Reputation: 0
Default Re: [FS] Number of Players Online + Last logged in & OUT!

cool textdraw!and cool idea! 1+
__________________


HostnamePyckuu-|-CepBep|
Ip:188.40.86.76:9381
]V[ipeR is offline   Reply With Quote
Old 25/11/2010, 02:51 PM   #36
nGen.SoNNy
Gangsta
 
nGen.SoNNy's Avatar
 
Join Date: Sep 2009
Location: Romania
Posts: 929
Reputation: 69
Default Re: [FS] Number of Players Online + Last logged in & OUT!

Very nice) :P
__________________
If i've helped you, please click
nGen.SoNNy is offline   Reply With Quote
Old 21/07/2011, 10:30 AM   #37
TheBluec0de
Gangsta
 
TheBluec0de's Avatar
 
Join Date: Mar 2011
Posts: 569
Reputation: 12
Default Re: [FS] Number of Players Online + Last logged in & OUT!

Nice
TheBluec0de is offline   Reply With Quote
Old 21/07/2011, 10:36 AM   #38
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: [FS] Number of Players Online + Last logged in & OUT!

Is there any reason to bumping a year old topic? Which can be coded way more efficiently and more better?
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 13/08/2011, 12:25 PM   #39
RzV_SaMp
Little Clucker
 
Join Date: Jun 2010
Posts: 18
Reputation: 0
Default Re: [FS] Number of Players Online + Last logged in & OUT!

g00d j0b
RzV_SaMp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Number of faction members online IVuljak Help Archive 2 21/04/2010 10:27 AM
[SOLVED]setting the number of players per team WSD Help Archive 2 17/02/2010 11:54 PM
players online Sampiscool123 Help Archive 2 08/02/2010 02:01 PM
How to make it load a players money from last time he logged in aspire5630 Help Archive 8 15/05/2009 08:56 PM


All times are GMT. The time now is 06:41 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.