Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

How to use : GET_CLOSEST_FIRE_POS ?


StAfFMaN
 Share

Recommended Posts

Hi everybody !!

 

I'm trying to use this function but all my tests are grashing my game... :

Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, MarkerIntervention.Position.Length(), MarkerIntervention.Position.X, MarkerIntervention.Position.Y, MarkerIntervention.Position.Z);

I've put this code in a loop ( tick(); ) with many terms to return everytime if it's true. If it's true, i would like get the vector3 coord and ask to my teammates to go at this point and do something.

 

I've found this information : (here)

FIRE::GET_CLOSEST_FIRE_POSHashes: 0x352A9F6BCF90081F 0xC4977B47BOOL GET_CLOSEST_FIRE_POS(Vector3 *outPosition, float x, float y,  float z) // 0x352A9F6BCF90081F 0xC4977B47Returns TRUE if it found something. FALSE if not.

But the problem is : i don't know what can i inquire to Vector3 *outPosition, float x, y and z...

 

This is a part of my code (from my FireFighterMod) :

bool existeFeu = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, MarkerIntervention.Position.Length(), MarkerIntervention.Position.X, MarkerIntervention.Position.Y, MarkerIntervention.Position.Z);if (PositionEntrePompierEtFeu < 15){   if (listeObjetsFeu[o].IsOnFire)   {      listePompier[i].Task.RunTo(PositionObjetEnFeu.Around(2f));      PompierVaAuFeu = true;   }   if (existeFeu == true)   {      UI.ShowSubtitle("existeFeu = " + existeFeu.ToString(), 2000);      /*Vector3 PositionFeu = Function.Call<Vector3>(Hash.GET_CLOSEST_FIRE_POS, MarkerIntervention.Position.X + 15f, MarkerIntervention.Position.Y + 15f, MarkerIntervention.Position.Z + 15f);      listePompier[i].Task.RunTo(PositionFeu.Around(2f));      PompierVaAuFeu = true;*/   }}

Anybody have an example ?

 

Anybody can help me please ?

 

Thank a lot guys !!

 

Best regard,

 

[stAfF]MaN --- MaNfr

Link to comment
Share on other sites


OutputArgument outPos = new OutputArgument();

bool existeFeu = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, outPos, MarkerIntervention.Position.X, MarkerIntervention.Position.Y, MarkerIntervention.Position.Z);

Vector3 pos = outPos.GetResult<Vector3>();

Link to comment
Share on other sites

Here is how you should proceed :

 

  • Get the position from where you want to start checking for fires
  • Use an output argument
  • Retrieve the result from the native call

Code :

            OutputArgument argument = new OutputArgument(); // Create our argument ; this is the raw data we are getting from the native GET_CLOSEST_FIRE_POS            Vector3 StartPosition = new Vector3(0F, 0F, 0F); // Position where we start looking for fires, of course you have to decide where to start looking for fires (replace 0F, 0F, 0F with your coords).            Vector3 RealFirePosition; // If there is a close fire, this will be our Vector3 we need.            bool closeFireExists = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, new InputArgument[] {argument,  StartPosition.X, StartPosition.Y, StartPosition.Z});            if (closeFireExists)            {                RealFirePosition = argument.GetResult<Vector3>(); // Get our Vector3 new position            } 

Normally this should work.

Link to comment
Share on other sites

OutputArgument outPos = new OutputArgument();bool existeFeu = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, outPos, MarkerIntervention.Position.X, MarkerIntervention.Position.Y, MarkerIntervention.Position.Z);Vector3 pos = outPos.GetResult<Vector3>();

 

 

Here is how you should proceed :

 

  • Get the position from where you want to start checking for fires
  • Use an output argument
  • Retrieve the result from the native call

Code :

            OutputArgument argument = new OutputArgument(); // Create our argument ; this is the raw data we are getting from the native GET_CLOSEST_FIRE_POS            Vector3 StartPosition = new Vector3(0F, 0F, 0F); // Position where we start looking for fires, of course you have to decide where to start looking for fires (replace 0F, 0F, 0F with your coords).            Vector3 RealFirePosition; // If there is a close fire, this will be our Vector3 we need.            bool closeFireExists = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, new InputArgument[] {argument,  StartPosition.X, StartPosition.Y, StartPosition.Z});            if (closeFireExists)            {                RealFirePosition = argument.GetResult<Vector3>(); // Get our Vector3 new position            } 

