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

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

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

      1. Events
    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

    2. GTA 6

    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

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

    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. DYOM
      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. 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
    3. Gangs

    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
darthbollo

[C#][.NET] How to make your weapon shoot money bags?

Recommended Posts

darthbollo

Hey guys I've been playing around with the scripthook .net and I've been wondering how to shoot money bags out of my gun.

Share this post


Link to post
Share on other sites
Mgel

Please search the forum before starting a thread.

 

There's these two threads

http://gtaforums.com/topic/801360-lua-spawn-2k-40k-money-bags-script/?hl=%2Bmoney+%2Bbags

http://gtaforums.com/topic/792882-how-to-create-money-bags-instead-of-bullets-when-shooting/?hl=%2Bmoney+%2Bbags

 

and more related to this particular subject.

Edited by Mgel

Share this post


Link to post
Share on other sites
darthbollo

Those aren't the languages I'm using, so obviously the syntax will be different; I'm using C#.

Share this post


Link to post
Share on other sites
leftas

Are you kidding me ? In these threads they also using c#,c++... And btw. All c#,lua,c++ calls native functions, and in wrappers you can call natives so you can adapt almost any code whatever language is. Don't be lazy.

 

All the best,

Paul

  • Like 2

Share this post


Link to post
Share on other sites
Mgel

Those aren't the languages I'm using, so obviously the syntax will be different; I'm using C#.

 

If you know C# and a little bit about scripting for GTA V, then obviously you should be able to understand some of the code written in some of the other languages.

 

Here's a link to the source code of Animal Cannon(https://www.gta5-mods.com/scripts/cat-cannon), all credit goes to http://gtaforums.com/topic/802865-help-with-scripthook-10-menubutton/?p=1067635004

It's not exactly want you want, but it is very similar, and in C#.

 

You should be able to write a mod that shoots moneybags with the links provided.

Edited by Mgel
  • Like 1

Share this post


Link to post
Share on other sites
darthbollo

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

Share this post


Link to post
Share on other sites
Mgel

It's very hard to provide any additional help unless you provide some code.

Either in snippets here or a pastebin.

 

I haven't worked with the GET_PED_LAST_WEAPON_IMPACT_COORD native, but after a quick look i would use it like this:

Vector3 moneybagSpawnLoc = Function.Call<Vector3>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

Edit:

 

Actually, I'm unsure. On NativeDB it is marked as a bool return type, therefore you would have to do this.

bool impact = Function.Call<bool>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

But this does not make any sense to me and now I'm not sure which one is correct. You will have to test this yourself.

Edited by Mgel

Share this post


Link to post
Share on other sites
leftas

It's very hard to provide any additional help unless you provide some code.

Either in snippets here or a pastebin.

 

I haven't worked with the GET_PED_LAST_WEAPON_IMPACT_COORD native, but after a quick look i would use it like this:

Vector3 moneybagSpawnLoc = Function.Call<Vector3>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

Edit:

 

Actually, I'm unsure. On NativeDB it is marked as a bool return type, therefore you would have to do this.

bool impact = Function.Call<bool>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

But this does not make any sense to me and now I'm not sure which one is correct. You will have to test this yourself.

You mislooked one parameter, you also need to put the "Vector3" pointer in parameter, OP.

 

But, if you really want to only shoot moneys, you shouldn't use this native. You should disable control, then check if it been pressed and if it's you need to calculate where it should land :)

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
Mgel

 

It's very hard to provide any additional help unless you provide some code.

Either in snippets here or a pastebin.

 

I haven't worked with the GET_PED_LAST_WEAPON_IMPACT_COORD native, but after a quick look i would use it like this:

Vector3 moneybagSpawnLoc = Function.Call<Vector3>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

Edit:

 

Actually, I'm unsure. On NativeDB it is marked as a bool return type, therefore you would have to do this.

bool impact = Function.Call<bool>(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, Game.Player.Character)

But this does not make any sense to me and now I'm not sure which one is correct. You will have to test this yourself.

You mislooked one parameter, you also need to put the "Vector3" pointer in parameter, OP.

 

But, if you really want to only shoot moneys, you shouldn't use this native. You should disable control, then check if it been pressed and if it's you need to calculate where it should land :)

 

All the best,

Paul.

 

I did notice that parameter, but I just thought it could be used as the return type.

My pointer knowledge is weak, I should research how to use these. Thanks :)

Share this post


Link to post
Share on other sites
CamxxCore

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

 

Here is how you can do it, avoiding unsafe code:

            Ped ped = Game.Player.Character;            if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))            {                OutputArgument arg = new OutputArgument();                Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                GTA.Math.Vector3 result = arg.GetResult<GTA.Math.Vector3>();                if (result != GTA.Math.Vector3.Zero)                {                    Model model = new Model(0x113FD533);                    if (!model.IsLoaded)                    model.Request(1000);                    int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                    Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, model.Hash, 0, 1);                }            } 

With unsafe code:

                unsafe                 {                 Ped ped = Game.Player.Character;                 if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))                    {                        float[] result = new float[6];                        fixed (float* floatptr = result)                        {                            Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, floatPtr);                        }                        if (new GTA.Math.Vector3(result[0], result[2], result[4]) != Vector3.Zero)                        {                            Model model = new Model(0x113FD533);                            if (!model.IsLoaded)                            model.Request(1000);                            int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                             Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result[0], result[2], result[4], 0, 2000, model.Hash, 0, 1);                          }                    }
Edited by CamxxCore
  • Like 2

Share this post


Link to post
Share on other sites
darthbollo

 

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

 

Here is how you can do it, avoiding unsafe code:

                Ped ped = Game.Player.Character;                if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))                {                    OutputArgument arg = new OutputArgument();                    Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                    Vector3 result = arg.GetResult<Vector3>();                    if (result != Vector3.Zero)                    {                        int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_SECURITY_CASE");                        Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, 0, 0, 1);                    }                }

This doesn't work, when I tried to use the code money bags wouldn't appear.

Share this post


Link to post
Share on other sites
CamxxCore

 

 

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

Here is how you can do it, avoiding unsafe code:

            Ped ped = Game.Player.Character;            if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))            {                OutputArgument arg = new OutputArgument();                Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                GTA.Math.Vector3 result = arg.GetResult<GTA.Math.Vector3>();                if (result != GTA.Math.Vector3.Zero)                {                    Model model = new Model(0x113FD533);                    if (!model.IsLoaded)                    model.Request(1000);                    int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                    Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, model.Hash, 0, 1);                }            }
This doesn't work, when I tried to use the code money bags wouldn't appear.

 

Are you calling it each game tick?

Edited by CamxxCore
  • Like 1

Share this post


Link to post
Share on other sites
darthbollo

yes

Share this post


Link to post
Share on other sites
CamxxCore

yes

 

I updated the code to spawn money bags as a pose to money cases. I think the money cases just fall through the map. Give it another shot.

Share this post


Link to post
Share on other sites
darthbollo

 

 

 

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

Here is how you can do it, avoiding unsafe code:

            Ped ped = Game.Player.Character;            if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))            {                OutputArgument arg = new OutputArgument();                Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                GTA.Math.Vector3 result = arg.GetResult<GTA.Math.Vector3>();                if (result != GTA.Math.Vector3.Zero)                {                    Model model = new Model(0x113FD533);                    if (!model.IsLoaded)                    model.Request(1000);                    int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                    Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, model.Hash, 0, 1);                }            }
This doesn't work, when I tried to use the code money bags wouldn't appear.

 

Are you calling it each game tick?

 

Hey man can I just contact you on steam for better help?

Share this post


Link to post
Share on other sites
CamxxCore

 

 

 

 

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

Here is how you can do it, avoiding unsafe code:

            Ped ped = Game.Player.Character;            if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))            {                OutputArgument arg = new OutputArgument();                Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                GTA.Math.Vector3 result = arg.GetResult<GTA.Math.Vector3>();                if (result != GTA.Math.Vector3.Zero)                {                    Model model = new Model(0x113FD533);                    if (!model.IsLoaded)                    model.Request(1000);                    int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                    Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, model.Hash, 0, 1);                }            }
This doesn't work, when I tried to use the code money bags wouldn't appear.

 

Are you calling it each game tick?

 

Hey man can I just contact you on steam for better help?

 

 

Sure. My screen name is the same, camxxcore

Share this post


Link to post
Share on other sites
darthbollo

 

 

 

 

 

I do know C# is just that some of the args don't work like they do in C#. like the ped_last_weapon_impact_coord.

Here is how you can do it, avoiding unsafe code:

            Ped ped = Game.Player.Character;            if (Function.Call<bool>(Hash.IS_PED_SHOOTING, ped.Handle))            {                OutputArgument arg = new OutputArgument();                Function.Call(Hash.GET_PED_LAST_WEAPON_IMPACT_COORD, ped.Handle, arg);                GTA.Math.Vector3 result = arg.GetResult<GTA.Math.Vector3>();                if (result != GTA.Math.Vector3.Zero)                {                    Model model = new Model(0x113FD533);                    if (!model.IsLoaded)                    model.Request(1000);                    int hash = Function.Call<int>(Hash.GET_HASH_KEY, "PICKUP_MONEY_CASE");                    Function.Call(Hash.CREATE_AMBIENT_PICKUP, hash, result.X, result.Y, result.Z, 0, 2000, model.Hash, 0, 1);                }            }
This doesn't work, when I tried to use the code money bags wouldn't appear.

 

Are you calling it each game tick?

 

Hey man can I just contact you on steam for better help?

 

 

Sure. My screen name is the same, camxxcore

 

On steam?

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  

  • 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.