Key getter from control id

Hi,

I’m currently trying to display keys in the NUI layer of the game, it seems like the GTA system is very well done, except we can’t get the key name from the control id or the control name.

Exemple : I want to display the E key in an interface present to the player to make a tutorial on how to use the server, the control id is 38, the control name is INPUT_PICKUP

I can either :

  • Tell the player the key is E, but he could have changed the bind and the presented key is false

  • Use a notification prompt, or instructionnal buttons that are from the game, these GTA5 interfaces can translate ~INPUT_PICKUP~ into
    FiveM_b2612_GTAProcess_irqZt255qn

My examples use cases :

  • Redesigning the instructionnal buttons from GTA into NUI layer, so we can change key design, displayed positions, add images around the keys
  • Redesigning the help notification buttons (same notes)
  • Make tutorials on how to use the scripts/server
  • Do statistical analysis on players : If all players change X bind to Y, I would rather have it Y by default in my script

Cons :

  • Could be used by weird anticheats or bad actors to detect bad behavior ?
  • Could be used by weird server admins to know if the player is using QWERTY or AZERTY keyboard layout
  • Could be used by bad developers to not use the RegisterKeybind system developed by FiveM, or make system around it

What i’m imagining :
GetKeyFromControl(0, 38) → returns t_E

I’m probably missing some parts that could make this either impossible, or very bad, but I have to try suggesting it
This is clearly low priority.

Thanks for all your work

There’s a native function that seems to do exactly what you want.

image

Seems like I didn’t do my research correctly on control natives, I will check this out :white_check_mark: thanks disquse

Not sure but this suggestion could still apply on script created keybinds

Example : RegisterKeyMapping → getter to know the current binded key, as it doesn’t have a control id (from my understanding)

Nope, they do.

Will try that (or reading again the part of the code around this system with my basic understanding)

Sorry for misusing this category and thank you both for your quick help :+1: