Advertisement
LostProphet

Effects class

Sep 8th, 2011
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.15 KB | None | 0 0
  1. using GTA;
  2.  
  3. #pragma warning disable 1591 // Missing XML comments.
  4.  
  5. namespace Functions
  6. {
  7.     public class Effects
  8.     {
  9.         #region Fields
  10.  
  11.         private string effectName = string.Empty;
  12.         private int effectID = 0;
  13.         private bool effectRunning = false;
  14.  
  15.         #endregion
  16.  
  17.         #region Constructor
  18.  
  19.         public Effects(string effectName)
  20.         {
  21.             this.effectName = effectName;
  22.         }
  23.  
  24.         #endregion
  25.  
  26.         #region Properties
  27.  
  28.         public int EffectID
  29.         {
  30.             get
  31.             {
  32.                 return this.effectID;
  33.             }
  34.         }
  35.  
  36.         #endregion
  37.  
  38.         #region Methods
  39.  
  40.         public int Start(Vector3 position, Vector3 rotation, float scale)
  41.         {
  42.             if (!this.effectRunning)
  43.             {
  44.                 this.effectRunning = true;
  45.  
  46.                 return (this.effectID = GTA.Native.Function.Call<int>("START_PTFX", this.effectName, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, scale));
  47.             }
  48.  
  49.             return 0;
  50.         }
  51.         public int Start(Vector3 position, float scale)
  52.         {
  53.             return this.Start(position, Vector3.Zero, scale);
  54.         }
  55.         public int Start(Vector3 position)
  56.         {
  57.             return this.Start(position, Vector3.Zero, 1.0f);
  58.         }
  59.  
  60.         public int StartOnObject(GTA.Object obj, Vector3 offset, Vector3 rotation, float scale)
  61.         {
  62.             if (!this.effectRunning)
  63.             {
  64.                 this.effectRunning = true;
  65.  
  66.                 return (this.effectID = GTA.Native.Function.Call<int>("START_PTFX_ON_OBJ", this.effectName, obj, offset.X, offset.Y, offset.Z, rotation.X, rotation.Y, rotation.Z, scale));
  67.             }
  68.  
  69.             return 0;
  70.         }
  71.         public int StartOnObject(GTA.Object obj, Vector3 offset)
  72.         {
  73.             return this.StartOnObject(obj, offset, Vector3.Zero, 1.0f);
  74.         }
  75.         public int StartOnObject(GTA.Object obj)
  76.         {
  77.             return this.StartOnObject(obj, Vector3.Zero, Vector3.Zero, 1.0f);
  78.         }
  79.  
  80.         public int StartOnVehicle(GTA.Vehicle vehicle, Vector3 offset, Vector3 rotation, float scale)
  81.         {
  82.             if (!this.effectRunning)
  83.             {
  84.                 this.effectRunning = true;
  85.  
  86.                 return (this.effectID = GTA.Native.Function.Call<int>("START_PTFX_ON_VEH", this.effectName, vehicle, offset.X, offset.Y, offset.Z, rotation.X, rotation.Y, rotation.Z, scale));
  87.             }
  88.  
  89.             return 0;
  90.         }
  91.         public int StartOnVehicle(GTA.Vehicle vehicle, Vector3 offset)
  92.         {
  93.             return this.StartOnVehicle(vehicle, offset, Vector3.Zero, 1.0f);
  94.         }
  95.         public int StartOnVehicle(GTA.Vehicle vehicle)
  96.         {
  97.             return this.StartOnVehicle(vehicle, Vector3.Zero, Vector3.Zero, 1.0f);
  98.         }
  99.  
  100.         public int StartOnPed(GTA.Ped ped, Vector3 offset, Vector3 rotation, float scale)
  101.         {
  102.             if (!this.effectRunning)
  103.             {
  104.                 this.effectRunning = true;
  105.  
  106.                 return (this.effectID = GTA.Native.Function.Call<int>("START_PTFX_ON_PED", this.effectName, ped, offset.X, offset.Y, offset.Z, rotation.X, rotation.Y, rotation.Z, scale));
  107.             }
  108.  
  109.             return 0;
  110.         }
  111.         public int StartOnPed(GTA.Ped ped, Vector3 offset)
  112.         {
  113.             return this.StartOnPed(ped, offset, Vector3.Zero, 1.0f);
  114.         }
  115.         public int StartOnPed(GTA.Ped ped)
  116.         {
  117.             return this.StartOnPed(ped, Vector3.Zero, Vector3.Zero, 1.0f);
  118.         }
  119.  
  120.         public int StartOnPedBone(GTA.Ped ped, GTA.Bone bone, Vector3 offset, Vector3 rotation, float scale)
  121.         {
  122.             if (!this.effectRunning)
  123.             {
  124.                 this.effectRunning = true;
  125.  
  126.                 return (this.effectID = GTA.Native.Function.Call<int>("START_PTFX_ON_PED_BONE", this.effectName, ped, offset.X, offset.Y, offset.Z, rotation.X, rotation.Y, rotation.Z, (int)bone, scale));
  127.             }
  128.  
  129.             return 0;
  130.         }
  131.         public int StartOnPedBone(GTA.Ped ped, GTA.Bone bone, Vector3 offset)
  132.         {
  133.             return this.StartOnPedBone(ped, bone, offset, Vector3.Zero, 1.0f);
  134.         }
  135.         public int StartOnPedBone(GTA.Ped ped, GTA.Bone bone)
  136.         {
  137.             return this.StartOnPedBone(ped, bone, Vector3.Zero, Vector3.Zero, 1.0f);
  138.         }
  139.  
  140.         public void Update(Vector3 position, Vector3 rotation)
  141.         {
  142.             if (this.effectID > 0) //if (this.effectStarted)
  143.                 GTA.Native.Function.Call("UPDATE_PTFX_OFFSETS", this.effectID, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z);
  144.         }
  145.         public void Update(Vector3 position)
  146.         {
  147.             this.Update(position, Vector3.Zero);
  148.         }
  149.  
  150.         public void Stop()
  151.         {
  152.             if (this.effectID > 0 && this.effectRunning) //if (this.effectStarted)
  153.             {
  154.                 GTA.Native.Function.Call("STOP_PTFX", this.effectID);
  155.  
  156.                 this.effectID = 0;
  157.                 this.effectRunning = false;
  158.             }
  159.         }
  160.  
  161.         #endregion
  162.     }
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement