View Single Post
  #2  
Old 03-27-2011, 02:22 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Please indent your code if you're going to release it, and use PHP tags instead of QUOTE tags.

PHP Code:
//Scripted by McChucken
//#CLIENTSIDE
function onKeyPressed(num1codenum2)
{
  if (
code == "1") {
    
player.chat "update level";
  }
  
sleep 0.1;
  
player.chat "";

In addition, there are several errors with it. Since the sleep and the line that resets the player's chat aren't in the if block, they'll happen any time you press a key.

I've corrected the code and left comments:
PHP Code:
//Scripted by McChucken
//#CLIENTSIDE
function onKeyPressed(codekeyscancode) { // code is the first parameter, not the second
  
if (key == "1") {
    
player.chat "update level";
    
sleep(0.1); // use parentheses for parameters, you had GS1 before
    
player.chat "";
  }

Nice attempt, though. Trying is the best way to learn. Sorry if I come off as being an ass, I'm just trying to make sure you understand the mistakes so you'll become a better scripter.
__________________
Reply With Quote