/* Plugin generated by AMXX-Studio */
/* credit : Knekters Bulelt Time*/
#include <amxmodx>
#include <engine>
#define PLUGIN "Bullet Effects"
#define VERSION "0.2"
#define AUTHOR "The Specialist"
#define NORMALSPEED 800
#define SNIPERSPEED 1100
new WeaponUsed[33];
new AmmoUsed[33];
new g_Switch;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_Switch = register_cvar("bfx_switch","1");
register_event("CurWeapon", "Weapon_Event","be", "1=1", "3>0");
set_task(30.0,"remove_bullets",0,"",0,"b");
}
public remove_bullets(id)
{
new ent = 0;
do
{
ent = find_ent(ent, "BulletX");
if(ent > 0)
{
remove_entity(ent);
}
} while(ent)
}
public Weapon_Event(id)
{
if(get_pcvar_num(g_Switch)==0)
{
return PLUGIN_HANDLED;
}else{
new Weapon = read_data(2);
new Clip = read_data(3);
if(WeaponUsed[id] == 0)
WeaponUsed[id] = Weapon;
if((AmmoUsed[id] > Clip) && (WeaponUsed[id] == Weapon) && Weapon != 4 && Weapon != 6 && Weapon != 9 && Weapon != 25)
{
create_bullet(id, Weapon);
}
WeaponUsed[id] = Weapon;
AmmoUsed[id] = Clip;
return 0;
}
return PLUGIN_HANDLED;
}
public create_bullet(id, Weapon)
{
new Bullets = create_entity("info_target");
if(Bullets > 0)
{
new g_Weapon[33];
new Float:Angle[3];
new Float:Origin[3];
new Float:AimVelocity[3];
new Float:MinBox[3] = {-1.0, -1.0, -1.0};
new Float:MaxBox[3] = {1.0, 1.0, 1.0};
entity_get_vector(id, EV_VEC_origin, Origin);
Origin[2] += 12.0;
entity_set_string(Bullets, EV_SZ_classname, "BulletX");
entity_set_model(Bullets, "models/shell.mdl");
get_weaponname(Weapon, g_Weapon, 32);
entity_set_string(Bullets, EV_SZ_targetname, g_Weapon);
entity_get_vector(id, EV_VEC_v_angle, Angle);
entity_set_vector(Bullets, EV_VEC_mins, MinBox);
entity_set_vector(Bullets, EV_VEC_maxs, MaxBox);
entity_set_origin(Bullets, Origin);
entity_set_vector(Bullets, EV_VEC_angles, Angle);
entity_set_vector(Bullets, EV_VEC_v_angle, Angle);
entity_set_int(Bullets, EV_INT_effects, 2);
entity_set_int(Bullets, EV_INT_solid, 2);
entity_set_int(Bullets, EV_INT_movetype, 5);
entity_set_edict(Bullets, EV_ENT_owner, id);
if(Weapon != 3 && Weapon != 13 && Weapon != 18 && Weapon != 24)
{
VelocityByAim(id, NORMALSPEED, AimVelocity);
} else {
VelocityByAim(id, SNIPERSPEED, AimVelocity);
}
entity_set_vector(Bullets, EV_VEC_velocity, AimVelocity);
if( get_user_team( id ) == 1 )
{
set_rendering(Bullets, kRenderFxGlowShell , 255,0,0,kRenderNormal,100);
}else{
set_rendering(Bullets, kRenderFxGlowShell , 0,0,255,kRenderNormal,100);
}
}
return 0;
}
public plugin_precache()
{
precache_model("models/shell.mdl");
}