Normally this should work.

 

Ok thanks a lot ! I will try that !! Feedback coming later ^^

Link to comment
Share on other sites

unknown modder
            bool closeFireExists = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, new InputArgument[] {argument,  StartPosition.X, StartPosition.Y, StartPosition.Z});

there is no need to do the conversion to InputArgument[], the Function.Call functions uses the params keyword which will tell the compiler to implicitly convert all input arguments passed to an InputArgument array.

In short this is just as valid, but nicer to write

Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, argument, StartPosition.X, StartPosition.Y, StartPosition.Z);
  • Like 2
Link to comment
Share on other sites

Awesome it's working pretty fine !!

 

This is the code if anybody want an example :)

 

(In the tick(); )

if (listePompier.Count != 0) // check if the list is different than 0            {                if (SurLesLieux == true)                {                    OutputArgument outPos = new OutputArgument();                    bool existeFeu = Function.Call<bool>(Hash.GET_CLOSEST_FIRE_POS, outPos, MarkerIntervention.Position.X, MarkerIntervention.Position.Y, MarkerIntervention.Position.Z); // check if any fire exist from the X, Y, Z, pos and return true if it's found something and put the vector3 position in "outPos"                    foreach (Ped nouveauPompier in listePompier)// for all "nouveauPompier" element in the list                    {                        if (nouveauPompier.IsOnFoot)// check if he is on foot                        {                            if (existeFeu == true)// Check if "existeFeu" is true to return the vector3 of the fire                            {                                Vector3 PositionFeu = outPos.GetResult<Vector3>(); Return the Vector3 of the fire in "PositionFeu"                                float PositionEntrePompierEtFeu = World.GetDistance(nouveauPompier.Position, PositionFeu); // Get the distance between "nouveauPompier" and "PositionFeu"                                if (PositionEntrePompierEtFeu < 20) // Check if the distance between "nouveauPompier" and "positionFeu" is under 20                                {                                    if (!nouveauPompier.IsShooting)// check if "nouveauPompier" is NOT shooting                                     {                                        if (PompierVaAuFeu == false)// Check if "nouveauPompier" is NOT already running to "PositionFeu"                                        {                                            PompierVaAuFeu = true;                                              nouveauPompier.Task.RunTo(PositionFeu.Around(2f));// If NOT, task for "nouveauPompier" to run at "positionFeu" and indicate "PompierVaAuFeu" is true                                        }                                    }                                }                                if (PositionEntrePompierEtFeu <= 3) // check if the distance between "nouveauPompier" and "PositionFeu" is under or equals than 3                                {                                    if (!nouveauPompier.IsShooting)// Check if "nouveauPompier" is NOT shooting                                    {                                        if (PompierVaAuFeu == true)// Check if "nouveauPompier" is running to "PositionFeu"                                        {                                            PompierVaAuFeu = false; // Indicate "nouveauPompier" is NOT running because he's arrived at "PositionFeu"                                            nouveauPompier.Weapons.RemoveAll(); // Do remove all weapons                                            nouveauPompier.Weapons.Give(WeaponHash.FireExtinguisher, -1, true, true); // Just give an extinguisher                                            nouveauPompier.ShootRate = 100; // Set the shoot rate                                            nouveauPompier.Task.ShootAt(PositionFeu, 3000, FiringPattern.FullAuto); // Task "nouveauPompier" shoot at the PositionFeu with the extinguisher during 3seconds                                        }                                    }                                }                            }                        }                    }                    UI.ShowSubtitle("existeFeu = ~r~" + existeFeu.ToString(), 500); // Debug text to know is any fire exist again                }            }

If you think the code is not optimized, i'm listening you lol :)

 

Thanks for all guys ;)

 

Best regard,

 

[stAfF]MaN -- MaNfr

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.