The commands for each hat (in order from the picture):
/mxhelm
/tomhelm
/tomhelmglow
/guyhelm
/guyhelmglow
Uh, couldn't this be simplified, or at least less functions?
function serverCmdXinaHelms(%c, %h, %t) {
switch$(%h) {
case "mx":
%helmN = "MxHelmImage";
case "tom":
%helmN = "TomHelmImage";
case "guy":
%helmN = "GuyHelmImage";
default:
messageClient(%c, '', "<color:FFFF00>Available Helmets<color:FFFFFF>: MX, Tom, Guy. Add glow for glowing version.");
return;
}
if(%t $= "glow")
%helmN = strReplace(%helmN, "lmIm", "lmGlowIm");
if(isObject(%p = %c.player)) {
%p.unMountImage(2);
if(%p.getMountedImage(2) $= nametoID(%helmN)) {
%c.applyBodyParts();
%c.applyBodyColors();
}
else {
%p.mountImage(%helmN, 2);
for(%i = 0; $hat[%i] !$= ""; %i++) {
%p.hideNode($hat[%i]);
%p.hideNode($accent[%i]);
}
}
}
}
Now you just do these for the same things with highly reduced coding:
/XinaHelms mx
/XinaHelms tom
/XinaHelms tom glow
/XinaHelms guy
/XinaHelms guy glowYou can shorten the name and such, but you repeated the same exact code 5 times needlessly. This reduces the function spam.
Warning - while you were typing 3 new replies have been posted. You may wish to review your post. I knew you were going to be a great add-on maker.
Keep it up.
Although overcomplicated. :(
Edit: Wow, reduced the code a lot there.
Edit2: Damn dude, so much code reduction.