View Single Post
  #3  
Old 06-12-2007, 07:10 PM
Grey Grey is offline
Classic Developer
Grey's Avatar
Join Date: Mar 2007
Location: Wales, UK
Posts: 134
Grey will become famous soon enough
Send a message via AIM to Grey
Not a bad start. There is a bracket missing at the very end of the code, but I suspect maybe you accidently cut that off when you pasted the code?

In terms of improving scripting style/optimizing the script I'd suggest looking into switch statements maybe to avoid using so many if statements for checking the chat.

ie.

PHP Code:
if (player.chat == cmd) {
  switch (
cmd) {
    case 
"start": {
    
//stuff that happens when the player says start here.
    
break;
    }
    case 
"/in": {
    
//stuff for 'in' here
    
break;
    }
  }

And also when you check the player's x and y for starting the spar the way you have done it is okay, but it would be better to have done:

PHP Code:
if (player.x in |12,52| && player.y in |13,41|) { 
//stuff here

Reply With Quote