Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
tomybk

Call Emergency (C#)

Recommended Posts

tomybk
Posted (edited)

Is there a way to call emergency (police, paramedic) to come on my location like game characters can do it on cell phone?
I search natives and i didnt find nothing about that.

Edited by tomybk

Share this post


Link to post
Share on other sites
Guest

Look for natives like GAMEPLAY::CREATE_INCIDENT

Share this post


Link to post
Share on other sites
tomybk
Posted (edited)

Interesting Native, but in both method they give me game crash when  i try to call paramedic.
Here is code:

Function.Call(Hash.CREATE_INCIDENT, 5, -2971.59f, 431.01f, 15.22f);
And this one:
Function.Call(Hash.CREATE_INCIDENT, 5, Game.Player, 1.49f);

 

Edited by tomybk

Share this post


Link to post
Share on other sites
Guest
Posted (edited)

Look at the parameter list:

BOOL CREATE_INCIDENT(int incidentType, float x, float y, float z, int p5, float radius, int *outIncidentID)

None of the ones you used are anything like that. You can't just use some of the parameters, you have to provide matching input parameters when it requires them and provide an output parameter when it requires it.

 

That native wants 6 input parameters and an output parameter... and none of the input parameters are the Player.

 

Here's an example from the game scripts:

else if (MISC::CREATE_INCIDENT(5, vLocal_45, 2, 3f, &uLocal_47, 0, 0))

5 is the incident type, which is Paramedics

vLocal_45 is a Vector3 but you can't pass it a Vector3, which is why it wants the x, y & z as float values

2 is the p5 parameter and going off what it says on the NativeDB website, that's the number of peds it will send... paramedics typically come as a pair.

3f is the radius

&uLocal_47 is the output parameter

 

Always read the comments under the natives on this site http://www.dev-c.com/nativedb/ for more information

 

I would also advise getting a copy of the decompiled scripts, so you can search for examples of how the natives are used by the game. Decompiled scripts here, not the latest versions but it won't matter for what you need to use them for. https://www.gta5-mods.com/tools/v1290-decompiled-scripts-rootcause

 

 

Edited by Guest

Share this post


Link to post
Share on other sites
Guest
Posted (edited)

Add this enum to your project:

    enum IncidentTypes
    {
        FireDepartment = 3,
        Paramedics = 5,
        Police = 7,
        PedsInCavalcades = 11,
        Merryweather = 14
    };

Set your project to Allow Unsafe Code. That's in the Project Properties > Build.

 

Then you can use this function to create incidents:

    private int CreateIncident(IncidentTypes incidentType, Vector3 position, int pedsCalled, float radius)
    {
        int incidentID = 0;
        bool validCall = false;

        unsafe
        {
            validCall = Function.Call<bool>(Hash.CREATE_INCIDENT, (int)incidentType, position.X, position.Y, position.Z, pedsCalled, radius, &incidentID);
        }

        return validCall ? incidentID : -1;
    }

Use it like this:

    int incidentID = CreateIncident(IncidentTypes.Paramedics, Game.Player.Character.Position, 2, 3f);

I have never used this native and there were some comments about certain incident types and the bool value that gets returned, so you'll need to read more on that.

Edited by Guest

Share this post


Link to post
Share on other sites
tomybk
Posted (edited)

Ok thx, will try to figured this, i am building trainer last 5 months, because (funny reason) i buy big tv and need bigger trainer (letters) i know many of them have that but i decide build my own.
Can you help me to place your code in button code line? Since i am not programmer but this interest me alot.....btw i am GtaGam3r (the guy who moddeling GarageV and Liberty Island for gta 5)
Edit: i am building menu in C#

Edited by tomybk

Share this post


Link to post
Share on other sites
Guest
Posted (edited)
20 minutes ago, tomybk said:

Can you help me to place your code in button code line? Since i am not programmer but this interest me alot.....btw i am GtaGam3r (the guy who moddeling GarageV and Liberty Island for gta 5)

You just need to use that last line I posted inside your button_pressed event handler. and add the rest of the code anywhere in your main script class. Only you know how you have coded the menu selection handling but it's just a simple function call.

 

Edited by Guest

Share this post


Link to post
Share on other sites
tomybk

ok thank you, now i understand better where and what i need to place in my menu.

Share this post


Link to post
Share on other sites
tomybk

OMG this is working!!! Thank you million times.
Will credit you when i will release trainer :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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