PHP Code:
public function applyStatChange(stat, amt) {
temp.string = 0;
tem.plyr = 0;
plyr = findPlayer(this.account);
if (makevar("plyr.clientr.mud." @ stat) == NULL) return;
if (amt != NULL) {
if (amt == (abs(amt))) {
if (stat == "hp" || "mp") {
if ((makevar("plyr.clientr.mud." @ stat) + amt) <= makevar("plyr.clientr.mud.max" @ stat)) {
makevar("plyr.clientr.mud." @ stat) += abs(amt);
}
else {
makevar("plyr.clientr.mud." @ stat) = makevar("plyr.clientr.mud.max" @ stat);
}
}
}
else {
if ((makevar("plyr.clientr.mud." @ stat) - amt) > 0) {
echo("setting a negative");
makevar("plyr.clientr.mud." @ stat) -= abs(amt);
}
else if ((makevar("plyr.clientr.mud." @ stat) - amt) <= 0) {
echo("changing to zero");
makevar("plyr.clientr.mud." @ stat) = 1;
}
}
}
reflect("player", 3);
echo(this.mp);
}
The adding portion of it works perfectly fine, doesn't go over the max amount or anything like that. However as for the subtracting portion, it tends to go over to -599 before it sets it back to 1 the next time I update. What could be the issue?