#1

how can i get how many player on server ?
Reply
#2

Kinda related

https://sampforum.blast.hk/showthread.php?tid=635325
Reply
#3

PHP код:
new onlinePlayers;
public 
OnPlayerConnect(playerid)
{
    
onlinePlayers++;
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
     
onlinePlayers--;
     return 
1;
}
CMD:players(playeridparams[])
{
    new 
string[128];
    
format(stringsizeof(string), "Online players: %d"onlinePlayers);
    
SendClientMessage(playerid, -1string);
    return 
1;

You looking for something like this?
Reply
#4

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
PHP код:
new onlinePlayers;
public 
OnPlayerConnect(playerid)
{
    
onlinePlayers++;
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
     
onlinePlayers--;
     return 
1;
}
CMD:players(playeridparams[])
{
    new 
string[128];
    
format(stringsizeof(string), "Online players: %d"onlinePlayers);
    
SendClientMessage(playerid, -1string);
    return 
1;

You looking for something like this?
yes but it's better if it a function to getplayeronserver
Reply
#5

Код:
GetOnlinePlayers()
{
	new player;
	for(new i = 0; i <= GetPlayerPoolSize(); i++)
	{
	    if(IsPlayerConnected(i)) player++;
	}
	return player;
}

CMD:playersonline(playerid, params[])
{
    new string[22];
    format(string, sizeof(string), "Online players: %d", GetOnlinePlayers());
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply
#6

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Код:
GetOnlinePlayers()
{
	new player;
	for(new i = 0; i <= GetPlayerPoolSize(); i++)
	{
	    if(IsPlayerConnected(i)) player++;
	}
	return player;
}

CMD:playersonline(playerid, params[])
{
    new string[30];
    format(string, sizeof(string), "Online players: %d", GetOnlinePlayers());
    SendClientMessage(playerid, -1, string);
    return 1;
}
thank you
Reply
#7

Why not just press tab?!
Reply
#8

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Why not just press tab?!
just use for my system =]]z
Reply
#9

if you using foreach then you can use Iter_Count(Player) to get total number of players connected
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)