- Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
new const KEVLAR[] = { "models/w_kevlar.mdl" }
new MODEL[] = "models/helm.mdl";
new modelname[9][] = { "gign","gsg9","sas","urban","vip","arctic","guerilla","leet","terror" };
new g_Ent[33];
new cvar_on;
public plugin_init()
{
register_plugin("Armor models", "999", "noname");
register_event("DeathMsg", "Remove", "d");
register_logevent("Remove", 2, "1=Round_End");
cvar_on = register_cvar("hm_remove_model_Round_End","1")
register_forward(FM_Touch, "fw_Touch")
}
public client_disconnect(id)
{
remove_entity(g_Ent[id]);
}
public BuyHelm(id)
{
if(is_user_alive(id))
{
g_Ent[id] = create_entity("info_target");
entity_set_int(g_Ent[id], EV_INT_movetype, MOVETYPE_FOLLOW);
entity_set_edict(g_Ent[id], EV_ENT_aiment, id);
entity_set_model(g_Ent[id], MODEL);
}
else
{
remove_entity(g_Ent[id]);
}
return PLUGIN_CONTINUE;
}
public Remove()
{
if(get_pcvar_num(cvar_on) == 1)
{
new death = read_data(2);
remove_entity(g_Ent[death]);
}
return PLUGIN_CONTINUE;
}
public get_model_id(id)
{
new modelStr[32], iNum=32, modelID;
get_user_info(id,"model",modelStr,iNum);
for(new i = 0; i < 9; i++)
{
if (equali(modelStr, modelname[i]))
{
modelID = i;
}
}
return modelID;
}
public plugin_precache()
{
precache_model(MODEL);
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/gign/gign.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/gsg9/gsg9.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/sas/sas.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/urban/urban.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/vip/vip.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/arctic/arctic.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/guerilla/guerilla.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/leet/leet.mdl");
force_unmodified(force_model_samebounds,{0,0,0},{0,0,0},"models/player/terror/terror.mdl");
}
public fw_Touch(ent, id)
{
if (!is_user_alive(id) || !pev_valid(ent))
return FMRES_IGNORED
static szEntModel[32]
pev(ent, pev_model, szEntModel, 31)
if (equali(szEntModel, KEVLAR))
{
set_task(0.1, "BuyHelm", id);
}
return FMRES_IGNORED
}
При покупки "шлема" или "бронежилета с шлемом" появляется у игроков моделька в виде каски. Всё вроде бы отлично и идея удалась, но нет модельки не стандартных игроков да и стандартные начинают "косплеить флэша" fps анимации подскакивает чуть ли не в двое.
Так же при возрождении каска не пропадает, а хотелось бы что бы пропадала.
Подскажите пожалуйста где что не так в скрипте. Заранее спасибо.