SendClientMessage to only nearby players -
Ihsan_Cingisiz - 31.05.2010
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;
}
|
Re: SendClientMessage to only nearby players -
NewTorran - 31.05.2010
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
Re: SendClientMessage to only nearby players -
Ihsan_Cingisiz - 31.05.2010
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?
Re: SendClientMessage to only nearby players -
[XST]O_x - 31.05.2010
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;
}
Re: SendClientMessage to only nearby players -
Ihsan_Cingisiz - 31.05.2010
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
Re: SendClientMessage to only nearby players -
Ihsan_Cingisiz - 31.05.2010
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
Re: SendClientMessage to only nearby players -
[XST]O_x - 31.05.2010
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.
Re: SendClientMessage to only nearby players -
NewTorran - 31.05.2010
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?
Re: SendClientMessage to only nearby players -
[XST]O_x - 31.05.2010
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.
Re: SendClientMessage to only nearby players -
NewTorran - 31.05.2010
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.