Blah, those are two seperate NPC's but here ya go:
NPC Code:
//Hat Setting NPC
if (playerchats&&strequals(#c,hatname)) {
setstring client.hat,hatimage.png;
}
//NPC for putting the hat on or off.
if (weaponfired) {
if (strequals(#P1,)) {
setplayerprop #P1,#s(client.hat);
setani haton,;
}
else {
setani hatoff,;
setplayerprop #P1,;
}
}
Should work I think, although you might have to put in some sleeps and freezeplayers
