Update



SMA

#include <amxmodx>
#include <fun>
#include <amxmisc>
#include <cstrike>

new plugin_on

enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}

new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}


public plugin_init(){

register_plugin("ADMIN MODELS MENU", "1.1", "HQ # NiKe aka NiKe2000")
register_menucmd(register_menuid("ADMIN MODELS MENU"), 1023, "setoption")
plugin_on = register_cvar("amx_admodels", "1")


register_clcmd("say /adminmodels","admin_models",ADMIN_KICK)
register_clcmd("say_team /adminmodels","admin_models",ADMIN_KICK)
register_clcmd("say /admodels","admin_models",ADMIN_KICK)


}

public admin_models(id,level,cid)
{
if ( !get_pcvar_num(plugin_on) )
{
ColorChat(id, RED, "Admin Models Menu is currently disabled");
return PLUGIN_HANDLED;
}

if(!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED

chooseoption(id)

return PLUGIN_HANDLED

}

public chooseoption(id)
{
new menu[192]
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_K EY_4|MENU_KEY_5|MENU_KEY_9
format(menu, 191, "\yAlegeti Costumul^n^n\r1.\w Simen RedLevel^n\r2.\w Armored^n\r3.\w Predator^n\r4.\w Ice Predator^n\r5.\w WeedMan^n\r9.\w Reset Admin Model^n^n\r0.\w Exit")
show_menu(id, keys, menu)
return PLUGIN_CONTINUE
}

public setoption(id, key, menu)
{
if(key == 0) {
new name[17]
get_user_name(id, name, 18)
cs_set_user_model(id, "admin_simen")
ColorChat(id, TEAM_COLOR, "^x04[ADMIN] ^x03%s^x01 has set Model ^x03Simen RedLevel", name)
return PLUGIN_CONTINUE
}

if(key == 1) {
new name[17]
get_user_name(id, name, 18)
cs_set_user_model(id, "armored_admin")
ColorChat(id, TEAM_COLOR, "^x04[ADMIN] ^x03%s^x01 has set Model ^x03Armored", name)
return PLUGIN_CONTINUE

}

if(key == 2) {
new name[17]
get_user_name(id, name, 18)
cs_set_user_model(id, "admin_predator")
ColorChat(id, TEAM_COLOR, "^x04[ADMIN] ^x03%s^x01 has set Model ^x03Predator", name)
return PLUGIN_CONTINUE
}

if(key == 3) {
new name[17]
get_user_name(id, name, 18)
cs_set_user_model(id, "predator1")
ColorChat(id, TEAM_COLOR, "^x04[ADMIN] ^x03%s^x01 has set Model ^x03Ice Predator", name)
return PLUGIN_CONTINUE

}

if(key == 4) {
new name[17]
get_user_name(id, name, 18)
cs_set_user_model(id, "predator2")
ColorChat(id, TEAM_COLOR, "^x04[ADMIN] ^x03%s^x01 has set Model ^x03WeedMan", name)
return PLUGIN_CONTINUE

}

else {
return PLUGIN_CONTINUE
}

return PLUGIN_HANDLED
}

public plugin_precache()
{
precache_model("models/player/admin_simen/admin_simen.mdl")
precache_model("models/player/armored_admin/armored_admin.mdl")
precache_model("models/player/admin_predator/admin_predator.mdl")
precache_model("models/player/predator1/predator1.mdl")
precache_model("models/player/predator2/predator2.mdl")
return PLUGIN_CONTINUE

}

ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
new message[256];

switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}

vformat(message[1], 251, msg, 4);

// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';

new team, ColorChange, index, MSG_Type;

if(id)
{
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}

team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);

ShowColorMessage(index, MSG_Type, message);

if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}

ShowColorMessage(id, type, message[])
{
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used)
{
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id)
write_string(message);
message_end();
}

Team_Info(id, type, team[])
{
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used)
{
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();

return 1;
}

ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}

return 0;
}

FindPlayer()
{
new i = -1;

while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}

return -1;
}