The online racing simulator
Help with coordinates
Hello, im making a GPS thing that shows where is your location, but it works only when your heading is different than the place that i set (90).

The location is the Gas Station.



The code that i made is this:

Quote :Conn.DistGPS = ((int)Math.Sqrt(Math.Pow(Conn.CompCar.X - (-53 * 196608), 2) + Math.Pow(Conn.CompCar.Y - (203 * 196608), 2)) / 65536);
Conn.YGPS = ((-53) - (pathx));

if (heading < 89)
{
Conn.XGPS = ((90) - (heading));
}
else
{ Conn.XGPS = ((heading) - (90)); }

if ((Conn.XGPS + 95) > 255)
{ Conn.XGPSnew = 255; }
else if ((Conn.XGPS + 95) < 0)
{ Conn.XGPSnew = 0; }
else
{ Conn.XGPSnew = Conn.XGPS; }

if ((Conn.YGPS + 95) > 255)
{ Conn.YGPSnew = 255; }
else if ((Conn.YGPS + 95) < 0)
{ Conn.YGPSnew = 0; }
else
{ Conn.YGPSnew = Conn.YGPS; }

InSim.Send_BTN_CreateButton("^7^H¡¶" + Conn.DistGPS + "m¡¶", Flags.ButtonStyles.ISB_C1, 7, 20, Convert.ToByte((95 + Conn.YGPSnew)), Convert.ToByte((90 - Conn.XGPSnew)), 200, Conn.UniqueID, 2, false);


FGED GREDG RDFGDR GSFDG