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);
This is my code but it doesn't seem to be working, can someone help me? Ty <?php var pathx = C.CompCar.X / 196608; var pathy = C.CompCar.Y / 196608; var heading = C.CompCar.Heading / 65536; const int GasStationX = -53 * 196608; const int GasStationY = 203 * 196608; C.DistGPS = (int)Math.Sqrt(Math.Pow(C.CompCar.X - GasStationX, 2) + Math.Pow(C.CompCar.Y - GasStationY, 2)) / 65536; C.YGPS = (-53) - pathx; if (heading < 89) { C.XGPS = 90 - heading; } else { C.XGPS = heading - 90; } if ((C.XGPS) > 255) { C.XGPSnew = 255; } else if ((C.XGPS) < 0) { C.XGPSnew = 0; } else { C.XGPSnew = C.XGPS; } if ((C.YGPS) > 255) { C.YGPSnew = 255; } else if ((C.YGPS) < 0) { C.YGPSnew = 0; } else { C.YGPSnew = C.YGPS; } string buttonText = C.DistGPS + "m"; insim.Send((ISendable)new IS_BTN() { ReqI = 255, UCID = C.UniqueID, ClickID = 210, BStyle = ButtonStyles.ISB_C1, T = Convert.ToByte((C.YGPSnew)), L = Convert.ToByte((C.XGPSnew)), W = 100, H = 5, Text = buttonText }); ?>