Difference between revisions of "ScriptHook: Key Binds"
From Nomad DB
m (Administrator moved page WD2 ScriptHook: Key Binds to ScriptHook: Key Binds) |
|
(No difference)
|
Revision as of 12:28, 6 October 2020
A Script can register Key bindings.
Registering a Key Bind
To register a Key bind, use the Script's manifest.json.
manifest.json
"keyBinds": {
"test": "F5"
}
Key Handler
Use ScriptHook.RegisterKeyHandler function.
Example
Registers a callback function to a Key binding. In combination with the manifest.json above, this code would print "Key Bind" to the Console when pressing F5.
ScriptHook.RegisterKeyHandler("test", function()
print("Key Bind")
end)