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

    1. Red Dead Redemption 2

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

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    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
    1. News

    2. Forum Support

    3. Site Suggestions

julionib

[Q] Detect controller usage

Recommended Posts

julionib

Its possible detect if user is using controller instead of mouse + keyboard? In IV we could use IS_USING_CONTROLLER but in V i didnt found anything similar

Share this post


Link to post
Share on other sites
Jitnaught

I don't see a native, so you'd probably have to do it manually by getting whether any of the controls on the gamepad are pressed, and if any of them are then set to use controller, if not then don't change what to use. Do the same thing with keyboard and mouse as well to get whether to use keyboard/mouse.

I'm sure you already thought of this, but whatever, I'll just throw it out there. ;)

Share this post


Link to post
Share on other sites
julionib

cool, didnt know about this list yet

Share this post


Link to post
Share on other sites
Neutrinobeam

Ohh, someone pulled an old version of the Control enum out of modMenu.h (a file I pack with Mod Menu) and reposted it online. (Or just ripped off this post.)

How nice, I mean I took like three days compiling it and I want people to use it- so- here's the updated.

 

 

 

// The keyboard, mouse, and/or controller will trigger multiple Controls for each physical input.
// A given Control may be associated with multiple physical inputs, for instance "Forward (32)"
// is triggered by both left stick up and the W key.
enum Control {
None = -1,
/*Inputs*/ // Triggered by (Defaults)
MenuDown = 187, // ArrowDown + Controller Pad Down
MenuUp = 188, // ArrowUp + Controller Pad Up
MenuLeft = 189, // ArrowLeft + Controller Pad Left
MenuRight = 190, // ArrowRight + Controller Pad Right
//MenuRDown = 191, // Enter + Controller A
//MenuRUp = 192, // Tab + Controller Y
//MenuRLeft = 193, // Space + Controller X
//MenuRRight = 194, // Backspace + Controller B
//MenuAxisX = 195, // A? + D + Controller RB? + Controller LB + Controller Left Left? + Controller Left Right
//MenuAxisY = 196, // W? + S + Controller Left Up? + Controller Left Down
//MenuRAxisX = 197, // [? + ] + Controller Right Left? + Controller Right Right
//MenuRAxisY = 198, // MouseWheel Up? + MouseWheel Down + Controller Right Up? + Controller Right Down
//Escape = 200, // Escape
//MenuAccept = 201, // Enter + NumPadEnter + Controller A
//MenuCancel = 202, // Escape + Backspace + Controller B
//MenuXPos = 203, // Space + Mouse? + Controller X
//MenuYPos = 204, // Tab + Mouse? + Controller Y
//MenuLB = 205, // Q + Controller LB
//MenuRB = 206, // E + Controller RB
//MenuLT = 207, // PageDown + Controller LT
//MenuRT = 208, // PageUp + Controller RT
//MenuLIn = 209, // LeftShift + Controller L3
//MenuRIn = 210, // LeftCtrl + Controller R3
//MenuLeaderboard = 211, // Tab + Controller RB
//MenuSocialClub = 212, // Home + Controller Back
//MenuSocialClubSecond = 213, // Controller RB
//MenuDelete = 214, // Delete + Controller X
//MenuEndAccept = 215, // Enter + Controller A
//MenuEndExpand = 216, // Space + Controller X
//MenuSelect = 217 // CapsLock + Controller Back
/* Script Inputs */
//ControllerLAxisX = 218, // A? + D + Controller Left Left? + Controller Left Right
//ControllerLAxisY = 219, // W? + S + Controller Left Up? + Controller Left Down
//ControllerRAxisX = 220, // Controller Right Left? + Controller Right Right
//ControllerRAxisY = 221, // Controller Right Up? + Controller Right Down
//ControllerRUp = 222, // MouseRight + Controller Y
//ControllerRDown = 223, // MouseLeft + Controller A
//ControllerRLeft = 224, // LeftCtrl + Controller X
//ControllerRRight = 225, // MouseRight + Controller B
//ControllerLeftBumper = 226, // Controller LB
//ControllerRightBumper = 227, // Controller RB
//ControllerLeftTrigger = 228, // Controller LT
//ControllerRightTrigger = 229, // MouseLeft + Controller RT
//ControllerLeftIn = 230, // Controller L3
//ControllerRightIn = 231, // Controller R3
//ControllerPadUp = 232, // W + Controller Pad Up
//ControllerPadDown = 233, // S + Controller Pad Down
//ControllerPadLeft = 234, // A + Controller Pad Left
//ControllerPadRight = 235, // D + Controller Pad Right
//ControllerSelect = 236, // V + Controller Back
/* Special Inputs */
//LookZoom = 0 // V + Controller Back
//LookLeftRight = 1, // Mouse? + Controller Right Stick
//LookUpDown = 2, // Mouse? + Controller Right Stick
//LookUp = 3, //272 // Mouse? + Controller Right Up
//LookDown = 4, //273 // Mouse? + Controller Right Down
//LookLeft = 5, //270 // Mouse? + Controller Right Left
//LookRight = 6, //271 // Mouse? + Controller Right Right
//ScaledLookLeftRight = 290,
//ScaledLookUpDown = 291,
//ScaledLookUp = 293,
//ScaledLookDown = 294,
//ScaledLookLeft = 295,
//ScaledLookRight = 296,
SkipCutscene = 18, //Space + Enter + Controller A + Left Mouse
//CharSwap = 19, // Left Alt + Controller Pad Down
//RadarZoom = 48, // Z + Controller Pad Down
//Pickup = 38, // E + Controller LB
//TalkTo = 46, // E + Controller Pad Right
//ContextAction = 51, // E + Controller Pad Right
//SwapMichael = 166, // F5
//SwapFranklin = 167, // F6
//SwapTrevor = 168, // F7
//CancelActionPlay = 170, // F3 + Controller B
//ToggleSpecial = 171, // CapsLock
//Pause = 199, // P + Controller Start
//QuickMenu = 244, // M + Controller Back
//ToggleRecording = 288, // F1 + Controller A
//ToggleActionPlay = 289, // F2 + Controller X
/*On Foot Motion*/
//Sprint = 21, // LeftShift + Controller A
//Jump = 22, // Space + Controller X
//EnterVehicle = 23, // F + Controller Y
//Fire = 24, //257 // MouseLeft + Controller RT
//Aim = 25, // MouseRight + Controller LT
//LookBack = 26, // C + Controller R3
//Special = 28, // Controller L3
//SpecialSecond = 29, // B + Controller R3
//MoveUpDown = 31, // W? + S + Controller Left Stick
MoveUp = 32, //268 // W + Controller Left Up
MoveDown = 33, //269 // S + Controller Left Down
//MoveLeftright = 30, // A? + D + Controller Left Stick
MoveLeft = 34, //266 // A + Controller Left Left
MoveRight = 35, //267 // D + Controller Left Right
//Stealth = 36, // LeftCtrl + Controller L3
//Cover = 44, // Q + Controller RB
//Detonate = 47, // G + controller Pad Left
//Dive = 55, // Space + Controller RB
//QuickGrenade = 58, // G + Controller Pad Left
//MeleeLight = 140, //263 // R + Controller B
//MeleeHeavy = 141, //264 // Q + Controller A
//MeleeAlt = 142, // MouseLeft + Controller RT
//MeleeDodge = 143, // Space + Controller X
/*On Foot Weapon*/
//WeaponInSlotNext = 14, //262 // MouseWheelDown + Controller RT + Controller Pad Right
//WeaponInSlotPrevious = 15, //261 // MouseWheelUp + Controller LT + Controller Pad Left
//WeaponNext = 16, // MouseWheelDown
//WeaponPrevious = 17, // MouseWheelUp
//WeaponWheel = 37, // Tab + Controller LB
//Zoom = 39, // [ + MouseWheelDown + Controller R3 + Controller Left Down
//ZoomIn = 40, //42, 274, 276 // ] + MouseWheelUp + Controller Left Up
//ZoomOut = 41, //43, 275, 277 // [ + MouseWheelDown + Controller Left Down
//Reload = 45, // R + Controller B
//AccurateAim = 50, // [ + MouseWheelDown + Controller R3
//ToggleWeaponAccessory = 54, // E + Controller Pad Right
//WeaponSlotUnarmed = 157, // 1
//WeaponSlotMelee = 158, // 2
//WeaponSlotPistol = 159, // 6
//WeaponSlotShotgun = 160, // 3
//WeaponSlotSMG = 161, // 7
//WeaponSlotAssault = 162, // 8
//WeaponSlotSniper = 163, // 9
//WeaponSlotHeavy = 164, // 4
//WeaponSlotGrenade = 165, // 5
/*Cars, Bikes, & Boats*/
//CinematicSlow = 7, // L + Controller R3
//CinematicCamera = 80, // R + Controller B
//CinematicUpDown = 95, // Mouse? + Controller Right Stick?
//CinematicUp = 96, // NumPad+ + MouseWheelUp
//CinematicDown = 97, // NumPad- + MouseWheelDown
//CinematicLeftRight = 98, // Mouse? + Controller Right Stick?
//SteerLeftRight = 59, // A? + D + Controller Left Stick
//LeanFrontBack = 60, // LeftShift? + LeftCtrl + NumPad8? + NumPad5 + Controller Left Stick
//LeanForward = 61, //280 // LeftShift + NumPad8 + Controller Left Up
//LeanBackward = 62, //281 // LeftCtrl + NumPad5 + Controller Left Down
//SteerLeft = 63, //278 // A + Controller Left Left
//SteerRight = 64, //279 // D + Controller Right Left
//DrivebyAim = 68, // MouseRight + Controller LB
//DrivebyFire = 69, //70, // MouseLeft + Controller RB
//PassengerAim = 91, // MouseRight + Controller LT
//PassengerFire = 92, // MouseLeft + Controller RT
//Accelerate = 71, // W + Controller RT
//Brake = 72, // S + Controller LT
//Duck = 73, // X + Controller A
//Headlights = 74, // H + Controller Pad Right
//Roof = 101, // H + Controller Pad Right
//RadioShuffle = 104 // H + Controller Pad Right
//ExitVehicle = 75, // F + Controller Y
//Handbrake = 76, // Space + Controller RB
//BikeJump = 102, // Space + Controller RB
//LookBackVehicle = 79, // C + Controller R3
//RadioWheelUpDown = 332, // Controller Right Up? + Controller Right Down
//RadioWheelLeftright = 333, // Controller Right Left? + Controller Right Right
//RadioNext = 81, // . + MouseWheel Down
//RadioPrevious = 82, // ,
//RadioPCNext = 83, // =
//RadioPCPrevious = 84, // -
//RadioWheel = 85, // Q + Controller Pad Left
//Horn = 86, // E + Controller L3
//WeaponNextVehicle = 99, // Tab + MouseWheel Up + Controller X
//WeaponPreviousVehicle = 100, // [
//MouseDrive = 106, // MouseLeft
//BikePedal = 136, // W + Controller A
//BikeSprint = 137, // CapsLock + Controller A
//BikeFrontBrake = 138, // Q + Controller LT
//BikeBackBreak = 139, // S + Controller RT
//VehAimLeft = 282, // Mouse? + Controller Right Left? + Controller Right Right?
//VehAimRight = 283, // Mouse? + Controller Right Left? + Controller Right Right?
//VehAimUp = 284, // Mouse? + Controller Right Up? + Controller Right Right?
//VehAimDown = 285, // Mouse? + Controller Right Down? + Controller Right Right?
//VehLookLeft = 286, // Mouse? + Controller Right Left? + Controller Right Right?
//VehLookRight = 287, // Mouse? + Controller Right Left? + Controller Right Right?
//JumpSpeedUpDown = 334, // PageUp? + PageDown + MouseWheel Up? + MouseWheel Down + Controller Right Up? + Controller Right Down
//JumpSpeedUp = 335, // PageUp + MouseWheel Up
//JumpSpeedDown = 336, // PageDown + MouseWheel Down
/*Planes & Helicopters*/
//AirThrottleUp = 87, // W + Controller RT
//AirThrottleDown = 88, // S + Controller LT
//AirLeft = 89, // A + Controller LB
//AirRight = 90, // D + Controller RB
//AirHook = 103, // E + Controller Pad Right
//AirDropPayload = 105 // X + Controller A
//AirRollLR = 107, // NumPad4? + NumPad6 + Controller Left Left? + Controller Left Right
//AirRollLeft = 108, // NumPad4 + Controller Left Left
//AirRollRight = 109, // NumPad6 + Controller Left Right
//AirPitchFrontBack = 110, // NumPad8? + NumPad5 + Controller Left Up? + Controller Left Down
//AirPitchForward = 111, // NumPad8 + Controller Left Up
//AirPitchBackward = 112, // NumPad5 + Controller Left Down
//AirLandingGear = 113, // G + Controller L3
//AirFire = 114, // Space + MouseRight + Controller A
//AirFireAlt = 331, // Space + MouseRight
//AirNextWeapon = 115, // Tab + MouseWheel Up + Controller Pad Left
//AirPreviousweapon = 116, // [
//AirAimLeft = 117, // NumPad7 + Controller LB
//AirAimRight = 118, // NumPad9 + Controller RB
//AirVTOL = 119, // E + Controller Pad Right
//AirDuck = 120, // X + Controller A
//AirWeaponCamera = 121, // Insert + Controller R3
//AirMouseDrive = 122, // MouseLeft
/*Submarine*/
//SubLeftRight = 123, // NumPad4? + NumPad6 + Controller Left Left? + Controller Left Right
//SubLeft = 124, // NumPad4 + Controller Left Left
//SubRight = 125, // NumPad6 + Controller Left Right
//SubPitchFrontBack = 126, // NumPad5 + NumPad8? + Controller Left Up? + Controller Left Down
//SubPitchForward = 127, // NumPad8 + Controller Left Up
//SubPitchBackward = 128, // NumPad5 + Controller Left Down
//SubThrottleUp = 129, // W + Controller RT
//SubThrottleDown = 130, // S + Controller LT
//SubUp = 131, // LeftShift + Controller X
//SubDown = 132, // LeftCtrl + Controller A
//SubHardLeft = 133, // A? + Controller LB
//SubHardRight = 134, // S + Controller RB
//SubMouseDrive = 135, // MouseLeft
/*Parachute*/
//ChuteDeploy = 144, // F + MouseLeft + Controller A
//ChuteDetach = 145, // F + Controller Y
//ChuteLeftRight = 146, // A? + D + Controller Left Left? + Controller Left Right
//ChuteLeft = 147, // A? + Controller Left Left
//ChuteRight = 148, // D + Controller Left Right
//ChuteForwardBackward = 149, // W? + S + Controller Left Up? + Controller Left Down
//ChuteForward = 150, // W + Controller Left Up
//ChuteBackward = 151, // S + Controller Left Down
//ChuteHardLeft = 152, // Q + Controller LB
//ChuteHardRight = 153, // E + Controller RB
//ChuteSmoke = 154, // X + Controller A
//ChuteFineControl = 155, // LeftShift + Controller LB & RB?
/*Phone*/
//PhoneOn = 27, // ArrowUp + MouseMiddle + Controller Pad Up
//PhoneUp = 172, // ArrowUp + Controller Pad Up
//PhoneDown = 173, // ArrowDown + Controller Pad Down
//PhoneLeft = 174, // ArrowLeft + Controller Pad Left
//PhoneRight = 175, // ArrowRight + Controller Pad Right
//PhoneSelect = 176, // Enter + MouseLeft + Controller A
PhoneCancel = 177, // Escape + Backspace + MouseRight + Controller B
//PhoneOption = 178, // Delete + Controller Y
//PhoneAltOption = 179, // Space + MouseMiddle + Controller X
//PhoneScrollRight = 180, // MouseWheel Down
//PhoneScrollLeft = 181, // MouseWheel Up
//PhoneCamLockFocus = 182, // L + Controller RT
//PhoneCamGrid = 183, // G + Controller RB
//PhoneCamMode = 184, // E + MouseMiddle + Controller R3
//PhoneCamDOF = 185, // F
//PhoneCamFace = 186, // X + Controller L3
/* Other */
//MouseL = 237, // MouseLeft
//MouseR = 238, // MouseRight
//MousePosX = 239, // Mouse?
//MousePosY = 240, // Mouse?
//MouseWUp = 241, // MouseWheel Up
//MouseWDown = 242, // MouseWheel Down
//CheatCode = 243, // Tilde
//RappelJump = 258, // Controller A
//RappelLongJump = 259, // Controller X
//RappelSmashWindow = 260, // Controller RT
//Whistle = 256, // Delete + Controller X
//DriveLook = 329 // MouseLeft
//DriveLookSecond = 330 // MouseRight
//MapPOI = 337,
//Arrest = 49, // F + Controller Y
//WeaponSpecial = 53, // Controller Y
//DropWeapon = 56, // F9 + Controller Y
//DropAmmo = 57, // F10 + Controller B
//VehHotwireLeft = 77 // W + Controller LT
//VehHotwireRight = 78 // S + Controller RT
//RightTrigger = 260, // Controller RT
//MouseLAndRightTrigger = 92, // MouseLeft + Controller Rt
//CreatorAccept = 255, // Enter + Space + Controller A
/* Custom Inputs */
//Tilde = CheatCode,
Select = SkipCutscene,
Cancel = PhoneCancel,
};

 

 

