SA-MP Forums Archive
CountDown for players in range - 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: CountDown for players in range (/showthread.php?tid=136548)



CountDown for players in range - juuleman - 25.03.2010

Hey All,

I created a countdown command (/count) for my server and it works but i wanna make it like that only players that in range (20.0 or so) of the player who did /count see it.. (I'm just using SendClientMessage).

Does someone know this?

Thanks,
[ECR]SancheZ


Re: CountDown for players in range - Miguel - 25.03.2010

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i ++)
{
  if(IsPlayerConnected)
  {
    if(IsPlayerInRangeOfPoint(i, x, y, z)) // you will have to get x y and z by yourself... use GetPlayerPos
    {
       // your code to show the the textdraw, remeber that playerid is now i
    }
  }
}



Re: CountDown for players in range - juuleman - 25.03.2010

Yeah but i dont have a X, Y, Z pos. I need just the position where the player is that did /count.

Sorry i'm not the best scripter around here, maybe need some help.


Re: CountDown for players in range - Jefff - 25.03.2010

Код:
//Top
new Float:Pos[3];
//in command
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);

//in public
for(new i,g=GetMaxPlayers(); i < g; i ++)
{
  if(IsPlayerConnected(i))
  {
    if(IsPlayerInRangeOfPoint(i,/*range*/20.0,Pos[0],Pos[1],Pos[2])) // you will have to get x y and z by yourself... use GetPlayerPos
    {
       // your code to show the the textdraw, remeber that playerid is now i
    }
  }
}



Re: CountDown for players in range - juuleman - 26.03.2010

Quote:
Originally Posted by Jefff
Код:
//Top
new Float:Pos[3];
//in command
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);

//in public
for(new i,g=GetMaxPlayers(); i < g; i ++)
{
  if(IsPlayerConnected(i))
  {
    if(IsPlayerInRangeOfPoint(i,/*range*/20.0,Pos[0],Pos[1],Pos[2])) // you will have to get x y and z by yourself... use GetPlayerPos
    {
      // your code to show the the textdraw, remeber that playerid is now i
    }
  }
}
Thank you

Will try this when im at home.