[Standalone] NeroHiro’s Key Listener for RedM

Redm Scripts Download

This resource will help you optimize your framework by using it as a wrapper to prevent having multiple loops throughout your resources, instead just relying on the events it sends to process the information.

Here is an example of how reduced the resource usage of scenes script, without having these loops running on multiple resources, it might have a decently high usage, but will save that usage from your other resources. (usage was about 0.08ms~)

RegisterNetEvent("nh-keylistener:keyPressed", function(eKeyPress) if eKeyPress == "DEL" then DeleteScene() elseif eKeyPress == "RIGHTBRACKET" then HideScenes() end end) RegisterNetEvent("nh-keylistener:keyReleased", function(eKeyPress) if eKeyPress ~= "HOME" then return end CreateScene() end)



It's pretty simple, once you drop the nh-keylistener resource into your resources folder just make sure you put

ensure nh-keylistener

in your server.cfg.

and placing the corresponding event in any resource you would like to use it on. 
very simple and efficient!

Post a Comment