View Single Post
  #3  
Old 04-21-2009, 08:28 PM
Kamakaze Kamakaze is offline
UN Levels Team Admin
Kamakaze's Avatar
Join Date: Sep 2008
Location: Virginia
Posts: 37
Kamakaze is on a distinguished road
thanx dude that looks like everything, and that really helped me out a lot.
and it looks like everything is there [:.
and yea styling would prolly make it easier too. but yea thanks for all the help


Quote:
Originally Posted by fragman85 View Post
PHP Code:
//#CLIENTSIDE
    
function onCreated() {
               
this.sparAreaX 0;
      
this.sparAreaY 0;

      
this.sparAreaWidth 10;
      
this.sparAreaHeight 10
               setTimer
(0.05);
    } 
Instead of constantly setting the Coordinates in a .05 TimeOut, you do better using this.vars and setting them once in the onCreated() Event.
PHP Code:
function onPlayerChats() {
      if (
player.chat == "start") {
        if (
this.sparring.size() == && player.account in this.sparring) {
                   
putbomb(03135);
                 }
      }
  elseif (
player.chat == "join" && !(player.account in this.sparring)) {
        if (
this.sparring.size() < 3) {
player.30;
    
player.30;
    }
      }
    } 
You forgot two checks here. When the player says start, you have to check if the Player is one of the two sparrers, otherwise everybody in the Level can start the Spar, which is pretty dumb. Also when someone attemps to join, he can't be one of the two sparrers :o.
You also forgot a .size() here.
PHP Code:
function onTimeout() {
  if (
player.x in |this.sparAreaXthis.sparAreaX this.sparAreaWidth|
          && 
player.y in |this.sparAreaYthis.sparAreaY this.sparAreaHeight|) {
  
enableweapons();
           if (!(
player.account in this.sparring)) {
             if (
this.sparring.size() < 3) {
            
this.sparring.add(player.account);
             }

     else {
       
player.30;
       
player.30;
     }
       }
      }

      else {
                 
disableweapons();
    if (
player.account in this.sparringthis.sparring.remove(player.account);
      }
  
setTimer(0.05);
    } 
Here, I just added enableweapons() if the player is in the Spar Area and disableweapons() if not, so outside can't be pked. Oh and of course the temp.vars were replaced with the this.vars.

Sorry if I forgot something, but try to style your scripts more in the future :o
Reply With Quote