Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Math;
- using GTA.Native;
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace FreezeTime
- {
- public class FreezeTime : Script
- {
- private ScriptSettings config;
- private Keys key;
- private Dictionary<Vehicle, Vector3> vehRotVel = new Dictionary<Vehicle, Vector3>();
- private Dictionary<Vehicle, Vector3> vehVel = new Dictionary<Vehicle, Vector3>();
- private Dictionary<Vehicle, float> vehSpeed = new Dictionary<Vehicle, float>();
- private Dictionary<Ped, Vector3> pedVel = new Dictionary<Ped, Vector3>();
- private Dictionary<Ped, Vector3> pedRotVel = new Dictionary<Ped, Vector3>();
- private Dictionary<Prop, Vector3> propVel = new Dictionary<Prop, Vector3>();
- private Dictionary<Prop, Vector3> propRotVel = new Dictionary<Prop, Vector3>();
- private bool freeze = false;
- public FreezeTime()
- {
- this.Tick += new EventHandler(this.OnTick);
- this.KeyUp += new KeyEventHandler(this.OnKeyUp);
- this.Interval = 10;
- this.config = ScriptSettings.Load("scripts\\FreezeTime.ini");
- if (!Enum.TryParse<Keys>((string) this.config.GetValue<string>(nameof (FreezeTime), "Freeze", (M0) "X"), out this.key))
- this.key = Keys.X;
- this.vehRotVel.Clear();
- this.vehVel.Clear();
- this.vehSpeed.Clear();
- this.propVel.Clear();
- this.propRotVel.Clear();
- this.pedVel.Clear();
- this.pedRotVel.Clear();
- }
- private void OnTick(object sender, EventArgs e)
- {
- if (!this.freeze)
- return;
- foreach (Vehicle allVehicle in World.GetAllVehicles())
- {
- if (!this.vehRotVel.ContainsKey(allVehicle) && !Entity.op_Equality((Entity) allVehicle, (Entity) null) && ((Entity) allVehicle).Exists())
- {
- this.vehRotVel[allVehicle] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allVehicle)
- });
- this.vehVel[allVehicle] = ((Entity) allVehicle).Velocity;
- this.vehSpeed[allVehicle] = allVehicle.Speed;
- ((Entity) allVehicle).FreezePosition = true;
- if (allVehicle.ClassType == 15)
- {
- Function.Call((Hash) -204901355570414515L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- Function.Call((Hash) 2636792098548582430L, new InputArgument[4]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false)
- });
- }
- else if (allVehicle.ClassType == 21)
- {
- Function.Call((Hash) -6193635740946557213L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- Function.Call((Hash) 1605131416520909493L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- }
- }
- }
- foreach (Prop allProp in World.GetAllProps())
- {
- if (!Entity.op_Equality((Entity) allProp, (Entity) null) && ((Entity) allProp).Exists() && (!this.propVel.ContainsKey(allProp) && !((Entity) allProp).IsAttached()))
- {
- this.propRotVel[allProp] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allProp)
- });
- this.propVel[allProp] = ((Entity) allProp).Velocity;
- ((Entity) allProp).FreezePosition = true;
- }
- }
- foreach (Ped allPed in World.GetAllPeds())
- {
- if (!Entity.op_Equality((Entity) allPed, (Entity) Game.Player.Character) && !Entity.op_Equality((Entity) allPed, (Entity) null) && ((Entity) allPed).Exists())
- {
- Function.Call((Hash) -5134454549476615409L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- Function.Call((Hash) 1687984505842882311L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- Function.Call((Hash) -2166446847354211635L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- if (!this.pedVel.ContainsKey(allPed))
- {
- this.pedRotVel[allPed] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- this.pedVel[allPed] = ((Entity) allPed).Velocity;
- ((Entity) allPed).FreezePosition = true;
- Function.Call((Hash) -1421300284113336712L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(292),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(224),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 7744612924842995801L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) -6955927877681029095L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(3),
- InputArgument.op_Implicit(false)
- });
- if (Function.Call<bool>((Hash) -7387383988179580405L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- }) == 0)
- Function.Call((Hash) -7954516656429786791L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(500)
- });
- }
- }
- }
- }
- private void OnKeyUp(object sender, KeyEventArgs e)
- {
- if (e.KeyCode != this.key)
- return;
- this.freeze = !this.freeze;
- if (this.freeze)
- {
- Function.Call((Hash) -8147678770085225564L, new InputArgument[2]
- {
- InputArgument.op_Implicit(Game.Player),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) 3658658653323582058L, new InputArgument[2]
- {
- InputArgument.op_Implicit(Game.Player),
- InputArgument.op_Implicit(true)
- });
- foreach (Vehicle allVehicle in World.GetAllVehicles())
- {
- if (!Entity.op_Equality((Entity) allVehicle, (Entity) null) && ((Entity) allVehicle).Exists())
- {
- this.vehSpeed[allVehicle] = allVehicle.Speed;
- this.vehVel[allVehicle] = ((Entity) allVehicle).Velocity;
- this.vehRotVel[allVehicle] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allVehicle)
- });
- ((Entity) allVehicle).FreezePosition = true;
- if (allVehicle.ClassType == 15)
- {
- Function.Call((Hash) -204901355570414515L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- Function.Call((Hash) 2636792098548582430L, new InputArgument[4]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false)
- });
- }
- else if (allVehicle.ClassType == 21)
- {
- Function.Call((Hash) -6193635740946557213L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- Function.Call((Hash) 1605131416520909493L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allVehicle),
- InputArgument.op_Implicit(0.0f)
- });
- }
- }
- }
- foreach (Prop allProp in World.GetAllProps())
- {
- if (!Entity.op_Equality((Entity) allProp, (Entity) null) && ((Entity) allProp).Exists() && !((Entity) allProp).IsAttached())
- {
- this.propVel[allProp] = ((Entity) allProp).Velocity;
- this.propRotVel[allProp] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allProp)
- });
- ((Entity) allProp).FreezePosition = true;
- }
- }
- foreach (Ped allPed in World.GetAllPeds())
- {
- if (!Entity.op_Equality((Entity) allPed, (Entity) Game.Player.Character) && !Entity.op_Equality((Entity) allPed, (Entity) null) && ((Entity) allPed).Exists())
- {
- this.pedVel[allPed] = ((Entity) allPed).Velocity;
- this.pedRotVel[allPed] = (Vector3) Function.Call<Vector3>((Hash) 2394667074804365699L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- ((Entity) allPed).FreezePosition = true;
- Function.Call((Hash) 1687984505842882311L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- Function.Call((Hash) -2166446847354211635L, new InputArgument[1]
- {
- InputArgument.op_Implicit(allPed)
- });
- if (Function.Call<bool>((Hash) -7387383988179580405L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- }) == 0)
- Function.Call((Hash) -7954516656429786791L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(500)
- });
- Function.Call((Hash) -4531720697364008740L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) -1421300284113336712L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(292),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(224),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 7744612924842995801L, new InputArgument[2]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) -6955927877681029095L, new InputArgument[3]
- {
- InputArgument.op_Implicit(allPed),
- InputArgument.op_Implicit(3),
- InputArgument.op_Implicit(false)
- });
- }
- }
- }
- else
- {
- Function.Call((Hash) -8147678770085225564L, new InputArgument[2]
- {
- InputArgument.op_Implicit(Game.Player),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 3658658653323582058L, new InputArgument[2]
- {
- InputArgument.op_Implicit(Game.Player),
- InputArgument.op_Implicit(false)
- });
- foreach (Vehicle key in this.vehSpeed.Keys)
- {
- if (!Entity.op_Equality((Entity) key, (Entity) null) && ((Entity) key).Exists())
- {
- ((Entity) key).FreezePosition = false;
- key.Speed = this.vehSpeed[key];
- ((Entity) key).Velocity = this.vehVel[key];
- if (key.ClassType == 15)
- {
- Function.Call((Hash) -6811616170357365235L, new InputArgument[1]
- {
- InputArgument.op_Implicit(key)
- });
- Function.Call((Hash) 2636792098548582430L, new InputArgument[4]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false)
- });
- }
- else if (key.ClassType == 21)
- {
- Function.Call((Hash) -6193635740946557213L, new InputArgument[2]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(this.vehSpeed[key])
- });
- Function.Call((Hash) 1605131416520909493L, new InputArgument[2]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(this.vehSpeed[key])
- });
- }
- if (Function.Call<bool>((Hash) 2142966313329761649L, new InputArgument[1]
- {
- InputArgument.op_Implicit(key)
- }) == 0)
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (this.vehRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (this.vehRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (this.vehRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- else
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (-this.vehRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (-this.vehRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (-this.vehRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- }
- }
- foreach (Prop key in this.propVel.Keys)
- {
- if (!Entity.op_Equality((Entity) key, (Entity) null) && ((Entity) key).Exists() && !((Entity) key).IsAttached())
- {
- ((Entity) key).FreezePosition = false;
- ((Entity) key).Velocity = this.propVel[key];
- if (Function.Call<bool>((Hash) 2142966313329761649L, new InputArgument[1]
- {
- InputArgument.op_Implicit(key)
- }) == 0)
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (this.propRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (this.propRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (this.propRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- else
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (-this.propRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (-this.propRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (-this.propRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- }
- }
- foreach (Ped key in this.pedVel.Keys)
- {
- if (!Entity.op_Equality((Entity) key, (Entity) null) && ((Entity) key).Exists())
- {
- ((Entity) key).FreezePosition = false;
- ((Entity) key).Velocity = this.pedVel[key];
- Function.Call((Hash) -1421300284113336712L, new InputArgument[2]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(292),
- InputArgument.op_Implicit(false)
- });
- Function.Call((Hash) 1807067481085428835L, new InputArgument[3]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(224),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) 7744612924842995801L, new InputArgument[2]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(true)
- });
- Function.Call((Hash) -6955927877681029095L, new InputArgument[3]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(3),
- InputArgument.op_Implicit(true)
- });
- if (Function.Call<bool>((Hash) 2142966313329761649L, new InputArgument[1]
- {
- InputArgument.op_Implicit(key)
- }) == 0)
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (this.pedRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (this.pedRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (this.pedRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- else
- Function.Call((Hash) -4182001369491821288L, new InputArgument[14]
- {
- InputArgument.op_Implicit(key),
- InputArgument.op_Implicit(5),
- InputArgument.op_Implicit((float) (-this.pedRotVel[key].X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (-this.pedRotVel[key].Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (-this.pedRotVel[key].Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.X * ((Entity) key).ForwardVector.X)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Y * ((Entity) key).ForwardVector.Y)),
- InputArgument.op_Implicit((float) (((Entity) key).Rotation.Z * ((Entity) key).ForwardVector.Z)),
- InputArgument.op_Implicit(2),
- InputArgument.op_Implicit(true),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false),
- InputArgument.op_Implicit(false)
- });
- }
- }
- this.vehRotVel.Clear();
- this.vehVel.Clear();
- this.vehSpeed.Clear();
- this.propVel.Clear();
- this.propRotVel.Clear();
- this.pedVel.Clear();
- this.pedRotVel.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement