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

mod menu functions not working properly


h3adshotzz
 Share

Recommended Posts

ive been making my own mod menu/trainer for pc single player with native ui ive managed to get a notification to display above the mini map but the actual thing the button is meant to do does not work eg:

private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) //buttons go here    {         if (sender == Sub1)         {             switch (index)             {                 case 0:                    Ped player = Game.Player.Character;                    UI.Notify("TEST FUNCTION");                     GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player, true);                     break;                 case 1:                    Ped player2 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player2, true);                     break;                 case 2:                    Ped player3 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player3, 5, true);                     break;                 case 3:                    Ped player4 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player4, 0, true);                     break;             }         }

ive tried a few things like putting Ped player = Game.Player.Character outside of the the switch case and tried just using Ped player = Game.Player; but that didnt work either. btw Im new to C but ive done a lot of java

Link to comment
Share on other sites

 


you can use the hash and use player.handle
Function.Call((Hash)0x3882114BDE571AD4, player.Handle, true);

 

Edited by aimless
Link to comment
Share on other sites

you can use the hash and use player.handle          Function.Call((Hash)0x3882114BDE571AD4, player.Handle, true);

still no luck

Link to comment
Share on other sites

ive been making my own mod menu/trainer for pc single player with native ui ive managed to get a notification to display above the mini map but the actual thing the button is meant to do does not work eg:

private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) //buttons go here    {         if (sender == Sub1)         {             switch (index)             {                 case 0:                    Ped player = Game.Player.Character;                    UI.Notify("TEST FUNCTION");                     GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player, true);                     break;                 case 1:                    Ped player2 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player2, true);                     break;                 case 2:                    Ped player3 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player3, 5, true);                     break;                 case 3:                    Ped player4 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player4, 0, true);                     break;             }         }

ive tried a few things like putting Ped player = Game.Player.Character outside of the the switch case and tried just using Ped player = Game.Player; but that didnt work either. btw Im new to C but ive done a lot of java

The code should be something like this:

private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) //buttons go here    {         if (sender == Sub1)         {             switch (index)             {                 case 0:                    Player player = Game.Player;                    UI.Notify("TEST FUNCTION");                     GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player, true);                     break;                 case 1:                    Player player2 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player2, true);                     break;                 case 2:                    Player player3 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player3, 5, false);                     break;                 case 3:                    Player player4 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player4, 0, false);                     break;             }         }

I changed Ped to Player and Game.Player.Character to just Game.Player. Also, instead of the last parameter of SET_PLAYER_WANTED_LEVEL being true, I changed it to false because in NativeDB, its said to be always false. Hope it works!

Edited by AHK1221
Link to comment
Share on other sites

LOL, you can't be serious.

 

Everyone starts somewhere. Don't they? Comments like yours don't help anyone who is asking for help.

Link to comment
Share on other sites

LOL, you can't be serious.

I bet you were there too when you were starting. Who knows, he may make the next blockbuster mod maybe 6 months or 2 years later. Don't underestimate others.
  • Like 2
Link to comment
Share on other sites

 

LOL, you can't be serious.

I bet you were there too when you were starting. Who knows, he may make the next blockbuster mod maybe 6 months or 2 years later. Don't underestimate others.

 

:)

Link to comment
Share on other sites

 

ive been making my own mod menu/trainer for pc single player with native ui ive managed to get a notification to display above the mini map but the actual thing the button is meant to do does not work eg:

private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) //buttons go here    {         if (sender == Sub1)         {             switch (index)             {                 case 0:                    Ped player = Game.Player.Character;                    UI.Notify("TEST FUNCTION");                     GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player, true);                     break;                 case 1:                    Ped player2 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player2, true);                     break;                 case 2:                    Ped player3 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player3, 5, true);                     break;                 case 3:                    Ped player4 = Game.Player.Character;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player4, 0, true);                     break;             }         }

ive tried a few things like putting Ped player = Game.Player.Character outside of the the switch case and tried just using Ped player = Game.Player; but that didnt work either. btw Im new to C but ive done a lot of java

The code should be something like this:

private void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) //buttons go here    {         if (sender == Sub1)         {             switch (index)             {                 case 0:                    Player player = Game.Player;                    UI.Notify("TEST FUNCTION");                     GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player, true);                     break;                 case 1:                    Player player2 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_INVINCIBLE, player2, true);                     break;                 case 2:                    Player player3 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player3, 5, false);                     break;                 case 3:                    Player player4 = Game.Player;                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PLAYER_WANTED_LEVEL, player4, 0, false);                     break;             }         }

I changed Ped to Player and Game.Player.Character to just Game.Player. Also, instead of the last parameter of SET_PLAYER_WANTED_LEVEL being true, I changed it to false because in NativeDB, its said to be always false. Hope it works!

 

nope still didnt work :/ im going to leave that part out for now. is there anyway for the trainer to check what game version and if it is different to a set one it displays a popup?

Link to comment
Share on other sites

Use player.WantedLevel instead of all those functions

Edited by ZyDevs
Link to comment
Share on other sites

Dude, why don't you just use Game.Player.WantedLevel??? I laughed because you added Player1, Player2, Player3, Player4 when you could've just used Game.Player or Game.Player.Character as an input argument, sorry about that!

Link to comment
Share on other sites

Use player.WantedLevel instead of all those functions

He's right, use that.

 

Dude, why don't you just use Game.Player.WantedLevel??? I laughed because you added Player1, Player2, Player3, Player4 when you could've just used Game.Player or Game.Player.Character as an input argument, sorry about that!

First of all, we know hes a beginner so he may not know about the input and output argument classes. So instead of LOL-ing, try to help others.
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.