SendClientMessage to only nearby players
#1

How can i do that?
I want that /b only send message to
nearby players, not over the whole
server. Here is the script
Quote:

if(strcmp(cmd, "/b", true) == 0)
{
strmid(tmp, cmdtext, 3, strlen(cmdtext));
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
SendClientMessageToAll(COLOR_GREY,string);
print(string);
return 1;
}

Reply
#2

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Reply
#3

Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Reply
#4

Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
  {
  strmid(tmp, cmdtext, 3, strlen(cmdtext));
  if(!strlen(tmp))
  {
  SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
  return 1;
  }
  new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
  if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
  {
  GetPlayerName(playerid, sendername, sizeof(sendername));
  format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
  SendClientMessage(i, COLOR, string);
  print(string);
  }
  return 1;
  }
Reply
#5

Quote:
Originally Posted by O_x
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
 {
 strmid(tmp, cmdtext, 3, strlen(cmdtext));
 if(!strlen(tmp))
 {
 SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
 return 1;
 }
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
 {
 GetPlayerName(playerid, sendername, sizeof(sendername));
 format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
 SendClientMessage(i, COLOR, string);
 print(string);
 }
 return 1;
 }
Thanks, sorry, but i did it already
forgot to say
Reply
#6

Quote:
Originally Posted by O_x
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
 {
 strmid(tmp, cmdtext, 3, strlen(cmdtext));
 if(!strlen(tmp))
 {
 SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
 return 1;
 }
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
 {
 GetPlayerName(playerid, sendername, sizeof(sendername));
 format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
 SendClientMessage(i, COLOR, string);
 print(string);
 }
 return 1;
 }
Uhh... Sorry but, i didnt know that it was right after people connected to test
the guy doens;t see what i type in /b
Reply
#7

Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by O_x
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
 {
 strmid(tmp, cmdtext, 3, strlen(cmdtext));
 if(!strlen(tmp))
 {
 SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
 return 1;
 }
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
 {
 GetPlayerName(playerid, sendername, sizeof(sendername));
 format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
 SendClientMessage(i, COLOR, string);
 print(string);
 }
 return 1;
 }
Uhh... Sorry but, i didnt know that it was right after people connected to test
the guy doens;t see what i type in /b
I'm sorry,It's probably my bad somewhere in what i made.
Wait for Joe Torran C to post here.
Reply
#8

Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by O_x
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
 {
 strmid(tmp, cmdtext, 3, strlen(cmdtext));
 if(!strlen(tmp))
 {
 SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
 return 1;
 }
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
 {
 GetPlayerName(playerid, sendername, sizeof(sendername));
 format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
 SendClientMessage(i, COLOR, string);
 print(string);
 }
 return 1;
 }
Uhh... Sorry but, i didnt know that it was right after people connected to test
the guy doens;t see what i type in /b
By the guy you mean another user? Or by the guy you mean your character?
If another user, Is he next to you or far away?
Reply
#9

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by O_x
Quote:
Originally Posted by Ihsan_Cingisiz
Quote:
Originally Posted by Joe Torran C
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
  SendClientMessage(i, COLOR, "Hello");
}
That will send a message to anyone 10.0 from the player, Is it yards? 10 yard radius? Idk i just know that it will send a msg to everyone within 10.0
Can;t you put that in my script?
Oh come on.
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
 {
 strmid(tmp, cmdtext, 3, strlen(cmdtext));
 if(!strlen(tmp))
 {
 SendClientMessage(playerid,COLOR_RED,"USAGE: /b [message]");
 return 1;
 }
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
 {
 GetPlayerName(playerid, sendername, sizeof(sendername));
 format(string, sizeof(string),"(([%s]: %s ))",sendername,tmp);
 SendClientMessage(i, COLOR, string);
 print(string);
 }
 return 1;
 }
Uhh... Sorry but, i didnt know that it was right after people connected to test
the guy doens;t see what i type in /b
By the guy you mean another user? Or by the guy you mean your character?
If another user, Is he next to you or far away?
Dude check my code i probably made a mistake there.
Reply
#10

Quote:
Originally Posted by O_x
Dude check my code i probably made a mistake there.
I see nothing wrong with your code,
Except that strmid thing, Im not familar with that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)