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. Forum Support

    3. Suggestions

Disable phone control please help


Maffine
 Share

Recommended Posts

Hello everyone,

I'm working on a project in which I want to disable phone controls (scroll down, scroll up, select etc) However when I use

Game.DisableControlThisFrame(2, GTA.Control.PhoneSelect);

the inputs seem to stick to active when I put out my phone. The only input that can be disabled is the arrowup (phone/phoneup)

Has anyone been messing around with phone controls? Anything would be greatly helpful.

Link to comment
Share on other sites

I think the one that actually brings the phone up, is Control.Phone, PhoneSelect might be the button that activates the current phone selection.

 

Here's some useful code I found a while back, when you press a control, it displays a UI.Notify for each Control that corresponds to what you have pressed.

using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using GTA;

namespace DisplayPressedControl
{
    public class cDisplayPressedControl : Script
    {
		
        public cDisplayPressedControl()
        {
            Tick += onTick;
            Interval = 0;
        }

        private void onTick(object sender, EventArgs e)
        {
			foreach (Control control in Enum.GetValues(typeof(Control)))
			{
				if (Game.IsControlJustPressed(2, control))
					UI.Notify(control.ToString());
			}
        }
    }
}

I meant to add, just drop that into a DisplayPressedControl.cs file and put it in the scripts folder.

Edited by Guest
Link to comment
Share on other sites

6 minutes ago, LeeC2202 said:

I think the one that actually brings the phone up, is Control.Phone, PhoneSelect might be the button that activates the current phone selection.

 

Here's some useful code I found a while back, when you press a control, it displays a UI.Notify for each Control that corresponds to what you have pressed.

using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using GTA;

namespace DisplayPressedControl
{
    public class cDisplayPressedControl : Script
    {
		
        public cDisplayPressedControl()
        {
            Tick += onTick;
            Interval = 0;
        }

        private void onTick(object sender, EventArgs e)
        {
			foreach (Control control in Enum.GetValues(typeof(Control)))
			{
				if (Game.IsControlJustPressed(2, control))
					UI.Notify(control.ToString());
			}
        }
    }
}

 

Thanks LeeC2202, but it is exactly the select button that I want to disable with no luck. It looks like the game script itself prevents it (I cant even figure out why would they bother XD)

Link to comment
Share on other sites

Well it's possible that PhoneSelect is also the same as FrontendAccept, which is Gamepad A or Return. That's why you have to find out all the controls that might perform that function and block them all (if required). This is why many people use Game.DisableAllControlsThisFrame(2) and then just enable the ones they want, or test with IsDisabledControlJustPressed etc...

Link to comment
Share on other sites

3 hours ago, LeeC2202 said:

Well it's possible that PhoneSelect is also the same as FrontendAccept, which is Gamepad A or Return. That's why you have to find out all the controls that might perform that function and block them all (if required). This is why many people use Game.DisableAllControlsThisFrame(2) and then just enable the ones they want, or test with IsDisabledControlJustPressed etc...

Yes I thought about that too. To test that I try to switch on DisableAllControlsThisFrame when the character is holding a phone. It turns out that even in that situation the phone controls are activated. How strange.

Link to comment
Share on other sites

Hmmm, that is strange then... if I get chance later I will try and remember to have a look at that. I tend to use addon peds 99% of the time, so I never use the phone. I will post back anything I find out later, possibly tomorrow.

Link to comment
Share on other sites

56 minutes ago, LeeC2202 said:

Hmmm, that is strange then... if I get chance later I will try and remember to have a look at that. I tend to use addon peds 99% of the time, so I never use the phone. I will post back anything I find out later, possibly tomorrow.

Wow, that's so nice of you. Thx a lot.

Link to comment
Share on other sites

It's very strange what happens with the phone. I created a small mod that disabled all controls after you activated the phone. All the direction controls were still active apart from Up, which is also the same control that opens the phone. If I went into the emails with the Gamepad A button, I could only move down and couldn't exit the email app. If I went into emails with the keyboard, I couldn't move down, read emails or exit the app... I had to reset the scripts to get out.

 

So my guess is that some of the controls, with some of the input devices are being checked with IsControlJustPressed and IsDisabledControlJustPressed, which is probably why you can't block everything. But it doesn't seem as though that's consistent, because not every screen reacts the same.

 

This is very possibly one of those cases where different modules in the phone screen, were handed out to different developers. As such, each one probably did things slightly differently, didn't check for inputs the same etc... that kind of thing. That can result in inconsistent behaviour across parts of the UI.

 

