rusztamas Posted June 6, 2017 Share Posted June 6, 2017 Hi! I'd like to bind a key on serverside, for a command (/seatbelt), i wrote a pretty good and modern script for it, but its not working with bindKey, it has no errors, i have no clue why. Help please. Link to comment
rusztamas Posted June 6, 2017 Author Share Posted June 6, 2017 is it possible to bind a key to a command? Link to comment
AE. Posted June 6, 2017 Share Posted June 6, 2017 (edited) bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] ) server side Edited June 6, 2017 by 3laa33 1 Link to comment
Amine#TN Posted June 7, 2017 Share Posted June 7, 2017 function exemple () end bindKey ( player, "F1", "down", exemple ) that is more clear you can use that as an exemple you can change down to up down is when you press the botton and up when you leave the botton Link to comment
pa3ck Posted June 8, 2017 Share Posted June 8, 2017 (edited) 10 hours ago, NOONE said: function exemple () end bindKey ( player, "F1", "down", exemple ) That's not hooked to a command but to a function.. --client function smt() outputChatbox("smt") end addCommandHandler("smt_command", smt) bindKey("o", "up", "smt_command") On server: --server addEventHandler("onResourceStart", resourceRoot, function() -- in case you restart or start the resource while the server is running for k, v in ipairs(getElementsByType("player")) do bindKey(v, "o", "up", "smt_command") end end) addEventHandler("onPlayerJoin", root, function() -- when somebody new joins and missed the "onResourceStart" event, bind the command to the source only bindKey(source, "o", "up", "smt_command") end) function smt(p) outputChatbox("smt", p) end addCommandHandler("smt_command", smt) Edited June 8, 2017 by pa3ck Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now