Log in to reply
 

Using C# to pick up controller input?



  • How can I pick up controller input with C#? Specifically from the dpad.


  • MODERATOR

    @FelixTheBlackCat You can use PhoneUp, PhoneDown, PhoneLeft, PhoneRight.



  • @stillhere I'm confused, as in allow the user to change the controls in the menu like:

    Game.IsControlPressed(2, GTA.Control.VehicleHorn)

  • MODERATOR

    @FelixTheBlackCat In what menu? Like selecting a control through a menu directly instead of editing an ini file?



  • @stillhere I mean that you can change the vehicle horn control in the pause menu and use that as a key in a mod. I wanted a keycode e.g.

    Keys.DpadUp

  • MODERATOR

    @FelixTheBlackCat There are no KeyCodes for gamepad buttons. I don't quite understand what you need but whatever key you assign to use the vehicle horn, Game.IsControlPressed(2, GTA.Control.VehicleHorn) will return true when you press that key. So if in the keyboard settings, you map the vehicle horn to another key (e.g. K) instead of the default E key, then Game.IsControlPressed(2, GTA.Control.VehicleHorn) will only return true when holding K, and not when holding E.

    The controls in GTA.Control don't refer to physical controls but to actions, except for the controls that start with "Script", which refer to actual physical buttons on a gamepad controller. So, Game.IsControlPressed(2, GTA.Control.ScriptPadUp) will only return true when you are holding DpadUp on a controller specifically.



  • @stillhere Thanks! I'll try that.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.