Код:
#define AUTHOR "BIGs"
// Hud
new sSpark; //explode spr
new firespr;
new g_gibs;
new Killer;
new Org[3];
enum _:cz_VUL
{
idle,
idle2,
shoot,
draw,
holster,
reload
};
public plugin_init() {
register_plugin(
PLUGIN,
VERSION,
AUTHOR
);
}
public plugin_precache()
{
PRECACHE_MODEL(MODEL_VIEW);
PRECACHE_MODEL(MODEL_WORLD);
PRECACHE_MODEL(MODEL_WORLD_T);
PRECACHE_MODEL(MODEL_PLAYER);
PRECACHE_SOUND(SOUND_FIRE);
PRECACHE_SOUND(SOUND_DEPLOY);
PRECACHE_SOUND(SOUND_BURN);
PRECACHE_SOUND(SOUND_GLASS);
PRECACHE_GENERIC(WEAPON_HUD_TXT);
//PRECACHE_GENERIC(WEAPON_HUD_BAR);
//PRECACHE_GENERIC(WEAPON_HUD_AMMO);
sSpark= precache_model("sprites/dexplo.spr");
firespr = precache_model("sprites/gexplo.spr");
g_gibs = precache_model("sprites/fire.spr");
}
public QR_PrimaryAttack(const iItem, const iPlayer, iClip)
{
if (pev(iPlayer, pev_waterlevel) == 3 || iClip <= 0)
{
wpnmod_play_empty_sound(iItem);
wpnmod_set_offset_float(iItem, Offset_flNextPrimaryAttack, 0.15);
return;
}
wpnmod_set_offset_int(iItem, Offset_iClip, iClip -= 1);
wpnmod_set_offset_int(iPlayer, Offset_iWeaponVolume, LOUD_GUN_VOLUME);
wpnmod_set_offset_int(iPlayer, Offset_iWeaponFlash, BRIGHT_GUN_FLASH);
wpnmod_set_offset_float(iItem, Offset_flNextPrimaryAttack, 0.1);
wpnmod_set_offset_float(iItem, Offset_flTimeWeaponIdle, 1.0);
wpnmod_set_player_anim(iPlayer, PLAYER_ATTACK1);
wpnmod_send_weapon_anim(iItem, shoot);
wpnmod_fire_bullets
(
iPlayer,
iPlayer,
1,
Float: {0.0001, 0.0001, 0.0001},
8192.0,
WEAPON_DAMAGE,
DMG_BULLET,
0
);
emit_sound(iPlayer, CHAN_WEAPON, SOUND_FIRE, 0.9, ATTN_NORM, 0, PITCH_NORM);
set_pev(iPlayer, pev_effects, pev(iPlayer, pev_effects) | EF_MUZZLEFLASH);
set_pev(iPlayer, pev_punchangle, Float: {-4.0, 0.0, 0.0});
trace_exp(iPlayer);
new Float:vecEnd[ 3 ];
fm_get_aim_origin(iPlayer , vecEnd);
wpnmod_radius_damage(vecEnd, iPlayer, iPlayer, WEAPON_DAMAGE, WEAPON_DAMAGE * 2.0, CLASS_NONE, DMG_ENERGYBEAM | DMG_ALWAYSGIB);
}
public trace_exp(id)
{
new Float:flAim[3];
fm_get_aim_origin(id, flAim);
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION);
engfunc(EngFunc_WriteCoord, flAim[0]);
engfunc(EngFunc_WriteCoord, flAim[1]);
engfunc(EngFunc_WriteCoord, flAim[2]);
write_short(sSpark); // sprite index
write_byte(2); // scale in 0.1's
write_byte(30); // framerate
write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOPARTICLES | TE_EXPLFLAG_NOSOUND); // flags
message_end();
}
public QR_SecondaryAttack(const iItem, const iPlayer, iClip)
{
if(iClip < 20)
{
client_print(iPlayer ,print_center ,"Low Ammo");
}else{
wpnmod_set_offset_int(iItem, Offset_iClip, iClip -= 20);
wpnmod_set_offset_float(iItem, Offset_flNextSecondaryAttack, 2.1);
new iGrn = create_entity( "info_target" ) ;
new Float:origin[3],Float:velocity[3],Float:angles[3];
engfunc(EngFunc_GetAttachment, iPlayer, 0, origin,angles);
pev(iPlayer,pev_angles,angles);
set_pev(iGrn , pev_classname, "gr_flame" );
set_pev(iGrn , pev_solid, SOLID_BBOX );
set_pev(iGrn , pev_movetype, MOVETYPE_TOSS );
set_pev(iGrn , pev_mins, { -0.1, -0.1, -0.1 } );
set_pev(iGrn , pev_maxs, { 0.1, 0.1, 0.1 } );
entity_set_model(iGrn , MODEL_GRENADE );
set_pev(iGrn , pev_origin, origin );
set_pev(iGrn , pev_angles, angles );
set_pev(iGrn , pev_owner, iPlayer);
velocity_by_aim( iPlayer, 1000 , velocity );
set_pev(iGrn , pev_velocity, velocity );
Killer = iPlayer;
}
}
public pfn_touch(ptr, ptd)
{
// If ent is valid
if (pev_valid(ptr))
{
// Get classnames
static classname[32];
pev(ptr, pev_classname, classname, 31);
// Our ent
if(equal(classname, "gr_flame"))
{
// Get it's origin
new Float:originF[3];
pev(ptr, pev_origin, originF);
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0);
write_byte(TE_WORLDDECAL);
engfunc(EngFunc_WriteCoord, originF[0]);
engfunc(EngFunc_WriteCoord, originF[1]);
engfunc(EngFunc_WriteCoord, originF[2]);
write_byte(engfunc(EngFunc_DecalIndex,"{scorch3"));
message_end();
// Draw explosion
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, originF[0]); // engfunc because float
engfunc(EngFunc_WriteCoord, originF[1]);
engfunc(EngFunc_WriteCoord, originF[2]+30.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, originF[0] + 50); // engfunc because float
engfunc(EngFunc_WriteCoord, originF[1] + 50);
engfunc(EngFunc_WriteCoord, originF[2]+ 30.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, originF[0] - 50); // engfunc because float
engfunc(EngFunc_WriteCoord, originF[1] - 50);
engfunc(EngFunc_WriteCoord, originF[2]+ 20.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
//It's Gibs
message_begin (MSG_BROADCAST,SVC_TEMPENTITY);
write_byte( TE_SPRITETRAIL ); // Throws a shower of sprites or models
engfunc(EngFunc_WriteCoord, originF[ 0 ]); // start pos
engfunc(EngFunc_WriteCoord, originF[ 1 ]);
engfunc(EngFunc_WriteCoord, originF[ 2 ] + 500.0);
engfunc(EngFunc_WriteCoord, originF[ 0 ]); // start pos
engfunc(EngFunc_WriteCoord, originF[ 1 ]);
engfunc(EngFunc_WriteCoord, originF[ 2 ]);
write_short(g_gibs); // spr
write_byte(80); // (count)
write_byte(180); // (life in 0.1's)
write_byte(2) ;// byte (scale in 0.1's)
write_byte(random_num(30,70)); // (velocity along vector in 10's)
write_byte(20); // (randomness of velocity in 10's)
message_end();
Org[0] = originF[ 0 ];
Org[1] = originF[ 1 ];
Org[2] = originF[ 2 ];
// Get owner
new owner = pev(ptr, pev_owner);
// Alive...
new a = FM_NULLENT;
set_pev(ptr, pev_flags, FL_KILLME);
// Get distance between victim and epicenter
while((a = find_ent_in_sphere(a,originF,300.0)) != 0) {
if( a!=owner&& a!=ptr&&pev(a,pev_takedamage)!=DAMAGE_NO)
{
ExecuteHamB( Ham_TakeDamage, a ,owner ,owner, GRENADE_DAMAGE, DMG_BURN );
}
}
//wpnmod_radius_damage2(originF, ptr, 1, GRENADE_DAMAGE_GIBS, 600.0, CLASS_NONE, DMG_BURN | DMG_ALWAYSGIB);
emit_sound(0, CHAN_WEAPON, SOUND_GLASS, 0.9, ATTN_NORM, 0, PITCH_NORM);
//emit_sound(0, CHAN_WEAPON, SOUND_BURN, 0.9, ATTN_NORM, 0, PITCH_NORM);
set_task(1.0, "snd_burn",12);
//snd_burn();
set_task(1.0, "Tiil",_, _, _, "a" , 20);
}
}
}
public Tiil(id)
{
//new ptr = taskid;
wpnmod_radius_damage2(Org, Killer, Killer, GRENADE_DAMAGE_GIBS, 350.0, CLASS_NONE, DMG_BURN | DMG_ALWAYSGIB);
// Draw explosion
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, Org[0]); // engfunc because float
engfunc(EngFunc_WriteCoord, Org[1]);
engfunc(EngFunc_WriteCoord, Org[2]+30.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
/*
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, Org[0] + 50); // engfunc because float
engfunc(EngFunc_WriteCoord, Org[1] + 50);
engfunc(EngFunc_WriteCoord, Org[2]+ 30.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION); // Temporary entity ID
engfunc(EngFunc_WriteCoord, Org[0] - 50); // engfunc because float
engfunc(EngFunc_WriteCoord, Org[1] - 50);
engfunc(EngFunc_WriteCoord, Org[2]+ 20.0);
write_short(firespr); // Sprite index
write_byte(25) ;// Scale
write_byte(35); // Framerate
write_byte(4); // Flags
message_end();
*/
}
public snd_burn()
{
//emit_sound(0, CHAN_WEAPON, SOUND_BURN, 0.9, ATTN_NORM, 0, PITCH_NORM);
client_cmd(0 , "spk %s" , SOUND_BURN);
set_task(20.0, "STOP_SND");
}
public STOP_SND()
{
client_cmd(0 , "stopsound" , SOUND_BURN);
}