Edited by Neutrinobeam

Share this post


Link to post
Share on other sites
c39687

this is what i was finding when i was trying to detect input type. If you look at the values, Most of them trigger by either the game pad or keyboard so not sure you will be able to detect which input the user is using. Im pretty sure I dont see values here dedicated for gamepad input. I assume one of those natives that dont have a name yet is the native used to detect game pad vs kb/m input. I only use gamepad so id like to know too.

Edited by c39687

Share this post


Link to post
Share on other sites
julionib

yeah, seems that cant detect using this method, but i dont think there is a method for this because in the original script they just check for the controll press, they dont perform a check before to change values or perform a different path for each control press check, unless i miss it ^^

Share this post


Link to post
Share on other sites
leftas

You can always use GetASyncKeyState, it have never disappointed me. You just need to know how to use it.

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
soyuka

Take a look at examples from https://www.gta5-mods.com/scripts/mod-menu-no-more-hotkeys !

There is a Control enum and some Input functions. With this I was able to add a check to launch menu in car :

/** * Method that checks if player is in a CAR and press hotkeys to load Menu * This is not handled by ModMenu  */bool Menu::shouldLaunchMenuInCar(){	Ped playerPed = PLAYER::PLAYER_PED_ID();	if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0) 		&& CONTROLS::IS_CONTROL_PRESSED(2, Menu::Control::DrivebyAim) 		&& CONTROLS::IS_CONTROL_PRESSED(2, Menu::Control::LookBackVehicle))		return true;	return false;}

Works with Controller and Keyboard :).

Share this post


Link to post
Share on other sites
c39687

he is trying to detect if the player is using kb/m or gamepad. Those enums wont help. He is looking for the GTA V equivalent of the IV native IS_USING_CONTROLLER.

Share this post


Link to post
Share on other sites
julionib

he is trying to detect if the player is using kb/m or gamepad. Those enums wont help. He is looking for the GTA V equivalent of the IV native IS_USING_CONTROLLER.

exactly, i know how to detect keypress or a control press, the problem is identify when user is using one or another input method, best gen input or console input ^^

Share this post


Link to post
Share on other sites
80T

+1 want to know how to detect gamepad/k,m

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.
Note: Your post will require moderator approval before it will be visible.

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.


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