I worked as a support programmer on a boxing game on the Gameboy back in 2000 or thereabouts. I had certain screens and certian parts of the UI to handle and other programmers did other sections, so it's been a common practice for a long while to do share UI responsibility. It relies on the lead programmer or a producer to make sure that all screens are consistent in functionality but as I have mentioned in other threads, I suspect the R* producers are pretty clueless, because some screw-ups in this game are inexcusable.

 

So the end result is that it looks like the phone is going to cause you problems and the best solution I would suggest, is to prevent it being shown during critical times. You could either block it from being opened, or there is this native: _DISABLE_PHONE_THIS_FRAME. But I can't see a way to block all inputs from the test mod I just created.... sorry I haven't been able to offer much help.

Link to comment
Share on other sites

16 hours ago, LeeC2202 said:

It's very strange what happens with the phone. I created a small mod that disabled all controls after you activated the phone. All the direction controls were still active apart from Up, which is also the same control that opens the phone. If I went into the emails with the Gamepad A button, I could only move down and couldn't exit the email app. If I went into emails with the keyboard, I couldn't move down, read emails or exit the app... I had to reset the scripts to get out.

 

So my guess is that some of the controls, with some of the input devices are being checked with IsControlJustPressed and IsDisabledControlJustPressed, which is probably why you can't block everything. But it doesn't seem as though that's consistent, because not every screen reacts the same.

 

This is very possibly one of those cases where different modules in the phone screen, were handed out to different developers. As such, each one probably did things slightly differently, didn't check for inputs the same etc... that kind of thing. That can result in inconsistent behaviour across parts of the UI.

 

I worked as a support programmer on a boxing game on the Gameboy back in 2000 or thereabouts. I had certain screens and certian parts of the UI to handle and other programmers did other sections, so it's been a common practice for a long while to do share UI responsibility. It relies on the lead programmer or a producer to make sure that all screens are consistent in functionality but as I have mentioned in other threads, I suspect the R* producers are pretty clueless, because some screw-ups in this game are inexcusable.

 

So the end result is that it looks like the phone is going to cause you problems and the best solution I would suggest, is to prevent it being shown during critical times. You could either block it from being opened, or there is this native: _DISABLE_PHONE_THIS_FRAME. But I can't see a way to block all inputs from the test mod I just created.... sorry I haven't been able to offer much help.

Thanks LeeC, you are really a pro and thanks for all your help. That information really means a lot to me.

PS: I cant agree more with the developer confusion part. I did a little experiment last night. Turns out some command in the game script constantly turns the bools back into true once it is turned otherwise. Normally the addon commands will simply overwrite them but this time they don't. So it must be something else than a direct command. My best guess is that the developer on this part uses the GAMEPLAY::SET_BIT function —— I heard that it was used by R* to set bools, instead of simply disable the control like other developers did. I'll try whether i can set bits as the game does.

Edited by Maffine
Link to comment
Share on other sites

Yeah, they do use Bits for bools quite a lot and it's good practice if the bools are related. I mostly use bools and in truth, it's lazy... but it's quick and readable.

 

I have another mod that transmits a lot of info over to an extrernal Windows app, for tracking entity movement / direction / type etc... and that uses bits for bools. You can get 8 bools into a single byte, so when you are shifting round 200+ pieces of entity data, compressing them like that makes sense. I tend to use AND, OR and XOR working with bits though, purely because it's an old habit from assembly language days. I forget that there are natives to do that, although it seems a bit wasteful to call a function to do a simple bit test/set.

 

It's worth getting the decompiled scripts, look for related natives and see how they are handling data around those natives. If you see a lot of bit related calls, then you're probably on the right track.

 

Edit: P.s. sorry for all my rambling comments. :blush:

Edited by Guest
Link to comment
Share on other sites

9 hours ago, LeeC2202 said:

Yeah, they do use Bits for bools quite a lot and it's good practice if the bools are related. I mostly use bools and in truth, it's lazy... but it's quick and readable.

 

I have another mod that transmits a lot of info over to an extrernal Windows app, for tracking entity movement / direction / type etc... and that uses bits for bools. You can get 8 bools into a single byte, so when you are shifting round 200+ pieces of entity data, compressing them like that makes sense. I tend to use AND, OR and XOR working with bits though, purely because it's an old habit from assembly language days. I forget that there are natives to do that, although it seems a bit wasteful to call a function to do a simple bit test/set.

 

It's worth getting the decompiled scripts, look for related natives and see how they are handling data around those natives. If you see a lot of bit related calls, then you're probably on the right track.

 

Edit: P.s. sorry for all my rambling comments. :blush:

Oh that makes sense! Really it's so nice to get help from expert. Again thx a lot😊

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.