I don't think you understand
this line of code
strpos($accentsAllowed[$hat[%cl.hat]],strlwr($accent[%cl.accent])) != -1
-snip-
No I get it, and actually that whole line is basically pointless since the helmet is the only hat with an accent that has the same value as another accent from a different hat(s)
ie) %client.accent = 1; is the visor and the plume
Since you checked for the helmet first (line 202-209) we can assume the else if from line 210 only has to check if %client.accent > 0 to effectively restore the players accent