The "hats" in Urban Terror are actually called funstuff. Here's how to equip them:
The available funstuff varies depending on your team, race, and gender. You can view a full list of funstuff codes at: https://www.urt.unfoog.de/funstuff.htm.
More examples: /funblue viking, /funred ninja. Just don't forget the "/" at the start of each command.