View Single Post
  #49  
Old 03-31-2007, 02:24 PM
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
Quote:
Originally Posted by Rapidwolve View Post
I recently have been practicing better organization and clean coding in my scripts, heres a snippet.

PHP Code:
public function Hurt(damageattackerhurtani){
  
temp.conditionsok = ((this.clientr.hp && this.clientr.dead == false && level.nopk == false && this.client.nopk == false) ? true false);
   if (
temp.conditionsok){
       if (
temp.damage => this.clientr.hp) {
        
this.clientr.hp 0;
        
this.Kill(temp.attacker); 
        
this.showHp(7);
        return;
       }
       if (
temp.hurtanithis.setani("hurt"null);
          
clientr.lastattacker temp.attacker;
          
this.clientr.hp -= abs(temp.damage);
          
this.showHp(7);
    }
    return;

Looks nice, but personally I prefer
PHP Code:
if (temp.hurtani == true
instead of
PHP Code:
if (temp.hurtani
and I'd recommend braces for everything anyway.

Hachi ... I'd be scared to see your scripting.
__________________
Reply With Quote