Код за потвърждение: Избери целия код
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <colorchat>
new const Chameleon_Sound[] = "misc/haha.wav"
new p_Status
new p_Price
new p_Prefix
new p_Sound
new p_Health
new p_HealthAmount
new p_MaxHealth
new p_InfoMsgInterval
new p_CheckValue
new p_CheckValueInterval
new g_InfoMsgEnt
new g_CheckValueEnt
new g_CZ
new g_Prefix[32]
new bool: b_Chameleon[33]
new bool: isEnabled
new const Terrorist_Models[][] =
{
"arctic",
"guerilla",
"leet",
"terror",
"militia"
}
new const CT_Models[][] =
{
"gign",
"gsg9",
"sas",
"urban",
"spetsnaz"
}
public plugin_precache()
{
precache_sound(Chameleon_Sound)
}
public plugin_init()
{
register_plugin("Chameleon", "3.0 Final", "DaRk_StyLe")
p_Status = register_cvar("chameleon", "1")
isEnabled = bool:get_pcvar_num(p_Status)
if (isEnabled)
{
register_clcmd("say /chameleon", "ClientCommand_Chameleon")
register_clcmd("say_team /chameleon", "ClientCommand_Chameleon")
register_event("DeathMsg", "Event_DeathMsg", "a")
p_Price = register_cvar("chameleon_price", "12000")
p_Prefix = register_cvar("chameleon_prefix", "[Legends BG Chameleon]:")
p_Sound = register_cvar("chameleon_sounds", "0")
p_Health = register_cvar("chameleon_health", "0")
p_InfoMsgInterval = register_cvar("cham_infomsg_show_time", "0")
p_CheckValue = register_cvar("cl_minmodels_check_value", "0")
g_CZ = is_running("czero")
if (get_pcvar_float(p_InfoMsgInterval))
{
g_InfoMsgEnt = create_entity("info_target")
entity_set_string(g_InfoMsgEnt, EV_SZ_classname, "InfoMsg")
entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
register_think("InfoMsg", "InfoMsgThink")
}
if (get_pcvar_num(p_CheckValue))
{
p_CheckValueInterval = register_cvar("cl_minmodels_check_time", "0")
g_CheckValueEnt = create_entity("info_target")
entity_set_string(g_CheckValueEnt, EV_SZ_classname, "Check")
entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
register_think("Check", "CheckValueThink")
}
if (get_pcvar_num(p_Health))
{
p_HealthAmount = register_cvar("cham_killer_health", "20")
p_MaxHealth = register_cvar("cham_killer_max_health", "120")
}
}
}
public client_connect(id)
{
b_Chameleon[id] = false
}
public Event_DeathMsg()
{
new Killer = read_data(1)
new Victim = read_data(2)
if (is_user_connected(Killer) && b_Chameleon[Victim])
{
if (get_pcvar_num(p_Health))
{
new KillerHealth = get_user_health(Killer)
new MaxHealth = get_pcvar_num(p_MaxHealth)
if (KillerHealth >= MaxHealth)
{
set_user_health(Killer, MaxHealth)
}
else
{
new KillerName[32]
get_user_name(Killer, KillerName, charsmax(KillerName))
set_user_health(Killer, KillerHealth + get_pcvar_num(p_HealthAmount))
client_print(0, print_chat, "%s receives extra health for killing a chameleon!", KillerName)
}
}
new Sounds = get_pcvar_num(p_Sound)
if (Sounds)
{
switch (Sounds)
{
case 1: client_cmd(0, "spk ^"%s^"", Chameleon_Sound)
case 2: client_cmd(Killer, "spk ^"%s^"", Chameleon_Sound)
case 3: client_cmd(Victim, "spk ^"%s^"", Chameleon_Sound)
}
}
cs_reset_user_model(Victim)
b_Chameleon[Victim] = false
}
}
public ClientCommand_Chameleon(id)
{
new Money = cs_get_user_money(id) - get_pcvar_num(p_Price)
get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
if (b_Chameleon[id])
{
ColorChat(id, GREY, "%s Vie veche imate tozi element!", g_Prefix)
}
else if (Money < 0)
{
ColorChat(id, GREY, "^4%s ^3Vie nyamate dostatachno pari!", g_Prefix)
}
else if (!is_user_alive(id))
{
ColorChat(id, GREY, "^4%s ^3Vie tryabva da badete zhiv, za da izpolzvate tazi optsiya!", g_Prefix)
}
else
{
new CsTeams:Team = cs_get_user_team(id)
switch (Team)
{
case CS_TEAM_T:
{
cs_set_user_model(id, CT_Models[random(g_CZ ? 5 : 4)])
cs_set_user_money(id, Money)
ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
b_Chameleon[id] = true
}
case CS_TEAM_CT:
{
cs_set_user_model(id, Terrorist_Models[random(g_CZ ? 5 : 4)])
cs_set_user_money(id, Money)
ColorChat(id, GREY, "^4%s ^3Chestito! Sega vie shte izglezhdate kato vragovete si!", g_Prefix)
b_Chameleon[id] = true
}
}
}
}
public InfoMsgThink(Ent)
{
if (Ent == g_InfoMsgEnt)
{
get_pcvar_string(p_Prefix, g_Prefix, charsmax(g_Prefix))
client_print(0, print_chat, "%s Type /chameleon to look like the enemy!", g_Prefix)
entity_set_float(g_InfoMsgEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_InfoMsgInterval))
}
}
public CheckValueThink(Ent)
{
if (Ent == g_CheckValueEnt)
{
CheckMinModelsValue()
entity_set_float(g_CheckValueEnt, EV_FL_nextthink, get_gametime() + get_pcvar_float(p_CheckValueInterval))
}
}
CheckMinModelsValue()
{
new Players[32], Num, id
get_players(Players, Num, "ch")
for (--Num; Num >= 0; Num--)
{
id = Players[Num]
query_client_cvar(id, "cl_minmodels", "Minmodels_Value")
}
}
public Minmodels_Value(id, const cvar[], const value[])
{
new Value = str_to_num(value)
if (Value > 0)
{
server_cmd("kick #%d ^"This server is using a chameleon item, which requires cl_minmodels 0 !^"", get_user_userid(id))
}
}