Thread: keydown2
View Single Post
  #8  
Old 02-15-2008, 12:01 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
Because you can't use that to detect when a key is held down.
well, you kind of can:

PHP Code:
//#CLIENTSIDE
function onCreated()
  
setTimer(0.1);
function 
onTimeout() {
  
// or whatever to detect if it's not held down
  
if (!keydown(5)) this.canhit true;
  
setTimer(0.1);  
}
function 
onKeyPressed(codekey) {
  switch (
lowercase(key)) {
    case 
"s":
      if (
this.canhit) {
        
player.chat "s";
        
this.canhit false;
      }
    break;
  }

__________________
Reply With Quote