players online
#1

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
Reply
#2

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;
}
Reply
#3

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)