Chat - 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: Chat (
/showthread.php?tid=169860)
Chat -
GangsTa_ - 21.08.2010
How to make that when a player types something the message will show only to near players??
I want like in LS-RP?
Re: Chat -
Nonameman - 21.08.2010
pawn Код:
public OnPlayerText(playerid, text[])
{
new Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerInRangeOfPoint(i, range, pPos[0], pPos[1], pPos[2]) continue;//Put sg instead of range
SendClientMessage(i, 0xffffffff, text);
}
return 0;
}
Re: Chat -
Ihsan_Cingisiz - 21.08.2010
Quote:
Originally Posted by Nonameman
pawn Код:
public OnPlayerText(playerid, text[]) { new Float:pPos[3]; GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]); for(new i=0; i<MAX_PLAYERS; i++) { if(!IsPlayerInRangeOfPoint(i, range, pPos[0], pPos[1], pPos[2]) continue;//Put sg instead of range SendClientMessage(i, 0xffffffff, text); } return 0; }
|
Or you can do in OnGameModeInit();
pawn Код:
LimitGlobalChatRadius(/*RADIUS*/);
I recommend the Radius, 10.0.
Greetin's
Re: Chat -
GangsTa_ - 21.08.2010
Thnx. Now I'm on my laptop, when I get my PC back, because my script is there
Re: Chat -
GangsTa_ - 21.08.2010
Shit it's not working. It gets a error: Expected token at ; but found ) at line
if(!IsPlayerInRangeOfPoint(i, range, pPos[0], pPos[1], pPos[2]) continue;//Put sg instead of range
How to fix it??
I wanted when player writes for example he says "Hello"
It will write "GangsTa[MD] says: Hello"
To the range 0.
What about /me command at this range?
Re: Chat -
RoCK'N'Rolla - 21.08.2010
if(!IsPlayerInRangeOfPoint(i, range, pPos[0], pPos[1], pPos[2]))
Re: Chat -
GangsTa_ - 21.08.2010
Undefined symbol Range
Re: Chat -
Dark_Kostas - 21.08.2010
Change the range with 10.0
Re: Chat -
Claude - 21.08.2010
pawn Код:
new Float:x, Float:y, Float:z, string[128];
GetPlayerPos(playerid, x, y, z);
format(string, sizeof(string),"%s", text);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 10, x, y, z))
{
SendPlayerMessageToPlayer(i, playerid, string);
}
}
Add this at OnPlayerText(playerid, text[])
Re: Chat -
Agent Smith - 21.08.2010
Also make sure that on OnPlayerText returns 0 other wise it will send hower you do the chat and also the SA:MP server deafult chat.