29.01.2019, 17:39
(
Последний раз редактировалось kristo; 29.01.2019 в 19:44.
)
I present to you, a non-clusterfuck version of ProxDetector using this library:
pawn Код:
stock SendFadingMessage(playerid, Float:range, start_colour, end_colour, const message[]) {
if (!IsPlayerConnected(playerid) || range < 0.0) {
return 0;
}
new Float:ratio, Float:x, Float:y, Float:z, vw = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, x, y, z);
foreach (new i : Player) {
if (GetPlayerVirtualWorld(i) != vw || (ratio = (GetPlayerDistanceFromPoint(i, x, y, z) / range)) > 1.0) {
continue;
}
SendClientMessage(i, InterpolateColours(start_colour, end_colour, ratio), message);
}
return 1;
}