https://open.mp logo
#pawn-help
Title
# pawn-help
f

flat-egg-44689

05/25/2023, 8:36 PM
Copy code
c
SendNearbyMessage(playerid, const message[])
{
    new const Float:MAX_DISTANCE = 16.0;

    new
        Float:x,
        Float:y,
        Float:z;
        
    GetPlayerPos(playerid, x, y, z);
    
    foreach (new i : StreamedPlayer[playerid])
    {
        new Float:distance = GetPlayerDistanceFromPoint(i, x, y, z);
        
        if (distance <= MAX_DISTANCE)
        {
            new component = 0x7F + floatround(MAX_DISTANCE - distance) * (128 / MAX_DISTANCE);
            new color = component << 24 | component << 16 || component << 8 | 0xFF;
            
            SendClientMessage(i, color, message);
        }
    }
}
Untested, and only slightly more complex than that other version