public static void ResponceList(string message) { try { if (message.Contains("change time display ")) { string xy = message.Replace("change time display ", ""); string xystring = xy.Replace("x: ", "").Replace(" y: ", ","); //x: " + x + " y: " + y int x = int.Parse(xystring.Substring(0, xystring.IndexOf(","))); int y = int.Parse(xystring.Substring(xystring.IndexOf(',') + 1, (xystring.LastIndexOf(xystring.Last())) - (xystring.IndexOf(',') + 1))); displaysystem.change_time_display_location(x, y); } if (message.Contains("time ")) { char[] timestr = message.Remove(0, 5).ToArray(); int[] time = new int[12]; for (int i = 0; i < 12; i++) { time[i] = int.Parse(timestr[i] + ""); } DeloreanManagement.setPresentTime(time[0], time[1], time[2], time[3], time[4], time[5], time[6], time[7]); Function.Call(Hash.SET_CLOCK_TIME, ((time[8] * 10) + time[9]), ((time[10] * 10) + time[11]), 0); } if (message.Contains("anim:")) { string anim = message.Replace("anim:", ""); TTTF.root = anim.Substring(0, anim.IndexOf(',')); TTTF.effect = anim.Substring(anim.IndexOf(',') + 1, (anim.LastIndexOf(anim.Last())) - (anim.IndexOf(',') + 1)); } } catch { } }
private void onTick(object sender, EventArgs e) { try { if (!Game.IsLoading) { if (!initial) { foreach (Vehicle v in World.GetAllVehicles()) { if (v.Model == VehicleHash.Bus) { v.Delete(); } Wait(10); } Game.Player.CanControlCharacter = true; if (Game.Player.Character.IsInVehicle()) { Game.Player.Character.CurrentVehicle.IsVisible = true; } try { client = new SimpleTCP.SimpleTcpClient(); client.StringEncoder = Encoding.UTF8; //client.DataReceived += luancherdata; client.Connect("127.0.0.1", 10757); UI.Notify("Connection: " + client.TcpClient.Connected); string launcher = client.WriteLineAndGetReply("script running", new TimeSpan(0, 0, 1)).MessageString; if (launcher.Contains("Launcher running")) { Sounds.initialLoad(true); if (Sounds.Intro.getPlayState()) { Sounds.Intro.Play(); } ResponceList(client.WriteLineAndGetReply("send saved display xy", new TimeSpan(0, 0, 30)).MessageString); connection_success = true; if (servTime) { ResponceList(client.WriteLineAndGetReply("send display time", new TimeSpan(0, 0, 30)).MessageString); servTime = false; } } else { } //rooterror = "connectionstart begining"; //if (!connectstart) //{ // Wait(10); // rooterror = "new simpleTCP"; // client = new SimpleTCP.SimpleTcpClient(); // Wait(10); // rooterror = "Encode"; // client.StringEncoder = Encoding.UTF8; // Wait(10); // rooterror = "datareceived"; // client.DataReceived += luancherdata; // Wait(10); // rooterror = "connect to launcher"; // client.Connect("127.0.0.1", 10757); // Wait(10); // rooterror = "WriteLine"; // connectstart = true; // client.WriteLineAndGetReply("script running", new TimeSpan(0, 0, 20)); // rooterror = "connectionstart true"; // Wait(10); //} //rooterror = "new TTTF"; } catch (Exception f) { try { UI.Notify(f.Message); UI.Notify("load sounds"); Sounds.initialLoad(false); UI.Notify("check if not playing"); if (Sounds.Intro.getPlayStateStopped()) { UI.Notify("play"); Sounds.Intro.Play(); UI.Notify("No connection to laucher"); } } catch (Exception g) { int count = 0; Sounds.unLoad(); while (count < 100) { UI.Notify(g.Message); UI.Notify(g.StackTrace); UI.Notify(g.TargetSite.Name); UI.Notify(g.ToString()); Wait(10); } } } TTTF = new TTTFmenu(); initial = true; } try { TTTF.OnTick(); if (Game.Player.Character.IsInVehicle()) { if (Game.Player.Character.CurrentVehicle.FriendlyName == new Model("dmc12")) { Game.Player.Character.CurrentVehicle.CanBeVisiblyDamaged = !TTTF.invincible; Game.Player.Character.CurrentVehicle.IsInvincible = TTTF.invincible; Game.Player.Character.CurrentVehicle.EngineCanDegrade = !TTTF.invincible; } } //UI.ShowSubtitle("Is in flying vehicle: " + Function.Call<bool>(Hash.IS_PED_IN_FLYING_VEHICLE, Game.Player.Character)); } catch { } Libeads.tick(); helpFromDoc.tick(); Traveler.tick(); DeloreanManagement.tick(); R = Game.IsKeyPressed(Keys.R); C = Game.IsKeyPressed(Keys.C); if (R && C) { if (!rcenable) { TTTF.quickRC(); rcenable = true; } } else { rcenable = false; } //if (Properties.Settings.Default.presday1 == 2 && Properties.Settings.Default.presday2 == 9 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 4 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} //else if (Properties.Settings.Default.presday1 == 3 && Properties.Settings.Default.presday2 == 0 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 4 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} //else if (Properties.Settings.Default.presday1 == 0 && Properties.Settings.Default.presday2 == 1 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 5 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} //else if (Properties.Settings.Default.presday1 == 0 && Properties.Settings.Default.presday2 == 2 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 5 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} //else if (Properties.Settings.Default.presday1 == 0 && Properties.Settings.Default.presday2 == 3 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 5 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} //else if (Properties.Settings.Default.presday1 == 0 && Properties.Settings.Default.presday2 == 4 && Properties.Settings.Default.presmonth1 == 0 && Properties.Settings.Default.presmonth2 == 5 && Properties.Settings.Default.presy1 == 1 && Properties.Settings.Default.presy2 == 9 && Properties.Settings.Default.presy3 == 9 && Properties.Settings.Default.presy4 == 2) //{ // riot(); //} } } catch (Exception d) { try { UIText debug2 = new UIText("object: " + d.TargetSite + " location: " + d.StackTrace + " Error: " + d.Message, new System.Drawing.Point(100, 50), (float)0.6); debug2.Draw(); UIText debug = new UIText("location: " + d.StackTrace, new System.Drawing.Point(100, 200), (float)0.6); debug.Draw(); UIText debug3 = new UIText("Error: " + d.Message, new System.Drawing.Point(100, 350), (float)0.6); debug3.Draw(); } catch { } Sounds.unLoad(); while (true) { UI.Notify(d.Message); UI.Notify(d.StackTrace); UI.Notify(d.TargetSite.Name); UI.Notify(d.ToString()); Wait(10); } } }