;'Sprite Change Capes' - Unequip script

;Sprite=GetUserFlag(#USERID,1)
Sprite = GetClassSprite(GetUserClass(#USERID))
Guild = GetUserGuild(#USERID)
If Guild > 0
	GuildSprite = GetGuildSprite(Guild) 
	If GuildSprite > 0
		Sprite = GuildSprite
	EndIf 
EndIf

;SetUserFlag(#USERID,1,0)

SetUserSprite(#USERID,Sprite)
SetUserDisplayName(#USERID,GetUserName(#USERID))

; - Can't do this until we get a function to remove a item at a inventory slot.
;If GetItemDurability(#USERID,#TARGETINDEX) = 0
;	SendMessageToUser(#USERID,"You're "+GetItemName(#TARGETID)+" has worn out.",#MSG_CRITICAL)
;EndIf

ChanceToBreak = GetItemFlag2(#TARGETID)
If ChanceToBreak > -1
	If Random(0, ChanceToBreak) = 0
		TakeItem(#USERID, #TARGETID)
		RemoveItem(#MAPID, #TARGETID)
		SendMessageToUser(#USERID,"You're "+GetItemName(#TARGETID)+" has worn out.",#MSG_CRITICAL)
	EndIf
EndIf

If GetItemFlag4(#TARGETID) > 0
	Timer5(GetItemFlag4(#TARGETID),0,#USERID,#TARGETID,#TARGETINDEX,0,0)
EndIf

;NOT NEEDED AS OF 0.86 - WarpUser(#USERID,GetUserMap(#USERID),GetUserX(#USERID),GetUserY(#USERID))

Label END

Continue = 1