GetPlayerCount - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerCount (
/showthread.php?tid=229989)
GetPlayerCount -
shadowdog - 22.02.2011
I've seen this on a website but it's not working with me.. or is there another way to get the player which are online?
Re: GetPlayerCount -
maramizo - 22.02.2011
Why do you want to get the players that are online?
Re: GetPlayerCount -
FreshKilla - 22.02.2011
A quick way would to do:
pawn Код:
stock GetPlayerCount()
{
new amount=0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
amount++;
}
}
return amount;
}
I would rather use Foreach but yea it's the quickest way, and i don't really see a reason to use this you could just press TAB?
Re: GetPlayerCount -
maramizo - 22.02.2011
Lol freshkilla speaks?
Re: GetPlayerCount - [03]Garsino - 22.02.2011
Or using foreach:
pawn Код:
stock GetConnectedPlayers() return Iter_Count(Character);
Re: GetPlayerCount -
maramizo - 22.02.2011
Hey Garsino if you want to get the X/Y/Z where you died, before you spawn back, and then spawn to the same location that you died, where do you put the command GetPlayerPos? And where to SetPlayerPos?
Appreciated.
Re: GetPlayerCount - [03]Garsino - 22.02.2011
Quote:
Originally Posted by maramizo
Hey Garsino if you want to get the X/Y/Z where you died, before you spawn back, and then spawn to the same location that you died, where do you put the command GetPlayerPos? And where to SetPlayerPos?
Appreciated.
|
GetPlayerPos in OnPlayerDeath. Then you use SetSpawnInfo in OnPlayerDeath (setting the pos to the pos you got in GetPlayerPos).
Re: GetPlayerCount -
maramizo - 22.02.2011
Quote:
Originally Posted by [03]Garsino
GetPlayerPos in OnPlayerDeath. Then you use SetSpawnInfo in OnPlayerDeath (setting the pos to the pos you got in GetPlayerPos). 
|
Thanks!