Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Can't toggle radar visibility with C++ script


seaque
 Share

Recommended Posts

seaque
Posted (edited)

So i've been trying to write an asi script to toggle HUD and RADAR with a key because going to settings > display > hud > off is just not efficient way to do this. I can't write in C# because SHVDN prevents gta5.exe from closing completely and i don't want to go to task manager and kill it everytime i close the game.

 

So far i have been able to hide most of HUD elements, taken some code from CGE's Dynamic Radar and writing some of mine. However, UI::DISPLAY_RADAR() is not working when i put it inside the condition block which makes the toggle possible. Outside of the block it works fine with sending false parameter, but that just hides radar permanently.

 

#include "script.h"

bool display = true;

bool get_key_pressed(int nVirtKey)
{
	return (GetAsyncKeyState(nVirtKey) & 1) != 0;
}

void hide_hud()
{
	display = !display;
	UI::DISPLAY_HUD(display);
	UI::DISPLAY_RADAR(display); //This is not working, makes the radar flicker.
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(0); //Hud ?
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(1); //Stars
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(3); //Cash
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(4); //MP Cash
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(5); //MP Messages
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(6); //Vehicle Name
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(7); //Area Name
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(8); //Unused ?
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(9); //Street Name
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(13); //Cash Change
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(10); //Help Text
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(11); //Floating Help 1
	UI::HIDE_HUD_COMPONENT_THIS_FRAME(12); //Floating Help 2
	UI::HIDE_HELP_TEXT_THIS_FRAME();
}

int main() 
{
	while (true)
	{
    		// UI::DISPLAY_RADAR(false); // This is working, but radar is permanently hidden.
		if (get_key_pressed(VK_F10))
		{
			hide_hud();
		}

		WAIT(0);
	}

	return 0;
}
void ScriptMain() 
{
	srand(GetTickCount());
	throw main();
}

 

Edited by seaque
Link to comment
Share on other sites

LeeC22

I don't use C++ but if I need to hide the hud I use this

 

void HIDE_HUD_AND_RADAR_THIS_FRAME() { invoke<Void>(0x719FF505F097FD20); } // 0x719FF505F097FD20 0xB75D4AD2 b323

 

Out of curiosity, are you sure it is SHVDN that is causing the game hang? I run a few different versions of the game, all with SHVDN installed, some with v2 and one with v3. At one point there was a launcher update that caused the problem you described and I wrote a mod that has this code that activated with a cheat code.

 

Process p = Process.GetCurrentProcess();
p.Kill();

 

It was a bit of a brutal way to deal with it but it avoided the task manager method that was really annoying. But I haven't had that problem since so I presumed that they had fixed the problem.

Link to comment
Share on other sites

seaque
Posted (edited)
1 hour ago, LeeC22 said:

I don't use C++ but if I need to hide the hud I use this

 

void HIDE_HUD_AND_RADAR_THIS_FRAME() { invoke<Void>(0x719FF505F097FD20); } // 0x719FF505F097FD20 0xB75D4AD2 b323

 

Out of curiosity, are you sure it is SHVDN that is causing the game hang? I run a few different versions of the game, all with SHVDN installed, some with v2 and one with v3. At one point there was a launcher update that caused the problem you described and I wrote a mod that has this code that activated with a cheat code.

 

Process p = Process.GetCurrentProcess();
p.Kill();

 

It was a bit of a brutal way to deal with it but it avoided the task manager method that was really annoying. But I haven't had that problem since so I presumed that they had fixed the problem.

 

I am sure, after removing SHVDN the problem disappears. Also HIDE_HUD_AND_RADAR_THIS_FRAME() doesn't work, it creates a micro flicker like it's gonna disappear then nothing happens. But if i put it where i put DISPLAY_RADAR then it works but permanently hidden.

Edited by seaque
Link to comment
Share on other sites

LeeC22
1 minute ago, seaque said:

 

I am sure, after removing SHVDN the problem disappears. Also HIDE_HUD_AND_RADAR_THIS_FRAME() doesn't work, it creates a micro flicker like it's gonna disappear then nothing happens.

 

Are you calling it every frame? If not, it will only disappear for a single frame and then reappear.

 

I wonder if it's SHVDN causing the problem, or a mod that is using SHVDN? I just tested again in my Epic version with SHVDN 3.4 and it did a clean exit.

Link to comment
Share on other sites

seaque
Just now, LeeC22 said:

Are you calling it every frame? If not, it will only disappear for a single frame and then reappear.

 

I wonder if it's SHVDN causing the problem, or a mod that is using SHVDN? I just tested again in my Epic version with SHVDN 3.4 and it did a clean exit.

 

I simply removed everything inside hide_hud and added HIDE_HUD_AND_RADAR_THIS_FRAME(). Is it different than the HIDE_HUD functions i formerly used?

 

I tried launching with SHVDN without any mods. It still makes gta5.exe hang.

Link to comment
Share on other sites

LeeC22
Posted (edited)
5 minutes ago, seaque said:

 

I simply removed everything inside hide_hud and added HIDE_HUD_AND_RADAR_THIS_FRAME(). Is it different than the HIDE_HUD functions i formerly used?

 

I tried launching with SHVDN without any mods. It still makes gta5.exe hang.

 

I don't know to be honest, I have only ever used that one native but anything with _THIS_FRAME in the name typically has to be called in onTick (or the C++ equivalent of that).

 

Weird about SHVDN, have you tried a newer or older version to see if it's anything to do with a specific release of SHVDN?

Edited by LeeC22
Link to comment
Share on other sites

seaque
Posted (edited)
13 minutes ago, LeeC22 said:

I don't know to be honest, I have only ever used that one native but anything with _THIS_FRAME in the name typically has to be called onTick.

 

Weird about SHVDN, have you tried a newer or older version to see if it's anything to do with a specific release of SHVDN?

 

I've used multiple versions, but i am not entirely sure. Maybe it started after 3.4 or i started to notice.

 

3.1.0 has the same problem.

2.10.10 is clear, maybe it appeared after 3.0.

Yep... it's about SHVDN 3.0 and after.

Edited by seaque
Link to comment
Share on other sites

LeeC22
Posted (edited)
16 minutes ago, seaque said:

 

I've used multiple versions, but i am not entirely sure. Maybe it started after 3.4 or i started to notice.

 

3.1.0 has the same problem.

 

Very weird... I know it's really annoying when it happens which is why I wrote my KillGTAV mod but it's not an ideal solution.

 

Edit: Just noticed it's an issue on the SHVDN page, so hopefully they can find the solution to that problem. I probably don't get it on my normal game installs because I am still using 2.10.10

Edited by LeeC22
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.