Код за потвърждение: Избери целия код
new droptype:drop_type;
if(get_user_flags(id) & ADMIN_LEVEL_H)
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Weapon Trail"
#define VERSION "2.0"
#define AUTHOR "anakin_cstrike"
#define MAX_PLAYERS 32
#define OFFSET_ENT_TO_INDEX 43
enum droptype
{
droptype_manual,
droptype_ondeath
}
new
toggle,light,vel,g_max_clients,g_max_entities;
new const g_drop[] = "drop";
new const g_wbox_class[] = "weaponbox";
new const g_wbox_model[] = "models/w_weaponbox.mdl";
new const g_wbox_model_prefix[] = "models/w_";
new const g_start_client_index = 1;
new g_command[MAX_PLAYERS + 1][sizeof g_drop + 1];
new g_trail,r,g,b;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_forward(FM_SetModel, "fw_setmodel");
register_forward(FM_Touch,"fw_touch");
toggle = register_cvar("weapontrail","1");
light = register_cvar("weapontrail_light","1");
vel = register_cvar("weapontrail_vel","0");
g_max_clients = global_get(glb_maxClients);
g_max_entities = global_get(glb_maxEntities);
}
public plugin_precache()
g_trail = precache_model("sprites/smoke.spr");
public client_command(id)
read_argv(0, g_command[id], sizeof g_drop);
public fw_setmodel(ent, const model[])
{
if(get_pcvar_num(toggle) != 1)
return FMRES_IGNORED;
if(!pev_valid(ent) || !equal(model, g_wbox_model_prefix, sizeof g_wbox_model_prefix - 1) || equal(model, g_wbox_model))
return FMRES_IGNORED;
new id = pev(ent, pev_owner)
if(!(g_start_client_index <= id <= g_max_clients))
return FMRES_IGNORED;
static class[32],i;
pev(ent,pev_classname,class, sizeof class - 1)
if(!equal(class,g_wbox_class))
return FMRES_IGNORED;
for(i = g_max_clients + 1;i < g_max_entities;++i)
{
if(!pev_valid(i) || ent != pev(i, pev_owner))
continue;
new wid = get_pdata_int(i,OFFSET_ENT_TO_INDEX);
if(wid != CSW_C4)
{
new droptype:drop_type;
if(get_user_flags(id) & ADMIN_LEVEL_H)
drop_type = droptype_ondeath;
else if(equal(g_command[id], g_drop))
drop_type = droptype_manual;
else
return FMRES_IGNORED;
switch(drop_type)
{
case droptype_ondeath: {
if(get_user_team(id) == 1){r=255;g=0;b=0;}
else if(get_user_team(id) == 2){r=0;g=0;b=255;}
}
case droptype_manual: {
r = random(255);
g = random(255);
b = random(255);
}
}
if(get_pcvar_num(vel) == 1)
{
new Float:vel[3];
vel[0] = float(random(300));
vel[1] = float(random(300));
vel[2] = float(random(300));
set_pev(ent,pev_velocity,vel);
}
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMFOLLOW);
write_short(ent);
write_short(g_trail);
write_byte(0);
write_byte(0);
write_byte(0);
write_byte(0);
write_byte(0);
write_byte(0);
message_end();
}
}
return FMRES_IGNORED;
}
public fw_touch(touched, toucher)
{
if(get_pcvar_num(toggle) != 1)
return FMRES_IGNORED;
if(get_pcvar_num(light) != 1)
return FMRES_IGNORED;
static class[32];
pev(toucher, pev_classname, class, sizeof class - 1);
if(containi(class, "weapon") != -1 && !touched)
{
new Float:origin[3];
pev(toucher, pev_origin, origin);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_DLIGHT);
write_coord(floatround(origin[0]));
write_coord(floatround(origin[1]));
write_coord(floatround(origin[2]));
write_byte(12);
write_byte(r);
write_byte(g);
write_byte(b);
write_byte(5);
write_byte(20);
message_end();
}
return FMRES_IGNORED;
}