Help-me please
#1

Hello , what function should I use to chat not be global??
Reply
#2

You mean like the one in Rp Servers ? if i send a text message(ingame) will not apear for evry one , just the closer guys(players) ?? is that what chu want ?
Reply
#3

yes that's right
Reply
#4

I recommend using Prox Detector;

Create a Prox Detector stock some where near the top of your script
pawn Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}
Then add on your OnPlayerText callback

pawn Код:
public OnPlayerText(playerid, text[])
{
    new
        message[128];
    format(message, sizeof(message), "%s says: %s", GetName(playerid), text);
    ProxDetector(30.0, playerid, message, -1);
    return 0;
}
For a in depth tutorial just look in tuts
Reply
#5

Then Okay
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
string[128], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof (name));
    
format(stringsizeof (string), " %s: %s",  nametext);
    
SendNearbyMessage(playerid10stringCOLOR_WHITECOLOR_WHITECOLOR_WHITECOLOR_WHITECOLOR_WHITE);
    return 
0;

PHP код:
stock SendNearbyMessage(playeridFloat:radiusstring[], col1col2col3col4col5)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    new 
Float:ixFloat:iyFloat:iz;
    new 
Float:cxFloat:cyFloat:cz;
    foreach(
Playeri)
    {
        if(
IsPlayerLoggedIn{i})
        {
            if(
GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                
GetPlayerPos(iixiyiz);
                
cx = (ix);
                
cy = (iy);
                
cz = (iz);
                if(((
cx radius/16) && (cx > -radius/16)) && ((cy radius/16) && (cy > -radius/16)) && ((cz radius/16) && (cz > -radius/16)))
                {
                    
SendClientMessage(icol1string);
                }
                else if(((
cx radius/8) && (cx > -radius/8)) && ((cy radius/8) && (cy > -radius/8)) && ((cz radius/8) && (cz > -radius/8)))
                {
                    
SendClientMessage(icol2string);
                }
                else if(((
cx radius/4) && (cx > -radius/4)) && ((cy radius/4) && (cy > -radius/4)) && ((cz radius/4) && (cz > -radius/4)))
                {
                    
SendClientMessage(icol3string);
                }
                else if(((
cx radius/2) && (cx > -radius/2)) && ((cy radius/2) && (cy > -radius/2)) && ((cz radius/2) && (cz > -radius/2)))
                {
                    
SendClientMessage(icol4string);
                }
                else if(((
cx radius) && (cx > -radius)) && ((cy radius) && (cy > -radius)) && ((cz radius) && (cz > -radius)))
                {
                    
SendClientMessage(icol5string);
                }
            }
        }
    }
    return 
1;

Try this it works fine for me
Reply
#6

ok thanks to the 2 I'll try
Reply
#7

There is also a native function released in 0.3x or 0.3z??

LimitGlobalChatRadius(200.0);

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

might wanna check that out.
Reply
#8

I could thank you +Rep for all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)