21.12.2015, 10:23
I am creating a Phone Tower system, It seems working fine.
I am planning to add a signal bars in the left bottom screen of the screen below the Radar.
I had no idea what i am doing with this code (I have just copied this out of ProxDetector). The phone signal range is 1000, I wanted the bar to look a little bit realistic if possible. How can i do it?
Sorry about the code if it is terrible, I have ripped it off from ProxDetector.
This code is a little bit unrealistic, I am a little bit close to the tower and yet the bar is two.
Any help would be appreciated.
I am planning to add a signal bars in the left bottom screen of the screen below the Radar.
I had no idea what i am doing with this code (I have just copied this out of ProxDetector). The phone signal range is 1000, I wanted the bar to look a little bit realistic if possible. How can i do it?
Sorry about the code if it is terrible, I have ripped it off from ProxDetector.
PHP код:
new tower = GetClosestTower(playerid);
if(tower == -1) // No Signal
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~r~I I I I I");
}
else
{
if(IsPlayerInRangeOfPoint(playerid, tInfo[tower][tower_Signal] / 100, tInfo[tower][tower_Pos][0], tInfo[tower][tower_Pos][1], tInfo[tower][tower_Pos][2])) // Full Bar
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~g~I I I I I");
}
else if(IsPlayerInRangeOfPoint(playerid, tInfo[tower][tower_Signal] / 50, tInfo[tower][tower_Pos][0], tInfo[tower][tower_Pos][1], tInfo[tower][tower_Pos][2])) // Bar Four
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~g~I I I I ~r~I");
}
else if(IsPlayerInRangeOfPoint(playerid, tInfo[tower][tower_Signal] / 25, tInfo[tower][tower_Pos][0], tInfo[tower][tower_Pos][1], tInfo[tower][tower_Pos][2])) // Bar Three
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~g~I I I ~r~I I");
}
else if(IsPlayerInRangeOfPoint(playerid, tInfo[tower][tower_Signal] / 5, tInfo[tower][tower_Pos][0], tInfo[tower][tower_Pos][1], tInfo[tower][tower_Pos][2])) // Bar Two
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~g~I I ~r~I I I");
}
else if(IsPlayerInRangeOfPoint(playerid, tInfo[tower][tower_Signal], tInfo[tower][tower_Pos][0], tInfo[tower][tower_Pos][1], tInfo[tower][tower_Pos][2])) // Bar One
{
PlayerTextDrawSetString(playerid, Textdraw2, "~w~Phone Signal - ~g~I ~r~I I I I");
}
}
Any help would be appreciated.