private static bool YSFHandle_12_Unjoin(Client ThisClient, Packets.GenericPacket InPacket) { //ThisClient.YSFServer.SendPacket(InPacket); //Re-Synchronise... OpenYS_Link.OYS_Link_Response Response = OpenYS_Link.Get(OpenYS_Link.Stats._id, "stats_total_flight_seconds"); double OldTime = 0; bool Failed = !Double.TryParse(Response.Response, out OldTime); if (!Response.Success | Failed) { ThisClient.SendMessage("Failed to update your flight time due to a server error! Sorry about that!"); return(true); } //Update OYS_LINK... double difference = OpenYS_Link.Stats.total_flight_seconds - OldTime; Response = OpenYS_Link.Set(OpenYS_Link.Stats._id, "stats_total_flight_seconds", OpenYS_Link.Stats.total_flight_seconds); if (Response.Success) { ThisClient.SendMessage("Successfully updated your flight time by " + Math.Round(difference.AsSeconds().TotalHours, 2).ToString() + " hours."); ThisClient.SendMessage("Your new total flight time is " + Math.Round(OpenYS_Link.Stats.total_flight_seconds.AsSeconds().TotalHours, 2).ToString() + " hours."); return(true); } else { ThisClient.SendMessage("Failed to update your flight time due to a server error! Sorry about that!"); return(true); } }
public static void GetAllStats() { #region total_flight_seconds OYS_Link_Response total_flight_seconds = OpenYS_Link.Get(Stats._id, "stats_total_flight_seconds"); if (total_flight_seconds.Success) { bool Failed = !Double.TryParse(total_flight_seconds.Response, out Stats.total_flight_seconds); } #endregion }