John Smith Posted January 31, 2015 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?
ALw7sH Posted January 31, 2015 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 )
John Smith Posted January 31, 2015 Author 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
pa3ck Posted February 1, 2015 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 )
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