Quote:
Originally Posted by Rapidwolve
I recently have been practicing better organization and clean coding in my scripts, heres a snippet.
PHP Code:
public function Hurt(damage, attacker, hurtani){
temp.conditionsok = ((this.clientr.hp > 0 && 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.hurtani) this.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.