Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Clothesmod"
#define VERSION "1.0"
#define AUTHOR "Author"
new has_clothes[33] // Does the player have the clothes item on?
new new_clothes[33][32] // New Model specified
new cur_clothes[33][32] // Clothes Model Stored Here By Items
new old_clothes[33][32] // Old model they had
new default_model[32] = "collector-civilian"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_srvcmd("item_clothes","item_clothes")
}
public plugin_precache()
{
precache_model("models/player/collector-civilian/collector-civilian.mdl")
}
public client_connect(id)
{
client_cmd(id,"model %s",default_model)
}
public client_infochanged(id)
{
get_user_info(id,"model",new_clothes[id],31)
if(has_clothes[id] <= 0)
{
set_user_info(id,"model",default_model)
client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")
return PLUGIN_HANDLED
}
if(!equali(new_clothes[id],cur_clothes[id]))
{
set_user_info(id,"model",cur_clothes[id])
client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public item_clothes()
{
new arg[32], arg2[32], id, model
read_argv(1,arg,31)
read_argv(2,arg2,31)
id = str_to_num(arg)
model = str_to_num(arg2)
if(has_clothes[id] <= 0)
{
get_user_info(id,"model",old_clothes[id],31)
set_user_info(id,"model",arg2)
format(cur_clothes[id],31,arg2)
client_print(id,print_chat,"[Clothesmod] You have changed your clothes.")
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"[ClothesMod] %s, has changed his clothes",name)
has_clothes[id] = 1
return PLUGIN_HANDLED
}
else
{
client_print(id,print_chat,"[ClothesMod] You've put back on your original uniform.")
set_user_info(id,"model",default_model)
has_clothes[id] = 0
}
return PLUGIN_HANDLED
}