LostProphet

ScriptHookVDotNet Fire Class

Aug 1st, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //totally 100% untested
  2. //i'm pretty sure everything will work, but i am skeptical about GetClosestFirePosition
  3.  
  4. class Fire
  5.         {
  6.             private int g_FireID;
  7.  
  8.             public int FireID
  9.             {
  10.                 get
  11.                 {
  12.                     return g_FireID;
  13.                 }
  14.             }
  15.  
  16.             public Fire(int fireID)
  17.             {
  18.                 g_FireID = fireID;
  19.             }
  20.  
  21.             public Fire(GTA.Math.Vector3 position, int maxChildren, bool isGasFire)
  22.             {
  23.                 g_FireID = GTA.Native.Function.Call<int>(GTA.Native.Hash.START_SCRIPT_FIRE, position.X, position.Y, position.Z, maxChildren, isGasFire);
  24.             }
  25.  
  26.             public static Fire CreateFire(GTA.Math.Vector3 position, int maxChildren, bool isGasFire)
  27.             {
  28.                 return new Fire(position, maxChildren, isGasFire);
  29.             }
  30.  
  31.             public void Remove()
  32.             {
  33.                 RemoveFire(g_FireID);
  34.             }
  35.  
  36.             public static void RemoveFire(int fireID)
  37.             {
  38.                 GTA.Native.Function.Call<int>(GTA.Native.Hash.REMOVE_SCRIPT_FIRE, fireID);
  39.             }
  40.  
  41.             public static int GetNumberOfFiresInRange(GTA.Math.Vector3 position, float radius)
  42.             {
  43.                 return GTA.Native.Function.Call<int>(GTA.Native.Hash.GET_NUMBER_OF_FIRES_IN_RANGE, position.X, position.Y, position.Z, radius);
  44.             }
  45.  
  46.             public static void StopFireInRange(GTA.Math.Vector3 position, float radius)
  47.             {
  48.                 GTA.Native.Function.Call(GTA.Native.Hash.STOP_FIRE_IN_RANGE, position.X, position.Y, position.Z, radius);
  49.             }
  50.  
  51.  
  52.             public static bool GetClosestFirePosition(out Fire fire, out GTA.Math.Vector3 position)
  53.             {
  54.                 GTA.Native.OutputArgument fireID = new GTA.Native.OutputArgument();
  55.                 GTA.Native.OutputArgument x = new GTA.Native.OutputArgument(), y = new GTA.Native.OutputArgument(), z = new GTA.Native.OutputArgument();
  56.                 bool foundOne;
  57.                 foundOne = GTA.Native.Function.Call<bool>(GTA.Native.Hash.GET_CLOSEST_FIRE_POS, fireID, x, y, z);
  58.                 fire = new Fire(fireID.GetResult<int>());
  59.                 position = new GTA.Math.Vector3(x.GetResult<float>(), y.GetResult<float>(), z.GetResult<float>());
  60.  
  61.                 return foundOne;
  62.             }
  63.         }
Add Comment
Please, Sign In to add comment