Your code indenting/styling is very inconsistent, either use tabs only or spaces only.
A quick glance reveals this error:
PHP Code:
function onPlayertouchsme() {
addweapon("Personal/kingcj/haticon");
clientr.hat_array = {0,1,2,3,4,5};
}
else if (clientr.hat_array = {0,1,2,3,4,5}) { //My goal here was if the player had the weapon it wouldn't reset the hat array... Doesn't work very well.
addweapon("Personal/kingcj/haticon");
}
The problem: You're doing else if on a function.
Edit: Looks like you already touched on that cbk.
You're drawing a hat on 199 but the others on 201, and 202. 199 is a global index so other player's would see that random hat but not the others.
You might benefit from learning how to use functions to your advantage so you don't have everything in onKeyPressed.