SA-MP Forums Archive
OnPlayerText - 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)
+--- Thread: OnPlayerText (/showthread.php?tid=601348)



OnPlayerText - Kruno88 - 20.02.2016

How do I create a system in which when you type something,in normal chat,the message only sends to players in the radius?I need help fasstttt.


Re: OnPlayerText - RedRex - 20.02.2016

Код:
public OnPlayerText(playerid, text[])
{
    new pText[144];
    format(pText, sizeof (pText), "(%d) %s", playerid, text);
    SendPlayerMessageToAll(playerid, pText);
    return 0; // ignore the default text and send the custom one
}
+rep if i help u


Re: OnPlayerText - ReshiramZekrom - 20.02.2016

https://sampforum.blast.hk/showthread.php?tid=279575

Otherwise you can do this:


pawn Код:
public OnPlayerText(playerid, colore, text[])
{
     GetPlayerPos(playerid,XPos,YPos,ZPos);
     for(new i=0;i<MAX_PLAYERS,i++)
     {
          if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, RANGEYOUCHOOSE, XPos, YPos, ZPos) && GetPlayerVirtualWorld(i)==GetPlayerVirtualWorld(playerid)) SendPlayerMessageToPlayer(i, playerid, text);                                                              
     }
     return 0;
}



Re: OnPlayerText - Amunra - 20.02.2016

Try this !
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
RangeText[200],Name[24],Float:x,Float:y,Float:z;
    
GetPlayerName(playerid,Name,sizeof(Name));
    
format(RangeTextsizeof (RangeText), "%s says: %s"Nametext);
    
GetPlayerPos(playerid,x,y,z);
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfPoint(i,10,x,y,z);
        {
            
SendClientMessage(i,-1,RangeText);
        }
    }
    return 
0;




Re: OnPlayerText - Sew_Sumi - 20.02.2016

Wow, this is actually in as an example filterscript in the default server package... gl_chat.pwn



Another factor is that you can set a server setting, and it will also do the same.

https://sampwiki.blast.hk/wiki/LimitGlobalChatRadius