SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 08/02/2010, 11:36 AM   #1
Sampiscool123
Big Clucker
 
Join Date: Oct 2009
Posts: 80
Reputation: 0
Default players online

hi

how do i make it so when a player connects it says they have joined then it says how many players are online

for example "Sampiscool123 has joined the server. (10 players online)"

Thanks
Sampiscool123 is offline  
Old 08/02/2010, 01:26 PM   #2
smeti
Huge Clucker
 
smeti's Avatar
 
Join Date: Sep 2008
Posts: 291
Reputation: 32
Default Re: players online

pawn Code:
public OnPlayerConnect(playerid)
{
    new
        string[144];
    format(string, sizeof string,"%s has joined the server. (%d players online)", pName(playerid), ConnectedPlayers());
    SendClientMessageToAll(0xFFFF00AA, string);
    return true;
}

stock ConnectedPlayers()
{
    new
        Connected,
        ReDefinedMaxPlayers = GetMaxPlayers();
    for(new i; i < ReDefinedMaxPlayers; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        Connected++;
    }
    return Connected;
}

stock pName(playerid)
{
    new
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    return name;
}
smeti is offline  
Old 08/02/2010, 02:01 PM   #3
Sampiscool123
Big Clucker
 
Join Date: Oct 2009
Posts: 80
Reputation: 0
Default Re: players online

thanks
Sampiscool123 is offline  
 

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
[R]How to get online players count xfire Help Archive 2 26/03/2010 02:29 PM
Players Online MrLeNy Help Archive 9 06/03/2010 09:19 PM
Online Players UnknownScripting Everything and Nothing 2 17/12/2008 08:56 PM


All times are GMT. The time now is 10:44 PM.


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