John Smith Posted January 31, 2015 Share Posted January 31, 2015 hi is there a way to see if a client is holding specific key without releasing it? and calculate time before the client released the key? Link to comment
Dealman Posted January 31, 2015 Share Posted January 31, 2015 Most certainly! getKeyState Link to comment
ALw7sH Posted January 31, 2015 Share Posted January 31, 2015 bindKey("space","both", function(key,state) if state == "down" then local pressed = getTickCount() elseif state == "up" then outputChatBox("you pressed "..key.." for : "..pressed.." ms") end end ) Link to comment
John Smith Posted January 31, 2015 Author Share Posted January 31, 2015 ok thanks guys edit: but it returns the total time since the server was up... how can i get the time since the key was holded? edit 2: nvm solved it thanks Link to comment
pa3ck Posted February 1, 2015 Share Posted February 1, 2015 local startTick bindKey("space","both", function(key,state) if state == "down" then startTick = getTickCount() elseif state == "up" then local pressed = getTickCount() - startTick outputChatBox("you pressed "..key.." for : "..pressed.." ms") end end ) 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