help - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help (
/showthread.php?tid=635378)
help -
TYDS - 06.06.2017
how can i get how many player on server ?
Re: help -
Toroi - 06.06.2017
Kinda related
https://sampforum.blast.hk/showthread.php?tid=635325
Re: help -
Kane - 06.06.2017
PHP код:
new onlinePlayers;
public OnPlayerConnect(playerid)
{
onlinePlayers++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
onlinePlayers--;
return 1;
}
CMD:players(playerid, params[])
{
new string[128];
format(string, sizeof(string), "Online players: %d", onlinePlayers);
SendClientMessage(playerid, -1, string);
return 1;
}
You looking for something like this?
Re: help -
TYDS - 06.06.2017
Quote:
Originally Posted by Arthur Kane
PHP код:
new onlinePlayers;
public OnPlayerConnect(playerid)
{
onlinePlayers++;
return 1;
}
public OnPlayerDisconnect(playerid)
{
onlinePlayers--;
return 1;
}
CMD:players(playerid, params[])
{
new string[128];
format(string, sizeof(string), "Online players: %d", onlinePlayers);
SendClientMessage(playerid, -1, string);
return 1;
}
You looking for something like this?
|
yes but it's better if it a function to getplayeronserver
Re: help -
Beckett - 06.06.2017
Код:
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;
}
Re: help -
TYDS - 06.06.2017
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
Re: help -
Kane - 06.06.2017
Why not just press tab?!
Re: help -
TYDS - 06.06.2017
Quote:
Originally Posted by Arthur Kane
Why not just press tab?!
|
just use for my system =]]z
Re: help -
SyS - 06.06.2017
if you using foreach then you can use Iter_Count(Player) to get total number of players connected