Thread: onKeyDown
View Single Post
  #3  
Old 07-23-2011, 08:07 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
You can make your own version of this like:
PHP Code:
function GraalControl.onKeyDown(keycodekeychar) {
  if (!((@{
keycodekeychar}) in keysPressed)) {
    
keysPressed.add({keycodekeychar});
  }
  
player.chat keysPressed;
}

function 
GraalControl.onKeyUp(keycodekeychar) {
  
keysPressed.remove(@{keycodekeychar});
  
player.chat keysPressed;

As long as you would have that somewhere attached to the player on the clientside, you could access keysPressed from anywhere.

Additionally, if you just want to check if C and V are being pressed you can do:
PHP Code:
function GraalControl.onKeyDown(keycodekeychar) {
  if (
keydown2(VK_Cfalse) && keydown2(VK_Vfalse)) {
    
player.chat "I'm pressing C and V.";
  }

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote