flat-egg-44689
05/25/2023, 9:04 PMc
SendNearbyMessage(playerid, const message[])
{
new const Float:MAX_DISTANCE = 16.0;
new const MAX_COLOR_COMPONENT = 255;
new const MIN_COLOR_COMPONENT = 127;
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 = MAX_COLOR_COMPONENT - floatround(distance * (float(MAX_COLOR_COMPONENT - MIN_COLOR_COMPONENT) / MAX_DISTANCE));
new color = component << 24 | component << 16 | component << 8 | 0xFF;
SendClientMessage(i, color, message);
}
}
}