RegisterKeyMapping should not be persistent

RegisterKeyMapping is a very interesting command to associate a keybinding to a command and allow a player to re-map it. I consider it as a much better alternative rather than the common Thread loop detecting a key-press.

However, I noticed that a resource can only set it but not edit/remove it. I would like to suggest a way to UnregisterKeyMapping and allow a server to reset key-mappings from other servers or resource updates.

Consider the following:

  • Server A sets a key mapping for A to be command /mechanic
  • Server B sets the same key, but this time it should be /mechanicjob
  • The key binding won’t get overridden

Ideally, I would like to:

UnregisterKeyMapping('keyboard', 'A')
RegisterKeyMapping('mechanic', 'Mechanic', 'keyboard', 'A')
1 Like

Huh? It is only “persistent” across resources. Why do you have a resource with the same name as another (let alone, on a server you don’t even control?) that is entirely different?

Also, if one could “unregister” a binding, where do user preferences go, if set as such? In the garbage?

Identifying binds by a server doesn’t work as servers change IPs or license keys, identifying binds by a resource name is the better solution there but if you apparently have the same resource name as 100 other servers but use different commands that won’t work either, however that is solvable by not using the same resource name for what is effectively a different resource.

If a player changed a key, and then server B resets his bind, will he need to re change the bind to a different key when he comes back to server A?

Maybe this could be a better solution:
If a server register you a key map, and then you restart your game, it will only be available when the same resource name tries to bind the same command again, and then it won’t send you commands from other servers, since they have a different command, and if they don’t have a different command, it will stay the custom key for both servers.

Just rename the resource and added a custom prefix, like change esx_ to something based on your server name. Why should players rebind 10 times their keys if 10 servers use the same resource?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.