icon = 'objs.dmi'
icon_state = "jacket"
if("leatherjacket" in usr.overlays)
usr.overlays -= "leatherjacket"
usr << "You take off the jacket"
usr.overlays += "leatherjacket"
usr << "You put the jacket on"

Problem description:
When I click the jacket, while still having it on, it keeps saying "You put the jacket on, resulting in more overlays of the leather jacket, so if the player clicks on the jacket too many times, it will be a chore to take it off.
Technically overlays is a list of icons. "leatherjacket" is not an icon. Shall I suggest a modification?

if(src in usr.overlays)
usr.overlays -= src
usr.overlays += src
In response to Lugia319 (#1)
Good, but leatherjacket is an icon state in 'player.dmi', so how would I make "leatherjacket" overlay the player?
In response to BeignetLover (#2)
Make the icon state into an obj, then add it to the player using the following line.

src.overlays += new/obj/Jacket
In response to Gizhy (#3)
but leatherjacket and the icon "jacket" are two different icons. If I make the OBJ icon "leatherjacket" it will be animated.
In response to BeignetLover (#4)
I hope you know the "usr.overlays += new/obj/Jacket" was only an example. It's to show you what you need to do.

I'll word it more clear. Create an obj with the same icon AND icon_state as the one your trying to use. Then use "usr.overlays += new/obj/OBJ_YOU_MADE".
In response to Gizhy (#5)
I'd just like to make two quick notes.

First, you can add an overlay just by the path, you don't have to actually create the object: overlays += /obj/overlays/jacket

Second, the overlays list is not technically a list of "icons". They're a special internal datatype. See the bottom note in the reference entry. Trying to check if an overlay is already "equipped" with the in operator is probably a bad idea. You should keep track of which items the player is wearing in a separate list of your own.
In response to DarkCampainger (#6)
but to see what's in the list, I'd still need to use the in operator. Or is it just with overlays?
In response to BeignetLover (#7)
I handle this sorta deal with an obj var instead really.

Equipped = 0 // Equipped or not

if(src.Equipped == 0) // If it's not equipped
usr.overlays += src
src.Equipped = 1
usr.overlays -= src
src.Equipped = 0

In response to Lugia319 (#8)
Well duh! I have no Idea why I didn't think of that. I guess it's because using if(derp in overlays) sounds cooler :P anyway, thanks
In response to Lugia319 (#8)