OnPlayerText
#1

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.
Reply
#2

Код:
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
Reply
#3

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;
}
Reply
#4

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;

Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)