Reading player input: controls and keys
Almost every interaction in FiveM starts with a key. Open a door, talk to an NPC, loot a body, sprint, holster a weapon. FiveM does not hand you raw keyboard codes for these. It hands you control IDs, stable numbers that survive the player remapping their keys. This lesson teaches you to read those controls in a client thread, then proves it with a resource that detects the E key near a coordinate and takes over a second key while a menu is open.
Control IDs, not keycodes
When you press E, your operating system sees a raw keyboard scancode. FiveM does not. FiveM works one layer above that, in terms of controls: named game actions like "context interact", "jump", or "vehicle handbrake". Each control has a stable number, the control ID. You ask the game "is control 38 pressed right now" and the game answers, no matter which physical key the player has bound to that action.