public String GetPlayerDirection(int playerPed) { float entityHeading = API.GetEntityHeading(playerPed); String direction = "Unknown"; if (Math.Abs(entityHeading - 0) < 22.5 || Math.Abs(entityHeading - 360) < 22.5) { direction = "North"; } else if (Math.Abs(entityHeading - 45) < 22.5) { direction = "Northwest"; } else if (Math.Abs(entityHeading - 90) < 22.5) { direction = "West"; } else if (Math.Abs(entityHeading - 135) < 22.5) { direction = "Southwest"; } else if (Math.Abs(entityHeading - 180) < 22.5) { direction = "South"; } else if (Math.Abs(entityHeading - 225) < 22.5) { direction = "Southwest"; } else if (Math.Abs(entityHeading - 270) < 22.5) { direction = "East"; } else if (Math.Abs(entityHeading - 315) < 22.5) { direction = "Northeast"; } return(direction); }