Difference between revisions of "ScriptHook: Key Binds"
From Nomad DB
Line 2: | Line 2: | ||
== Registering a Key Bind == | == Registering a Key Bind == | ||
− | To register a Key bind, use [[WD2 ScriptHook: manifest.json]]. | + | To register a Key bind, use the [[WD2 ScriptHook: Script|Script]]'s [[WD2 ScriptHook: manifest.json|manifest.json]]. |
'''manifest.json''' | '''manifest.json''' | ||
Line 10: | Line 10: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | '''[[Key Codes|List of Key Codes]]''' | ||
== Key Handler == | == Key Handler == | ||
Line 26: | Line 28: | ||
* [[WD2 ScriptHook]] | * [[WD2 ScriptHook]] | ||
* [[WD2 ScriptHook: manifest.json]] | * [[WD2 ScriptHook: manifest.json]] | ||
+ | * [[Key Codes]] | ||
[[Category:WD2 ScriptHook]] | [[Category:WD2 ScriptHook]] |
Revision as of 13:32, 15 April 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")
})