I have a ProxDetector, but I want to make it so that when you are a bit more far away, it changes from color.
Currently I have this which only shows the message when you are in range of the player saying it.
Код:
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);
}
}
}
pawn Код:
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
foreach (new i : Player)
{
//if(!BigEar[i])
//{
if(IsPlayerInRangeOfPoint(i, radi/16, oldposx, oldposy, oldposz)) SendClientMessage(i, col1, string);
else if(IsPlayerInRangeOfPoint(i, radi/8, oldposx, oldposy, oldposz)) SendClientMessage(i, col2, string);
else if(IsPlayerInRangeOfPoint(i, radi/4, oldposx, oldposy, oldposz)) SendClientMessage(i, col3, string);
else if(IsPlayerInRangeOfPoint(i, radi/2, oldposx, oldposy, oldposz)) SendClientMessage(i, col4, string);
else if(IsPlayerInRangeOfPoint(i, radi, oldposx, oldposy, oldposz)) SendClientMessage(i, col5, string);
//}
//else SendClientMessage(i, col1, string);
}
return 1;
}