Thread: [Subplugin Submission] [ZP] List of VIP Extra Items
View Single Post
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-08-2014 , 04:53   Re: VIP Extra Items
Reply With Quote #14

Quote:
Originally Posted by Light_Dark View Post
Please convert these for ZP VIP extra.
Please use below:
1. ATCS4:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include <zmvip>

#define PLUGIN "[ZP] Extra Item: AT4CS"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define weapon_at4cs "weapon_m249"
#define CSW_AT4CS CSW_M249

#define TASK_CHECKRELOAD 111112
#define TASK_RELOAD 111113

new g_at4cs
new g_had_at4cs[33], Float:g_lastfire[33], Float:g_lastaim[33], g_aiming[33],
g_smoke_idg_spr_trailg_spr_expis_reloading[33],
cvar_radiuscvar_maxdamage

new const v_model[] = "models/zombie_plague/v_at4ex.mdl"
new const p_model[] = "models/zombie_plague/p_at4ex.mdl"
new const w_model[] = "models/zombie_plague/w_at4ex.mdl"
new const s_model[] = "models/zombie_plague/s_rocket.mdl"

new const at4cs_sound[5][] = {
    
"weapons/at4-1.wav"// Fire Sound
    
"weapons/at4_clipin1.wav"// Clip in 1
    
"weapons/at4_clipin2.wav"// Clip in 2
    
"weapons/at4_clipin3.wav"// Clip in 3
    
"weapons/at4_draw.wav"  // Draw
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""event_curweapon""be""1=1")
    
register_event("HLTV""event_newround""a""1=0""2=0")
    
    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)
    
register_forward(FM_CmdStart"fw_CmdStart")
    
register_forward(FM_SetModel"fw_SetModel")
    
    
register_think("at4ex_rocket""fw_rocket_think")
    
register_touch("at4ex_rocket""*""fw_rocket_touch")
    
    
RegisterHam(Ham_Weapon_Reloadweapon_at4cs"fw_WeaponReload")
    
RegisterHam(Ham_Item_AddToPlayerweapon_at4cs"fw_AddToPlayer"1)
    
    
cvar_radius register_cvar("zp_at4cs_radius""300.0")
    
cvar_maxdamage register_cvar("zp_at4cs_maxdamage""650.0")
    
    
g_at4cs zv_register_extra_item("AT4CS""(VIP only)"38ZV_TEAM_HUMAN
    
    
register_clcmd("weapon_at4cs""hook_weapon")
}

public 
hook_weapon(id)
{
    
engclient_cmd(idweapon_at4cs)
    return 
PLUGIN_HANDLED
}

public 
plugin_precache()
{
    
engfunc(EngFunc_PrecacheModelv_model)
    
engfunc(EngFunc_PrecacheModelp_model)
    
engfunc(EngFunc_PrecacheModelw_model)
    
engfunc(EngFunc_PrecacheModels_model)
    
    
engfunc(EngFunc_PrecacheGeneric"sprites/weapon_at4cs.txt")
    
engfunc(EngFunc_PrecacheGeneric"sprites/at4cs.spr")  
    
    
g_smoke_id engfunc(EngFunc_PrecacheModel"sprites/effects/rainsplash.spr")
    
g_spr_trail engfunc(EngFunc_PrecacheModel,"sprites/xbeam3.spr")
    
g_spr_exp engfunc(EngFunc_PrecacheModel,"sprites/zerogxplode.spr")
    
    for(new 
0sizeof(at4cs_sound); i++)
        
engfunc(EngFunc_PrecacheSoundat4cs_sound[i])
}

public 
zv_extra_item_selected(iditemid)
{
    if(
itemid != g_at4cs)
        return 
PLUGIN_HANDLED
    
    g_had_at4cs
[id] = 1
    is_reloading
[id] = 0
    g_aiming
[id] = 0
    
    fm_give_item
(idweapon_at4cs)
    
    static 
at4cs
    at4cs 
fm_get_user_weapon_entity(idCSW_AT4CS)
    
    
cs_set_weapon_ammo(at4cs1)
    
cs_set_user_bpammo(idCSW_AT4CS10)
    
    return 
PLUGIN_CONTINUE
}

public 
zp_user_infected_post(id)
{
    
g_had_at4cs[id] = 0
    is_reloading
[id] = 0
    g_aiming
[id] = 0
    
    remove_task
(id+TASK_CHECKRELOAD)
    
remove_task(id+TASK_RELOAD)    
}

public 
zp_user_humanized_post(id)
{
    
g_had_at4cs[id] = 0
    is_reloading
[id] = 0
    g_aiming
[id] = 0       
    
    remove_task
(id+TASK_CHECKRELOAD)
    
remove_task(id+TASK_RELOAD)            
}

public 
event_newround()
{
    
remove_entity_name("at4ex_rocket")
    
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && is_user_connected(i))
        {
            
remove_task(i+TASK_CHECKRELOAD)
            
remove_task(i+TASK_RELOAD)     
        }
    }
}

public 
event_curweapon(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_HANDLED
    
    
if(get_user_weapon(id) != CSW_AT4CS || !g_had_at4cs[id])
        return 
PLUGIN_HANDLED
    
    
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return 
PLUGIN_HANDLED
    
    set_pev
(idpev_viewmodel2v_model)
    
set_pev(idpev_weaponmodel2p_model)
    
    return 
PLUGIN_CONTINUE
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED
    
    
if(get_user_weapon(id) != CSW_AT4CS || !g_had_at4cs[id])
        return 
FMRES_IGNORED
    
    
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return 
FMRES_IGNORED
    
    set_cd
(cd_handleCD_flNextAttackhalflife_time() + 0.001)  
    
    return 
FMRES_HANDLED
}

public 
fw_AddToPlayer(entid)
{
    if(!
is_valid_ent(ent) || !is_user_alive(id))
        return 
HAM_IGNORED
    
    
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return 
HAM_IGNORED
    
    
if(entity_get_int(entEV_INT_impulse) == 61296)
    {
        
g_had_at4cs[id] = 1
        entity_set_int
(idEV_INT_impulse0)
        
        return 
HAM_HANDLED
    
}              
    
    if(
g_had_at4cs[id])
    {
        
message_begin(MSG_ONEget_user_msgid("WeaponList"), _id)
        
write_string("weapon_at4cs");    // WeaponName
        
write_byte(3)                  // PrimaryAmmoID
        
write_byte(1)                  // PrimaryAmmoMaxAmount
        
write_byte(-1)                   // SecondaryAmmoID
        
write_byte(-1)                   // SecondaryAmmoMaxAmount
        
write_byte(0)                    // SlotID (0...N)
        
write_byte(4)                    // NumberInSlot (1...N)
        
write_byte(CSW_AT4CS)            // WeaponID
        
write_byte(0)                   // Flags
        
message_end()
    }
    
    return 
HAM_HANDLED     
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED
    
    
if(get_user_weapon(id) != CSW_AT4CS || !g_had_at4cs[id])
        return 
FMRES_IGNORED
    
    
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return 
FMRES_IGNORED
    
    
static CurButton
    CurButton 
get_uc(uc_handleUC_Buttons)
    
    if(
CurButton IN_ATTACK)
    {
        static 
Float:CurTime
        CurTime 
get_gametime()
        
        static 
at4cs
        at4cs 
fm_find_ent_by_owner(-1weapon_at4csid)             
        
        if(
cs_get_weapon_ammo(at4cs) > && !is_reloading[id])
        {
            if(
CurTime 4.5 g_lastfire[id])
            {
                
set_weapon_anim(id1)
                
emit_sound(idCHAN_WEAPONat4cs_sound[0], 1.0ATTN_NORM0PITCH_NORM)
                
                
create_rocket(id)
                
                static 
Float:Punch_Angles[3]
                
                
Punch_Angles[0] = -20.0
                Punch_Angles
[1] = 0.0
                Punch_Angles
[2] = 0.0
                
                set_pev
(idpev_punchanglePunch_Angles)
                
cs_set_weapon_ammo(at4cscs_get_weapon_ammo(at4cs) - 1)
                
                if(
cs_get_weapon_ammo(at4cs) <= && !is_reloading[id])
                {
                    if(
cs_get_user_bpammo(idCSW_AT4CS) > 0)
                    {
                        
set_task(1.0"at4cs_reload"id)
                    }
                }
                
                if(
cs_get_user_zoom(id))
                    
cs_set_user_zoom(idCS_RESET_ZOOM1)
                
                
g_lastfire[id] = CurTime
            
}
            } else {
            if(!
is_reloading[id])
            {
                if(
cs_get_user_bpammo(idCSW_AT4CS) > 0)
                {
                    if(
CurTime 1.0 g_lastfire[id])
                    {
                        
at4cs_reload(id)
                        
g_lastfire[id] = CurTime
                    
}
                }
            }
        }
    }
    
    if(
CurButton IN_ATTACK2)
    {
        static 
Float:CurTime
        CurTime 
get_gametime()
        
        if((
CurTime 0.5 g_lastaim[id]) && !is_reloading[id])
        {
            if(!
g_aiming[id])
            {
                
cs_set_user_zoom(idCS_SET_FIRST_ZOOM1)
                
g_aiming[id] = 1
                
} else {
                
cs_set_user_zoom(idCS_RESET_ZOOM1)
                
g_aiming[id] = 0
            
}
            
            
g_lastaim[id] = CurTime
        
}
    }
    
    
CurButton &= ~IN_ATTACK
    set_uc
(uc_handleUC_ButtonsCurButton)
    
    
CurButton &= ~IN_RELOAD
    set_uc
(uc_handleUC_ButtonsCurButton)
    
    return 
FMRES_HANDLED
}

public 
fw_SetModel(ent, const model[])
{
    if(!
is_valid_ent(ent))
        return 
FMRES_IGNORED
    
    
static szClassName[33]
    
entity_get_string(entEV_SZ_classnameszClassNamecharsmax(szClassName))
    
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
static iOwner
    iOwner 
entity_get_edict(entEV_ENT_owner)
    
    if(
equal(model"models/w_m249.mdl"))
    {
        static 
at4cs
        at4cs 
find_ent_by_owner(-1"weapon_m249"ent)
        
        if(!
is_valid_ent(at4cs))
            return 
FMRES_IGNORED;
        
        if(
g_had_at4cs[iOwner])
        {
            
entity_set_int(at4csEV_INT_impulse61296)
            
g_had_at4cs[iOwner] = 0
            entity_set_model
(entw_model)
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED
}

public 
at4cs_reload(id)
{
    if(
is_reloading[id])
        return
    
    
is_reloading[id] = 1
    set_weapon_anim
(id3)
    
    
set_task(0.1"checking_reload"id+TASK_CHECKRELOAD__"b")
    
set_task(4.0"reload_complete"id+TASK_RELOAD)
}

public 
checking_reload(id)
{
    
id -= TASK_CHECKRELOAD
    
    
if(cs_get_user_zoom(id))
        
cs_set_user_zoom(idCS_RESET_ZOOM1
    
    if(
get_user_weapon(id) != CSW_AT4CS || !g_had_at4cs[id])
    {
        
remove_task(id+TASK_CHECKRELOAD)
        
remove_task(id+TASK_RELOAD)
        
        
is_reloading[id] = 0
    
}
}

public 
reload_complete(id)
{
    
id -= TASK_RELOAD
    
    
if(!is_reloading[id])
        return
    
    
remove_task(id+TASK_CHECKRELOAD)       
    
    static 
at4cs
    at4cs 
fm_find_ent_by_owner(-1weapon_at4csid)     
    
    
cs_set_weapon_ammo(at4cs1)
    
cs_set_user_bpammo(idCSW_AT4CScs_get_user_bpammo(idCSW_AT4CS) - 1)
    
is_reloading[id] = 0
}

public 
fw_WeaponReload(ent)
{
    static 
id
    id 
pev(entpev_owner)
    
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
HAM_IGNORED
    
    
if(get_user_weapon(id) != CSW_AT4CS || !g_had_at4cs[id])
        return 
HAM_IGNORED
    
    
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
        return 
HAM_IGNORED     
    
    
static Float:CurTime
    CurTime 
get_gametime()               
    
    if(!
is_reloading[id])
    {
        if(
cs_get_user_bpammo(idCSW_AT4CS) > 0)
        {
            if(
CurTime 1.0 g_lastfire[id])
            {
                
at4cs_reload(id)
                
g_lastfire[id] = CurTime
            
}
        }
    }      
    
    return 
HAM_SUPERCEDE
}

public 
create_rocket(id)
{
    new 
entFloat:Origin[3], Float:Angles[3], Float:Velocity[3]
    
    
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
engfunc(EngFunc_GetAttachmentid0OriginAngles)
    
pev(idpev_anglesAngles)
    
    
set_pev(entpev_originOrigin)
    
set_pev(entpev_anglesAngles)
    
set_pev(entpev_solid2)
    
set_pev(entpev_movetype5)
    
set_pev(entpev_classname"at4ex_rocket")
    
set_pev(entpev_ownerid)
    
engfunc(EngFunc_SetModelents_model)
    
    
set_pev(entpev_mins, {-1.0, -1.0, -1.0})
    
set_pev(entpev_maxs, {1.01.01.0})
    
    
velocity_by_aim(id1750Velocity)
    
set_pev(entpev_velocityVelocity)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMFOLLOW// TE id
    
write_short(ent// entity:attachment to follow
    
write_short(g_spr_trail// sprite index
    
write_byte(25// life in 0.1's
    
write_byte(2// line width in 0.1's
    
write_byte(255// r
    
write_byte(255// g
    
write_byte(255// b
    
write_byte(200// brightness
    
message_end()  
    
    
set_pev(entpev_iuser40)
    
set_pev(entpev_nextthinkhalflife_time() + 0.1)
}

public 
fw_rocket_think(ent)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:Origin[3]
    
pev(entpev_originOrigin)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_SPRITE)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_smoke_id)
    
write_byte(2)
    
write_byte(200)
    
message_end()
    
    if(
pev(entpev_iuser4) == 0)
    {
        static 
Victim
        Victim 
FindClosesEnemy(ent)
        
        if(
is_user_alive(Victim))
        {
            
set_pev(entpev_iuser4Victim)
        }
        } else {
        static 
Victim
        Victim 
pev(entpev_iuser4)
        
        if(
is_user_alive(Victim))
        {
            static 
Float:VicOrigin[3]
            
pev(Victimpev_originVicOrigin)
            
            
turn_to_target(entOriginVictimVicOrigin)
            
hook_ent(entVictim500.0)
            } else {
            
set_pev(entpev_iuser40)
        }
    }
    
    
set_pev(entpev_nextthinkhalflife_time() + 0.075)
}

public 
fw_rocket_touch(rockettouch)
{
    if(!
pev_valid(rocket))
        return 
    
    if(
is_user_alive(touch) && pev(rocketpev_owner) == touch)
        return
    
    static 
Float:Origin[3]
    
pev(rocketpev_originOrigin)        
    
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_spr_exp)  // sprite index
    
write_byte(20)  // scale in 0.1's
    
write_byte(30)  // framerate
    
write_byte(0)   // flags
    
message_end()
    
    static 
owneriVictim
    
    iVictim 
= -1
    owner 
pev(rocketpev_owner
    
    while((
iVictim find_ent_in_sphere(iVictimOriginget_pcvar_float(cvar_radius))) != 0)
    {
        if((
iVictim 32) && is_user_alive(iVictim)
        && 
iVictim != owner && zp_get_user_zombie(iVictim))
    {
        new 
Float:MaxDamageFloat:Damage
        
        MaxDamage 
get_pcvar_float(cvar_maxdamage)
        
Damage random_float(MaxDamage random_float(0.0100.0), MaxDamage random_float(0.0100.0))
        
        
ExecuteHam(Ham_TakeDamageiVictim0owner0DMG_BULLET)
        
        static 
health
        health 
get_user_health(iVictim)
        
        if(
health Damage >= 1)
        {
            
fm_set_user_health(iVictimhealth floatround(Damage))
        }
        else
        {
            
death_message(owneriVictim1)
        }                      
    }
}      

engfunc(EngFunc_RemoveEntityrocket)
}

stock set_weapon_anim(idanim)
{
set_pev(idpev_weaponanimanim)

message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_id)
write_byte(anim)
write_byte(pev(id,pev_body))
message_end()
}

stock death_message(KillerVictimScoreBoard)
{
// Block death msg
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
ExecuteHamB(Ham_KilledVictimKiller2)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)

// Death
make_deathmsg(KillerVictim0"")

// Update score board
if (ScoreBoard)
{
    
message_begin(MSG_BROADCASTget_user_msgid("ScoreInfo"))
    
write_byte(Killer// id
    
write_short(pev(Killerpev_frags)) // frags
    
write_short(cs_get_user_deaths(Killer)) // deaths
    
write_short(0// class?
    
write_short(get_user_team(Killer)) // team
    
message_end()
    
    
message_begin(MSG_BROADCASTget_user_msgid("ScoreInfo"))
    
write_byte(Victim// id
    
write_short(pev(Victimpev_frags)) // frags
    
write_short(cs_get_user_deaths(Victim)) // deaths
    
write_short(0// class?
    
write_short(get_user_team(Victim)) // team
    
message_end()
}
}

stock FindClosesEnemy(entid)
{
new 
Float:Dist
new Float:maxdistance=300.0
new indexid=0  
for(new i=1;i<=get_maxplayers();i++){
    if(
is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi)
    && 
pev(entidpev_owner) != && cs_get_user_team(pev(entidpev_owner)) != cs_get_user_team(i))
{
    
Dist entity_range(entidi)
    if(
Dist <= maxdistance)
    {
        
maxdistance=Dist
        indexid
=i
        
        
return indexid
    
}
}      
}      
return 
0
}

stock bool:can_see_fm(entindex1entindex2)
{
if (!
entindex1 || !entindex2)
return 
false

if (pev_valid(entindex1) && pev_valid(entindex1))
{
    new 
flags pev(entindex1pev_flags)
    if (
flags EF_NODRAW || flags FL_NOTARGET)
    {
        return 
false
    
}
    
    new 
Float:lookerOrig[3]
    new 
Float:targetBaseOrig[3]
    new 
Float:targetOrig[3]
    new 
Float:temp[3]
    
    
pev(entindex1pev_originlookerOrig)
    
pev(entindex1pev_view_ofstemp)
    
lookerOrig[0] += temp[0]
    
lookerOrig[1] += temp[1]
    
lookerOrig[2] += temp[2]
    
    
pev(entindex2pev_origintargetBaseOrig)
    
pev(entindex2pev_view_ofstemp)
    
targetOrig[0] = targetBaseOrig [0] + temp[0]
    
targetOrig[1] = targetBaseOrig [1] + temp[1]
    
targetOrig[2] = targetBaseOrig [2] + temp[2]
    
    
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player
    
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater))
    {
        return 
false
    
}
    else
    {
        new 
Float:flFraction
        get_tr2
(0TraceResult:TR_flFractionflFraction)
        if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
        {
            return 
true
        
}
        else
        {
            
targetOrig[0] = targetBaseOrig [0]
            
targetOrig[1] = targetBaseOrig [1]
            
targetOrig[2] = targetBaseOrig [2]
            
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player
            
get_tr2(0TraceResult:TR_flFractionflFraction)
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
            {
                return 
true
            
}
            else
            {
                
targetOrig[0] = targetBaseOrig [0]
                
targetOrig[1] = targetBaseOrig [1]
                
targetOrig[2] = targetBaseOrig [2] - 17.0
                engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player
                
get_tr2(0TraceResult:TR_flFractionflFraction)
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                {
                    return 
true
                
}
            }
        }
    }
}
return 
false
}

stock turn_to_target(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3])
{
if(
target)
{
    new 
Float:newAngle[3]
    
entity_get_vector(entEV_VEC_anglesnewAngle)
    new 
Float:Vic_Origin[0] - Ent_Origin[0]
    new 
Float:Vic_Origin[1] - Ent_Origin[1]
    
    new 
Float:radians floatatan(z/xradian)
    
newAngle[1] = radians * (180 3.14)
    if (
Vic_Origin[0] < Ent_Origin[0])
        
newAngle[1] -= 180.0
        
        entity_set_vector
(entEV_VEC_anglesnewAngle)
    }
}

stock hook_ent(entvictimFloat:speed)
{
    static 
Float:fl_Velocity[3]
    static 
Float:VicOrigin[3], Float:EntOrigin[3]
    
    
pev(entpev_originEntOrigin)
    
pev(victimpev_originVicOrigin)
    
    static 
Float:distance_f
    distance_f 
get_distance_f(EntOriginVicOrigin)
    
    if (
distance_f 10.0)
    {
        new 
Float:fl_Time distance_f speed
        
        fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
    
} else
{
    
fl_Velocity[0] = 0.0
    fl_Velocity
[1] = 0.0
    fl_Velocity
[2] = 0.0
}

entity_set_vector(entEV_VEC_velocityfl_Velocity)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/ 
2. Balrog-III:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include <zmvip> 

#define PLUGIN "Balrog-III"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define V_MODEL "models/v_balrog3.mdl"
#define P_MODEL "models/p_balrog3.mdl"
#define W_MODEL "models/w_balrog3.mdl"

#define DAMAGE 48
#define BPAMMO 240
#define ACTIVE_CLIP 15

#define CSW_BALROG3 CSW_MP5NAVY
#define weapon_balrog3 "weapon_mp5navy"

#define WEAPON_SECRETCODE 4962
#define WEAPON_EVENT "events/mp5n.sc"
#define OLD_W_MODEL "models/w_mp5.mdl"

new const Balrog3_Sounds[6][] =
{
"weapons/balrig3-1.wav",
"weapons/balrig3-2.wav",
"weapons/balrig3_boltpull.wav",
"weapons/balrig3_clipin.wav",
"weapons/balrig3_clipout.wav",
"weapons/balrig3_draw.wav"
}

#define EXPLOSE_SPR "sprites/balrog5stack.spr"

enum
{
ANIM_IDLE 0,
ANIM_DRAW,
ANIM_RELOAD,
ANIM_SHOOT_A,
ANIM_SHOOT_B
}

new 
g_Balrog3
new g_Had_Balrog3[33], g_Shoot_Special[33], g_Holding_Attack[33], g_Shoot_Count[33], g_Old_Weapon[33], g_Current_Weapon[33]
new 
g_Exp_SprIdg_balrog3_eventg_ShellIdg_SmokePuff_SprId

public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)

register_event("CurWeapon""Event_CurWeapon""be""1=1")

register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)   
register_forward(FM_PlaybackEvent"fw_PlaybackEvent"
register_forward(FM_SetModel"fw_SetModel")
register_forward(FM_CmdStart"fw_CmdStart")           

RegisterHam(Ham_TraceAttack"worldspawn""fw_TraceAttack")
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack")       
RegisterHam(Ham_Weapon_PrimaryAttackweapon_balrog3"fw_Weapon_PrimaryAttack")
RegisterHam(Ham_Weapon_PrimaryAttackweapon_balrog3"fw_Weapon_PrimaryAttack_Post"1)
RegisterHam(Ham_Item_AddToPlayerweapon_balrog3"fw_Item_AddToPlayer_Post"1)

register_clcmd("admin_get_balrog3""Get_Balrog3"ADMIN_BAN)
}

public 
plugin_precache()
{
engfunc(EngFunc_PrecacheModelV_MODEL)
engfunc(EngFunc_PrecacheModelP_MODEL)
engfunc(EngFunc_PrecacheModelW_MODEL)

for(new 
0sizeof(Balrog3_Sounds); i++)
engfunc(EngFunc_PrecacheSoundBalrog3_Sounds[i])

g_Exp_SprId engfunc(EngFunc_PrecacheModelEXPLOSE_SPR)
g_SmokePuff_SprId engfunc(EngFunc_PrecacheModel"sprites/wall_puff1.spr")
g_ShellId engfunc(EngFunc_PrecacheModel"models/pshell.mdl")

register_forward(FM_PrecacheEvent"fw_PrecacheEvent_Post"1)
g_Balrog3 zv_register_extra_item("Balrog-III""VIP only"25ZV_TEAM_HUMAN)
}

public 
fw_PrecacheEvent_Post(type, const name[])
{
if(
equal(WEAPON_EVENTname))
    
g_balrog3_event get_orig_retval()            
}

public 
zv_extra_item_selected(iditemid)
{
    if(
itemid == g_Balrog3Get_Balrog3(id)
}

public 
zp_user_infected_post(idRemove_Balrog3(id)
public 
zp_user_humanized_post(idRemove_Balrog3(id)

public 
Get_Balrog3(id)
{
    if(!
is_user_alive(id))
        return
    
    
g_Had_Balrog3[id] = 1
    g_Shoot_Special
[id] = 0
    g_Holding_Attack
[id] = 0
    g_Shoot_Count
[id] = 0
    
    fm_give_item
(idweapon_balrog3)
    
    
cs_set_user_bpammo(idCSW_BALROG3BPAMMO)
}

public 
Remove_Balrog3(id)
{
    if(!
is_user_connected(id))
        return
    
    
g_Had_Balrog3[id] = 0
    g_Shoot_Special
[id] = 0
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return
    
    if(
get_user_weapon(id) != g_Current_Weapon[id]) g_Current_Weapon[id] = get_user_weapon(id)
    
    if(
get_user_weapon(id) == CSW_BALROG3 && g_Had_Balrog3[id])
    {
        if(
g_Old_Weapon[id] != CSW_BALROG3)
        {
            
set_pev(idpev_viewmodel2V_MODEL)
            
set_pev(idpev_weaponmodel2P_MODEL)
        }
    }
    
    
g_Old_Weapon[id] = get_user_weapon(id)
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED   
    
if(get_user_weapon(id) == CSW_BALROG3 && g_Had_Balrog3[id])
        
set_cd(cd_handleCD_flNextAttackget_gametime() + 0.001)
    
    return 
FMRES_HANDLED
}

public 
fw_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if (!
is_user_connected(invoker))
        return 
FMRES_IGNORED   
    
if(get_user_weapon(invoker) != CSW_BALROG3 || !g_Had_Balrog3[invoker])
        return 
FMRES_IGNORED
    
if(eventid != g_balrog3_event)
        return 
FMRES_IGNORED
    
    engfunc
(EngFunc_PlaybackEventflags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    
    if(!
g_Shoot_Special[invoker] && cs_get_user_bpammo(invokerCSW_BALROG3) > 0)
    {
        
g_Shoot_Count[invoker]++
        if(
g_Shoot_Count[invoker] >= ACTIVE_CLIP)
        {
            
g_Shoot_Special[invoker] = 1
            
            
static EntEnt fm_get_user_weapon_entity(invokerCSW_BALROG3)
            if(
pev_valid(Ent)) g_Shoot_Count[invoker] = cs_get_weapon_ammo(Ent)
        }
        } else if(
g_Shoot_Special[invoker]) {
        
cs_set_user_bpammo(invokerCSW_BALROG3cs_get_user_bpammo(invokerCSW_BALROG3) - 1)
        
        if(
cs_get_user_bpammo(invokerCSW_BALROG3) <= 0)
        {
            
g_Shoot_Special[invoker] = 0
            g_Shoot_Count
[invoker] = 0
        
}
    }
    
    
set_weapon_anim(invokerg_Shoot_Special[invoker] == ANIM_SHOOT_B ANIM_SHOOT_A)
    
emit_sound(invokerCHAN_WEAPONg_Shoot_Special[invoker] == Balrog3_Sounds[1] : Balrog3_Sounds[0], VOL_NORMATTN_NORM0PITCH_NORM)
    
    
Eject_Shell(invokerg_ShellId0.0)
    
    return 
FMRES_SUPERCEDE
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED
    
    
static Classname[32]
    
pev(entitypev_classnameClassnamesizeof(Classname))
    
    if(!
equal(Classname"weaponbox"))
        return 
FMRES_IGNORED
    
    
static iOwner
    iOwner 
pev(entitypev_owner)
    
    if(
equal(modelOLD_W_MODEL))
    {
        static 
weaponweapon fm_find_ent_by_owner(-1weapon_balrog3entity)
        
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED;
        
        if(
g_Had_Balrog3[iOwner])
        {
            
Remove_Balrog3(iOwner)
            
            
set_pev(weaponpev_impulseWEAPON_SECRETCODE)
            
engfunc(EngFunc_SetModelentityW_MODEL)
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED;
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id))
        return
    if(
g_Current_Weapon[id] != CSW_BALROG3 || !g_Had_Balrog3[id])
        return
    
    static 
NewButtonNewButton get_uc(uc_handleUC_Buttons)
    static 
OldButtonOldButton pev(idpev_oldbuttons)
    
    if(
NewButton IN_ATTACK)
    {
        if(!
g_Holding_Attack[id]) g_Holding_Attack[id] = 1
        
} else if((NewButton IN_ATTACK2) && !(OldButton IN_ATTACK2)) {
        if(
cs_get_user_zoom(id) == 1cs_set_user_zoom(idCS_SET_AUGSG552_ZOOM1)
        else 
cs_set_user_zoom(idCS_SET_NO_ZOOM1)
        } else {
        if(
OldButton IN_ATTACK)
        {
            if(
g_Holding_Attack[id])
            {
                
g_Holding_Attack[id] = 0
                g_Shoot_Count
[id] = 0
                g_Shoot_Special
[id] = 0
            
}
        }
    }
}

public 
fw_TraceAttack(VictimAttackerFloat:DamageFloat:Direction[3], PtrDamageBits)
{
    if(!
is_user_alive(Attacker))
        return 
HAM_IGNORED     
    
if(get_user_weapon(Attacker) != CSW_BALROG3 || !g_Had_Balrog3[Attacker])
        return 
HAM_IGNORED
    
    
static Float:flEnd[3], Float:vecPlane[3]
    
    
get_tr2(PtrTR_vecEndPosflEnd)
    
get_tr2(PtrTR_vecPlaneNormalvecPlane)              
    
    if(!
is_user_alive(Victim))
    {
        
Make_BulletHole(AttackerflEndDamage)
        
Make_BulletSmoke(AttackerPtr)
    }
    
    if(
g_Shoot_Special[Attacker])
    {
        
Make_BalrogEffect(AttackerPtr)
        
radius_damage(AttackerflEndfloat(DAMAGE), 96.0)
    }
    
    
SetHamParamFloat(3float(DAMAGE))
    
    return 
HAM_IGNORED
}

public 
fw_Weapon_PrimaryAttack(Ent)
{
    if(!
pev_valid(Ent))
        return
    static 
IdId pev(Entpev_owner)
    if(!
g_Had_Balrog3[Id])
        return
    
    if(
g_Shoot_Special[Id]) set_pdata_float(Ent620.44)
    else 
set_pdata_float(Ent620.24)
}

public 
fw_Weapon_PrimaryAttack_Post(Ent)
{
    if(!
pev_valid(Ent))
        return
    static 
IdId pev(Entpev_owner)
    if(!
g_Had_Balrog3[Id])
        return
    
    if(
g_Shoot_Special[Id] && cs_get_weapon_ammo(Ent) > 0)
    {
        
cs_set_weapon_ammo(Entg_Shoot_Count[Id])
        
set_pdata_float(Ent46get_pdata_float(Ent464) * 0.754)
    }
}

public 
fw_Item_AddToPlayer_Post(entid)
{
    if(!
pev_valid(ent))
        return 
HAM_IGNORED
    
    
if(pev(entpev_impulse) == WEAPON_SECRETCODE)
    {
        
g_Had_Balrog3[id] = 1
        set_pev
(entpev_impulse0)
    }              
    
    return 
HAM_HANDLED     
}

stock Make_BulletHole(idFloat:Origin[3], Float:Damage)
{
    
// Find target
    
static DecalDecal random_num(4145)
    static 
LoopTime;
    
    if(
Damage 100.0LoopTime 2
    
else LoopTime 1
    
    
for(new 0LoopTimei++)
    {
        
// Put decal on "world" (a wall)
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
engfunc(EngFunc_WriteCoordOrigin[0])
        
engfunc(EngFunc_WriteCoordOrigin[1])
        
engfunc(EngFunc_WriteCoordOrigin[2])
        
write_byte(Decal)
        
message_end()
        
        
// Show sparcles
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GUNSHOTDECAL)
        
engfunc(EngFunc_WriteCoordOrigin[0])
        
engfunc(EngFunc_WriteCoordOrigin[1])
        
engfunc(EngFunc_WriteCoordOrigin[2])
        
write_short(id)
        
write_byte(Decal)
        
message_end()
    }
}

public 
Make_BulletSmoke(idTrResult)
{
    static 
Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
    
    get_weapon_attachment
(idvecSrc)
    
global_get(glb_v_forwardvecEnd)
    
    
xs_vec_mul_scalar(vecEnd8192.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
get_tr2(TrResultTR_vecEndPosvecSrc)
    
get_tr2(TrResultTR_vecPlaneNormalvecEnd)
    
    
xs_vec_mul_scalar(vecEnd2.5vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    engfunc
(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordvecEnd[0])
    
engfunc(EngFunc_WriteCoordvecEnd[1])
    
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
    
write_short(g_SmokePuff_SprId)
    
write_byte(2)
    
write_byte(50)
    
write_byte(TE_FLAG)
    
message_end()
}

public 
Make_BalrogEffect(idTrResult)
{
    static 
Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
    
    get_weapon_attachment
(idvecSrc)
    
global_get(glb_v_forwardvecEnd)
    
    
xs_vec_mul_scalar(vecEnd8192.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
get_tr2(TrResultTR_vecEndPosvecSrc)
    
get_tr2(TrResultTR_vecPlaneNormalvecEnd)
    
    
xs_vec_mul_scalar(vecEnd5.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    engfunc
(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordvecEnd[0])
    
engfunc(EngFunc_WriteCoordvecEnd[1])
    
engfunc(EngFunc_WriteCoordvecEnd[2])
    
write_short(g_Exp_SprId)
    
write_byte(5)
    
write_byte(30)
    
write_byte(TE_FLAG)
    
message_end()
}

stock get_weapon_attachment(idFloat:output[3], Float:fDis 40.0)
{
    new 
Float:vfEnd[3], viEnd[3]
    
get_user_origin(idviEnd3)  
    
IVecFVec(viEndvfEnd)
    
    new 
Float:fOrigin[3], Float:fAngle[3]
    
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfAngle)
    
    
xs_vec_add(fOriginfAnglefOrigin)
    
    new 
Float:fAttack[3]
    
    
xs_vec_sub(vfEndfOriginfAttack)
    
xs_vec_sub(vfEndfOriginfAttack)
    
    new 
Float:fRate
    
    fRate 
fDis vector_length(fAttack)
    
xs_vec_mul_scalar(fAttackfRatefAttack)
    
    
xs_vec_add(fOriginfAttackoutput)
}

stock radius_damage(idFloat:Origin[3], Float:DamageFloat:Radius)
{
    static 
VictimVictim = -1
    
    
while((Victim engfunc(EngFunc_FindEntityInSphereVictimOriginRadius)) != 0)
    {
        if(!
is_user_alive(Victim) || id == Victim)
            continue
        if(!
zp_get_user_zombie(Victim))
            continue
        
        
ExecuteHamB(Ham_TakeDamageVictimfm_get_user_weapon_entity(idget_user_weapon(id)), idDamageDMG_BULLET)
    }
}

stock Eject_Shell(idShell_ModelIndexFloat:Time// By Dias
{
    static 
EntEnt get_pdata_cbase(id3735)
    if(!
pev_valid(Ent))
        return
    
    
set_pdata_int(Ent57Shell_ModelIndex4)
    
set_pdata_float(id111get_gametime() + Time)
}

stock set_weapon_anim(idanim)
{
    if(!
is_user_alive(id))
        return
    
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()

3. Thunder Bolt:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <zombieplague>
#include <zmvip>  

#define PLUGIN "[CSO] Thunderbolt"
#define VERSION "3.0"
#define AUTHOR "Dias"

#define DAMAGE 600
#define DEFAULT_AMMO 20
#define RELOAD_TIME 2.67

#define DELAY_SOUND 0.25

#define CSW_THUNDERBOLT CSW_AWP
#define weapon_thunderbolt "weapon_awp"
#define old_event "events/awp.sc"
#define old_w_model "models/w_awp.mdl"
#define WEAPON_SECRETCODE 4234234

#define V_MODEL "models/v_sfsniper2.mdl"
#define P_MODEL "models/p_sfsniper.mdl"
#define W_MODEL "models/w_sfsniper.mdl"

new const WeaponSounds[5][] =
{
"weapons/sfsniper-1.wav",
"weapons/sfsniper_insight1.wav",
"weapons/sfsniper_zoom.wav",
"weapons/sfsniper_idle.wav",
"weapons/sfsniper_draw.wav"
}

new const 
WeaponResources[4][] =
{
"sprites/weapon_sfsniper.txt",
"sprites/640hud2_2.spr",
"sprites/640hud10_2.spr",
"sprites/640hud81_2.spr"
}

enum
{
TB_ANIM_IDLE 0,
TB_ANIM_SHOOT,
TB_ANIM_DRAW
}

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

new g_Thunderbolt
new g_Had_Thunderboltg_Zoomedg_Aim_HudId
new Float:g_TargetOrigin[3], Float:CheckDelay[33]
new 
g_Msg_CurWeapong_Msg_AmmoX
new g_Beam_SprIdg_Smoke_SprIdg_HamBot_Registerg_Event_Thunderbolt

public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)

register_event("CurWeapon""Event_CurWeapon""be""1=1")

register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)   
register_forward(FM_PlaybackEvent"fw_PlaybackEvent")         
register_forward(FM_SetModel"fw_SetModel")
register_forward(FM_CmdStart"fw_CmdStart")

RegisterHam(Ham_TraceAttack"player""fw_TraceAttack_Player")
RegisterHam(Ham_TraceAttack"worldspawn""fw_TraceAttack_World")

RegisterHam(Ham_Item_AddToPlayerweapon_thunderbolt"fw_AddToPlayer_Post"1)
RegisterHam(Ham_Item_Deployweapon_thunderbolt"fw_Item_Deploy_Post"1)

g_Msg_CurWeapon get_user_msgid("CurWeapon")
g_Msg_AmmoX get_user_msgid("AmmoX")

g_Aim_HudId CreateHudSyncObj(8)

register_clcmd("admin_get_thunderbolt""get_thunderbolt"ADMIN_BAN)
register_clcmd("weapon_sfsniper""CLCMD_HookWeapon")
}

public 
plugin_precache()
{
precache_model(V_MODEL)
precache_model(P_MODEL)
precache_model(W_MODEL)

for(new 
0sizeof(WeaponSounds); i++)
engfunc(EngFunc_PrecacheSoundWeaponSounds[i])
for(new 
0sizeof(WeaponResources); i++)
{
if(
== 0engfunc(EngFunc_PrecacheGenericWeaponResources[0])
else 
engfunc(EngFunc_PrecacheModelWeaponResources[i])
}

g_Beam_SprId =  engfunc(EngFunc_PrecacheModel"sprites/laserbeam.spr")
g_Smoke_SprId engfunc(EngFunc_PrecacheModel"sprites/wall_puff1.spr")

register_forward(FM_PrecacheEvent"fw_PrecacheEvent_Post"1
g_Thunderbolt zv_register_extra_item("Thunderbolt""VIP only"30ZV_TEAM_HUMAN)  
}

public 
client_putinserver(id)
{
if(
is_user_bot(id) && !g_HamBot_Register)
{
g_HamBot_Register 1
set_task
(0.1"Do_RegisterHamBot"id)
}
}

public 
Do_RegisterHamBot(id)
{
RegisterHamFromEntity(Ham_TraceAttackid"fw_TraceAttack_Player")
}

public 
fw_PrecacheEvent_Post(type, const name[])
{
if(
equal(old_eventname)) g_Event_Thunderbolt get_orig_retval()
}

public 
zv_extra_item_selected(idItemID)
{
if(
ItemID == g_Thunderboltget_thunderbolt(id)
}

public 
zp_user_infected_post(idRemove_Thunderbolt(id)

public 
get_thunderbolt(id)
{
Set_BitVar(g_Had_Thunderboltid)
UnSet_BitVar(g_Zoomedid)

fm_give_item(idweapon_thunderbolt)

static 
weapon_entweapon_ent fm_find_ent_by_owner(-1weapon_thunderboltid)
if(
pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent1)

cs_set_user_bpammo(idCSW_THUNDERBOLTDEFAULT_AMMO)
}

public 
Remove_Thunderbolt(id)
{
UnSet_BitVar(g_Had_Thunderboltid)
UnSet_BitVar(g_Zoomedid)
}

public 
Event_CurWeapon(id)
{
static 
CSWIDCSWID read_data(2)
if(
CSWID != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltid))
return

if(
cs_get_user_zoom(id) > && !Get_BitVar(g_Zoomedid)) // Zoom
{
    
set_pev(idpev_viewmodel2"")
    
Set_BitVar(g_Zoomedid)
    } else { 
// Not Zoom
    
set_pev(idpev_viewmodel2V_MODEL)
    
UnSet_BitVar(g_Zoomedid)
}

UpdateAmmo(id, -1cs_get_user_bpammo(idCSW_THUNDERBOLT))
}

public 
CLCMD_HookWeapon(id)
{
engclient_cmd(idweapon_thunderbolt)
return
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
if(!
is_user_alive(id))
    return 
FMRES_IGNORED   
    
if(get_user_weapon(id) == CSW_THUNDERBOLT && Get_BitVar(g_Had_Thunderboltid))
        
set_cd(cd_handleCD_flNextAttackget_gametime() + 0.001)
    
    return 
FMRES_HANDLED
}

public 
fw_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if(
eventid != g_Event_Thunderbolt)
        return 
FMRES_IGNORED
    
if (!is_user_alive(invoker))
        return 
FMRES_IGNORED           
    
if(get_user_weapon(invoker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltinvoker))
        return 
FMRES_IGNORED
    
    engfunc
(EngFunc_PlaybackEventflags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    
Thunderbolt_Shooting(invoker)
    
    return 
FMRES_SUPERCEDE
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED
    
    
static Classname[64]
    
pev(entitypev_classnameClassnamesizeof(Classname))
    
    if(!
equal(Classname"weaponbox"))
        return 
FMRES_IGNORED
    
    
static id
    id 
pev(entitypev_owner)
    
    if(
equal(modelold_w_model))
    {
        static 
weapon
        weapon 
fm_get_user_weapon_entity(entityCSW_THUNDERBOLT)
        
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED
        
        
if(Get_BitVar(g_Had_Thunderboltid))
        {
            
UnSet_BitVar(g_Had_Thunderboltid)
            
            
set_pev(weaponpev_impulseWEAPON_SECRETCODE)
            
set_pev(weaponpev_iuser4cs_get_user_bpammo(idCSW_THUNDERBOLT))
            
            
engfunc(EngFunc_SetModelentityW_MODEL)
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED;
}

public 
fw_CmdStart(idUcHandleSeed)
{
    if(!
is_user_alive(id))
        return
    if(
get_user_weapon(id) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltid))
        return
    if(
cs_get_user_zoom(id) <= 1)
        return
    
    if(
get_gametime() - DELAY_SOUND CheckDelay[id])
    {
        static 
BodyTarget
        get_user_aiming
(idTargetBody99999)
        
        if(
is_user_alive(Target))
        {
            
emit_sound(idCHAN_WEAPONWeaponSounds[1], VOL_NORMATTN_NORM0PITCH_NORM)
            
            
set_hudmessage(25000, -1.0, -1.000.10.1)
            
ShowSyncHudMsg(idg_Aim_HudId"+")
        }
        
        
CheckDelay[id] = get_gametime()
    }
}

public 
Thunderbolt_Shooting(id)
{
    
set_weapon_anim(idTB_ANIM_SHOOT)
    
emit_sound(idCHAN_WEAPONWeaponSounds[0], VOL_NORMATTN_NORM0PITCH_NORM)
    
    static 
AmmoAmmo cs_get_user_bpammo(idCSW_THUNDERBOLT)
    
    
Ammo--
    
UpdateAmmo(id, -1Ammo)
    
    if(
Ammo <= 0)
    {
        static 
EntEnt fm_get_user_weapon_entity(idCSW_THUNDERBOLT)
        if(
pev_valid(Ent)) cs_set_weapon_ammo(Ent0)
        
        
cs_set_user_bpammo(idCSW_THUNDERBOLT0)
    }
    
    
Create_Laser(idg_TargetOrigin)
    
    
// Fixed Shell Eject
    
set_pdata_float(id11199999999.05)
    
    
// Next Attack
    
Set_Player_NextAttack(idCSW_THUNDERBOLTRELOAD_TIME)
}

public 
Create_Laser(idFloat:End[3])
{
    static 
Float:Start[3]
    
Stock_Get_Postion(id50.05.0, -5.0Start)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordStart[0])
    
engfunc(EngFunc_WriteCoordStart[1])
    
engfunc(EngFunc_WriteCoordStart[2])
    
engfunc(EngFunc_WriteCoordEnd[0])
    
engfunc(EngFunc_WriteCoordEnd[1])
    
engfunc(EngFunc_WriteCoordEnd[2])
    
write_short(g_Beam_SprId)
    
write_byte(0)
    
write_byte(0)
    
write_byte(10)
    
write_byte(25)
    
write_byte(0)
    
write_byte(0)
    
write_byte(0)
    
write_byte(200)
    
write_byte(200)
    
write_byte(0)
    
message_end()  
}

public 
fw_AddToPlayer_Post(entid)
{
    if(
pev(entpev_impulse) == WEAPON_SECRETCODE)
    {
        
Set_BitVar(g_Had_Thunderboltid)
        
cs_set_user_bpammo(idCSW_THUNDERBOLTpev(entpev_iuser4))
        
        
set_pev(entpev_impulse0)
    }                      
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
    
write_string((Get_BitVar(g_Had_Thunderboltid) ? "weapon_sfsniper" "weapon_awp"))
    
write_byte(1)
    
write_byte(30)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(2)
    
write_byte(CSW_THUNDERBOLT)
    
write_byte(0)
    
message_end()
}

public 
fw_TraceAttack_Player(entattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(attacker))
        return 
HAM_IGNORED     
    
if(get_user_weapon(attacker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltattacker))
        return 
HAM_IGNORED
    
    get_tr2
(ptrTR_vecEndPosg_TargetOrigin)
    
SetHamParamFloat(3float(DAMAGE))
    
    return 
HAM_HANDLED
}

public 
fw_TraceAttack_World(entattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(attacker))
        return 
HAM_IGNORED     
    
if(get_user_weapon(attacker) != CSW_THUNDERBOLT || !Get_BitVar(g_Had_Thunderboltattacker))
        return 
HAM_IGNORED
    
    get_tr2
(ptrTR_vecEndPosg_TargetOrigin)
    
Make_WorldHitEffect(attackerptr)
    
    
SetHamParamFloat(3float(DAMAGE))
    
    return 
HAM_HANDLED
}

public 
fw_Item_Deploy_Post(Ent)
{
    if(!
pev_valid(Ent))
        return
    
    static 
IdId get_pdata_cbase(Ent414)
    if(!
Get_BitVar(g_Had_ThunderboltId))
        return
    
    
UnSet_BitVar(g_ZoomedId)
    
    
set_pev(Idpev_viewmodel2V_MODEL)
    
set_pev(Idpev_weaponmodel2P_MODEL
    
    
set_weapon_anim(IdTB_ANIM_DRAW)
}

public 
UpdateAmmo(IdAmmoBpAmmo)
{
    static 
weapon_entweapon_ent fm_get_user_weapon_entity(IdCSW_THUNDERBOLT)
    if(
pev_valid(weapon_ent))
    {
        if(
BpAmmo 0cs_set_weapon_ammo(weapon_ent1)
        else 
cs_set_weapon_ammo(weapon_ent0)
    }
    
    
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEg_Msg_CurWeapon, {000}, Id)
    
write_byte(1)
    
write_byte(CSW_THUNDERBOLT)
    
write_byte(-1)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_Msg_AmmoX_Id)
    
write_byte(1)
    
write_byte(BpAmmo)
    
message_end()
    
    
cs_set_user_bpammo(IdCSW_THUNDERBOLTBpAmmo)
}

public 
Make_WorldHitEffect(idTrResult)
{
    
// Handle First
    
static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
    
    get_weapon_attachment
(idvecSrc)
    
global_get(glb_v_forwardvecEnd)
    
    
xs_vec_mul_scalar(vecEnd8192.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
get_tr2(TrResultTR_vecEndPosvecSrc)
    
get_tr2(TrResultTR_vecPlaneNormalvecEnd)
    
    
xs_vec_mul_scalar(vecEnd2.5vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    
// Make Spark
    
for(new 03i++)
    {
        
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
        
write_byte(TE_SPARKS)
        
engfunc(EngFunc_WriteCoordvecEnd[0])
        
engfunc(EngFunc_WriteCoordvecEnd[1])
        
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
        
message_end()
    }
    
    
// Make Smoke
    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordvecEnd[0])
    
engfunc(EngFunc_WriteCoordvecEnd[1])
    
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
    
write_short(g_Smoke_SprId)
    
write_byte(2)
    
write_byte(50)
    
write_byte(TE_FLAG)
    
message_end()  
}

stock set_weapon_anim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock Stock_Get_Postion(id,Float:forw,Float:rightFloat:up,Float:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock get_weapon_attachment(idFloat:output[3], Float:fDis 40.0)
{
    static 
Float:vfEnd[3], viEnd[3]
    
get_user_origin(idviEnd3)  
    
IVecFVec(viEndvfEnd)
    
    static 
Float:fOrigin[3], Float:fAngle[3]
    
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfAngle)
    
    
xs_vec_add(fOriginfAnglefOrigin)
    
    static 
Float:fAttack[3]
    
    
xs_vec_sub(vfEndfOriginfAttack)
    
xs_vec_sub(vfEndfOriginfAttack)
    
    static 
Float:fRate
    
    fRate 
fDis vector_length(fAttack)
    
xs_vec_mul_scalar(fAttackfRatefAttack)
    
    
xs_vec_add(fOriginfAttackoutput)
}

stock Set_Player_NextAttack(idCSWIDFloat:NextTime)
{
    static 
EntEnt fm_get_user_weapon_entity(idCSWID)
    if(!
pev_valid(Ent)) return
    
    
set_pdata_float(id83NextTime5)
    
    
set_pdata_float(Ent46 NextTime4)
    
set_pdata_float(Ent47NextTime4)
    
set_pdata_float(Ent48NextTime4)

4. Gatling:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include <zmvip> 

#define PLUGIN "Gatling"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define CSW_GATLING CSW_M3
#define weapon_gatling "weapon_m3"
#define WEAPON_ANIMEXT "m249"
#define DEFAULT_W_MODEL "models/w_m3.mdl"
#define WEAPON_SECRET_CODE 1942
#define old_event "events/m3.sc"

#define DAMAGE 48
#define SPEED 0.25
#define RECOIL 0.5
#define RELOAD_TIME 4.5
#define DEFAULT_CLIP 40
#define DEFAULT_BPAMMO 180

new const WeaponModel[3][] =
{
"models/v_gatling.mdl"// V
"models/p_gatling.mdl"// P
"models/w_gatling.mdl" // W
}

new const 
WeaponSound[7][] =
{
"weapons/gatling-1.wav",
"weapons/gatling_boltpull.wav",
"weapons/gatling_clipin1.wav",
"weapons/gatling_clipin2.wav",
"weapons/gatling_clipout1.wav",
"weapons/gatling_clipout2.wav",
"weapons/usas_draw.wav"
}

new const 
WeaponResource[4][] =
{
"sprites/weapon_gatling.txt",
"sprites/640hud7_2.spr",
"sprites/640hud55_2.spr",
"sprites/640hud56_2.spr"
}

enum
{
GATLING_ANIM_IDLE 0,
GATLING_ANIM_SHOOT1,
GATLING_ANIM_SHOOT2,
GATLING_ANIM_RELOAD,
GATLING_ANIM_DRAW
}

const 
PDATA_SAFE 2
const OFFSET_LINUX_WEAPONS 4
const OFFSET_LINUX_PLAYER 5
const OFFSET_WEAPONOWNER 41
const m_iClip 51
const m_fInReload 54
const m_flNextAttack 83
const m_szAnimExtention 492

new g_gatling
new g_had_gatling[33], Float:g_punchangles[33][3], g_gatling_eventg_smokepuff_idm_iBlood[2], g_ham_bot

public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)

register_event("CurWeapon""Event_CurWeapon""be""1=1")

register_forward(FM_CmdStart"fw_CmdStart")
register_forward(FM_SetModel"fw_SetModel")
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)
register_forward(FM_PlaybackEvent"fw_PlaybackEvent"

RegisterHam(Ham_TraceAttack"worldspawn""fw_TraceAttack")
RegisterHam(Ham_TraceAttack"player""fw_TraceAttack")               

RegisterHam(Ham_Item_Deployweapon_gatling"fw_Item_Deploy_Post"1)
RegisterHam(Ham_Weapon_Reloadweapon_gatling"fw_Weapon_Reload_Post"1)
RegisterHam(Ham_Item_PostFrameweapon_gatling"fw_Item_PostFrame")
RegisterHam(Ham_Item_AddToPlayerweapon_gatling"fw_Item_AddToPlayer_Post"1)
RegisterHam(Ham_Weapon_PrimaryAttackweapon_gatling"fw_Weapon_PrimaryAttack")
RegisterHam(Ham_Weapon_PrimaryAttackweapon_gatling"fw_Weapon_PrimaryAttack_Post"1)

register_clcmd("weapon_gatling""hook_weapon")
register_clcmd("admin_get_gatling""get_gatling"ADMIN_BAN)
}

public 
plugin_precache()
{
new 
i

for(0sizeof(WeaponModel); i++)
engfunc(EngFunc_PrecacheModelWeaponModel[i])
for(
0sizeof(WeaponSound); i++)
engfunc(EngFunc_PrecacheSoundWeaponSound[i])
for(new 
0sizeof(WeaponResource); i++)
{
if(
== 0engfunc(EngFunc_PrecacheGenericWeaponResource[i])
else 
engfunc(EngFunc_PrecacheModelWeaponResource[i])
}

g_smokepuff_id engfunc(EngFunc_PrecacheModel"sprites/wall_puff1.spr")
m_iBlood[0] = engfunc(EngFunc_PrecacheModel"sprites/blood.spr")
m_iBlood[1] = engfunc(EngFunc_PrecacheModel"sprites/bloodspray.spr")         

register_forward(FM_PrecacheEvent"fw_PrecacheEvent_Post"1
g_gatling zv_register_extra_item("Gatling""VIP only"20ZV_TEAM_HUMAN)  
}

public 
fw_PrecacheEvent_Post(type, const name[])
{
if(
equal(old_eventname))
g_gatling_event get_orig_retval()
}

public 
client_putinserver(id)
{
if(
is_user_bot(id) && !g_ham_bot)
{
    
g_ham_bot 1
    set_task
(0.1"Do_Register_Ham"id)
}
}

public 
Do_Register_Ham(id)
{
RegisterHamFromEntity(Ham_TraceAttackid"fw_TraceAttack")   
}

public 
zv_extra_item_selected(iditemid)
{
if(
itemid == g_gatlingget_gatling(id)
}

public 
zp_user_infected_post(id)
{
remove_gatling(id)
}

public 
zp_user_humanized_post(id)
{
remove_gatling(id)
}

public 
zp_round_ended()
{
for(new 
0get_maxplayers(); i++)
{
    if(!
is_user_connected(i))
        continue
        
        
remove_gatling(i)
    }
}

public 
get_gatling(id)
{
    if(!
is_user_alive(id))
        return
    
    
drop_weapons(id1)
    
    
g_had_gatling[id] = 1
    fm_give_item
(idweapon_gatling)
    
    
// Set Clip
    
static entent fm_get_user_weapon_entity(idCSW_GATLING)
    if(
pev_valid(ent)) cs_set_weapon_ammo(entDEFAULT_CLIP)
    
    
// Set BpAmmo
    
cs_set_user_bpammo(idCSW_GATLINGDEFAULT_BPAMMO)
    
    
// Update Ammo
    
update_ammo(idCSW_GATLINGDEFAULT_CLIPDEFAULT_BPAMMO)
}

public 
remove_gatling(id)
{
    
g_had_gatling[id] = 0
}

public 
hook_weapon(id)
{
    
client_cmd(idweapon_gatling)
    return 
PLUGIN_HANDLED
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return
    if(
get_user_weapon(id) != CSW_GATLING || !g_had_gatling[id])
        return
    
    
// Speed
    
static entent fm_get_user_weapon_entity(idCSW_GATLING)
    if(!
pev_valid(ent))
        return
    
    
set_pdata_float(ent46get_pdata_float(ent46OFFSET_LINUX_WEAPONS) * SPEEDOFFSET_LINUX_WEAPONS)
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id))
        return
    if(
get_user_weapon(id) != CSW_GATLING || !g_had_gatling[id])
        return
    
    static 
CurButtonCurButton get_uc(uc_handleUC_Buttons)
    
    if(
CurButton IN_RELOAD)
    {
        
CurButton &= ~IN_RELOAD
        set_uc
(uc_handleUC_ButtonsCurButton)
        
        static 
entent fm_get_user_weapon_entity(idCSW_GATLING)
        if(!
pev_valid(ent)) return
        
        static 
fInReloadfInReload get_pdata_int(entm_fInReloadOFFSET_LINUX_WEAPONS)
        static 
Float:flNextAttackflNextAttack get_pdata_float(idm_flNextAttackOFFSET_LINUX_PLAYER)
        
        if (
flNextAttack 0.0)
            return
        
        if (
fInReload)
        {
            
set_weapon_anim(idGATLING_ANIM_IDLE)
            return
        }
        
        if(
cs_get_weapon_ammo(ent) >= DEFAULT_CLIP)
        {
            
set_weapon_anim(idGATLING_ANIM_IDLE)
            return
        }
        
        
fw_Weapon_Reload_Post(ent)
    }
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED
    
    
static szClassName[33]
    
pev(entitypev_classnameszClassNamecharsmax(szClassName))
    
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
static id
    id 
pev(entitypev_owner)
    
    if(
equal(modelDEFAULT_W_MODEL))
    {
        static 
weapon
        weapon 
fm_find_ent_by_owner(-1weapon_gatlingentity)
        
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED
        
        
if(g_had_gatling[id])
        {
            
set_pev(weaponpev_impulseWEAPON_SECRET_CODE)
            
engfunc(EngFunc_SetModelentityWeaponModel[2])
            
            
remove_gatling(id)
            
            return 
FMRES_SUPERCEDE
        
}
    }
    
    return 
FMRES_IGNORED
}

public 
fw_TraceAttack(entattackerFloat:DamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(attacker))
        return 
HAM_IGNORED     
    
if(get_user_weapon(attacker) != CSW_GATLING || !g_had_gatling[attacker])
        return 
HAM_IGNORED
    
    
if(!is_user_alive(ent))
    {
        static 
Float:flEnd[3], Float:vecPlane[3]
        
        
get_tr2(ptrTR_vecEndPosflEnd)
        
get_tr2(ptrTR_vecPlaneNormalvecPlane)              
        
        
make_bullet(attackerflEnd)
        
fake_smoke(attackerptr)
    }
    
    
SetHamParamFloat(3float(DAMAGE) / random_float(1.52.5))    
    
    return 
HAM_HANDLED
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED
    
if(get_user_weapon(id) != CSW_GATLING || !g_had_gatling[id])
        return 
FMRES_IGNORED
    
    set_cd
(cd_handleCD_flNextAttackget_gametime() + 0.001)
    
    return 
FMRES_HANDLED
}

public 
fw_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if(!
is_user_connected(invoker))
        return 
FMRES_IGNORED   
    
    
if(get_user_weapon(invoker) == CSW_GATLING && g_had_gatling[invoker] && eventid == g_gatling_event)
    {
        
engfunc(EngFunc_PlaybackEventflags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
        
Event_Gatling_Shoot(invoker)   
        
        return 
FMRES_SUPERCEDE
    
}
    
    return 
FMRES_HANDLED
}

public 
fw_Item_Deploy_Post(ent)
{
    static 
idid fm_cs_get_weapon_ent_owner(ent)
    if (!
pev_valid(id))
        return
    
    static 
weaponid
    weaponid 
cs_get_weapon_id(ent)
    
    if(
weaponid != CSW_GATLING)
        return
    if(!
g_had_gatling[id])
        return
    
    
set_pev(idpev_viewmodel2WeaponModel[0])
    
set_pev(idpev_weaponmodel2WeaponModel[1])
    
    
set_weapon_anim(idGATLING_ANIM_DRAW)
    
set_pdata_string(idm_szAnimExtention 4WEAPON_ANIMEXT, -20)
}

public 
fw_Weapon_Reload_Post(ent)
{
    static 
idid pev(entpev_owner)
    
    if(
g_had_gatling[id])
    {
        static 
CurBpAmmoCurBpAmmo cs_get_user_bpammo(idCSW_GATLING)
        
        if(
CurBpAmmo  <= 0)
            return 
HAM_IGNORED
        
        set_pdata_int
(ent550OFFSET_LINUX_WEAPONS)
        
set_pdata_float(id83RELOAD_TIMEOFFSET_LINUX_PLAYER)
        
set_pdata_float(ent48RELOAD_TIME 0.5OFFSET_LINUX_WEAPONS)
        
set_pdata_float(ent46RELOAD_TIME 0.25OFFSET_LINUX_WEAPONS)
        
set_pdata_float(ent47RELOAD_TIME 0.25OFFSET_LINUX_WEAPONS)
        
set_pdata_int(entm_fInReload1OFFSET_LINUX_WEAPONS)
        
        
set_weapon_anim(idGATLING_ANIM_RELOAD)                       
        
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED     
}

public 
fw_Item_PostFrame(ent)
{
    static 
idid pev(entpev_owner)
    if(!
g_had_gatling[id]) return
    
    static 
iBpAmmo iBpAmmo get_pdata_int(id381OFFSET_LINUX_PLAYER)
    static 
iClip iClip get_pdata_int(entm_iClipOFFSET_LINUX_WEAPONS)
    static 
iMaxClip iMaxClip DEFAULT_CLIP
    
    
if(get_pdata_int(entm_fInReloadOFFSET_LINUX_WEAPONS) && get_pdata_float(idm_flNextAttackOFFSET_LINUX_PLAYER) <= 0.0)
    {
        static 
jmin(iMaxClip iClipiBpAmmo)
        
set_pdata_int(entm_iClipiClip jOFFSET_LINUX_WEAPONS)
        
set_pdata_int(id381iBpAmmo-jOFFSET_LINUX_PLAYER)
        
        
set_pdata_int(entm_fInReload0OFFSET_LINUX_WEAPONS)
        
cs_set_weapon_ammo(entDEFAULT_CLIP)
        
        
update_ammo(idCSW_GATLINGcs_get_weapon_ammo(ent), cs_get_user_bpammo(idCSW_GATLING))
        
        return
    }
}

public 
fw_Item_AddToPlayer_Post(entid)
{
    if(!
pev_valid(ent))
        return 
HAM_IGNORED
    
    
if(pev(entpev_impulse) == WEAPON_SECRET_CODE)
    {
        
remove_gatling(id)
        
g_had_gatling[id] = 1
        
        update_ammo
(idCSW_GATLINGcs_get_weapon_ammo(ent), cs_get_user_bpammo(idCSW_GATLING))
    }
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
    
write_string(g_had_gatling[id] == "weapon_gatling" "weapon_m3")
    
write_byte(5)
    
write_byte(200)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(5)
    
write_byte(g_had_gatling[id] == CSW_GATLING CSW_M3)
    
write_byte(0)
    
message_end()                  
    
    return 
HAM_IGNORED
}

public 
fw_Weapon_PrimaryAttack(ent)
{
    static 
idid pev(entpev_owner)
    if(!
g_had_gatling[id])
        return
    
    
pev(idpev_punchangleg_punchangles[id])
}

public 
fw_Weapon_PrimaryAttack_Post(ent)
{
    static 
idid pev(entpev_owner)
    if(!
g_had_gatling[id])
        return
    
    static 
Float:push[3]
    
pev(idpev_punchanglepush)
    
xs_vec_sub(pushg_punchangles[id], push)
    
    
xs_vec_mul_scalar(pushRECOILpush)
    
xs_vec_add(pushg_punchangles[id], push)
    
set_pev(idpev_punchanglepush)      
}

public 
update_ammo(idcsw_idclipbpammo)
{
    if(!
is_user_alive(id))
        return
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("CurWeapon"), _id)
    
write_byte(1)
    
write_byte(csw_id)
    
write_byte(clip)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoX"), _id)
    
write_byte(3)
    
write_byte(bpammo)
    
message_end()
}

public 
Event_Gatling_Shoot(id)
{
    
set_weapon_anim(idrandom_num(GATLING_ANIM_SHOOT1GATLING_ANIM_SHOOT2))
    
emit_sound(idCHAN_WEAPONWeaponSound[0], 1.0ATTN_NORM0PITCH_NORM)
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    if (
pev_valid(ent) != PDATA_SAFE)
        return -
1
    
    
return get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS)
}

stock set_weapon_anim(idanim)
{
    if(!
is_user_alive(id))
        return
    
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM_id)
    
write_byte(anim)
    
write_byte(0)
    
message_end()  
}

stock drop_weapons(iddropwhat)
{
    static 
weapons[32], numiweaponid
    num 
0
    get_user_weapons
(idweaponsnum)
    
    const 
PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
    
    for (
0numi++)
    {
        
weaponid weapons[i]
        
        if (
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
        {
            static 
wname[32]
            
get_weaponname(weaponidwnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }
}


stock make_bullet(idFloat:Origin[3])
{
    
// Find target
    
new decal random_num(4145)
    const 
loop_time 2
    
    
static BodyTarget
    get_user_aiming
(idTargetBody999999)
    
    if(
is_user_connected(Target))
        return
    
    for(new 
0loop_timei++)
    {
        
// Put decal on "world" (a wall)
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
engfunc(EngFunc_WriteCoordOrigin[0])
        
engfunc(EngFunc_WriteCoordOrigin[1])
        
engfunc(EngFunc_WriteCoordOrigin[2])
        
write_byte(decal)
        
message_end()
        
        
// Show sparcles
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GUNSHOTDECAL)
        
engfunc(EngFunc_WriteCoordOrigin[0])
        
engfunc(EngFunc_WriteCoordOrigin[1])
        
engfunc(EngFunc_WriteCoordOrigin[2])
        
write_short(id)
        
write_byte(decal)
        
message_end()
    }
}

public 
fake_smoke(idtrace_result)
{
    static 
Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
    
    get_weapon_attachment
(idvecSrc)
    
global_get(glb_v_forwardvecEnd)
    
    
xs_vec_mul_scalar(vecEnd8192.0vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
get_tr2(trace_resultTR_vecEndPosvecSrc)
    
get_tr2(trace_resultTR_vecPlaneNormalvecEnd)
    
    
xs_vec_mul_scalar(vecEnd2.5vecEnd)
    
xs_vec_add(vecSrcvecEndvecEnd)
    
    
TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG 
|= TE_EXPLFLAG_NOSOUND
    TE_FLAG 
|= TE_EXPLFLAG_NOPARTICLES
    
    engfunc
(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYvecEnd0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordvecEnd[0])
    
engfunc(EngFunc_WriteCoordvecEnd[1])
    
engfunc(EngFunc_WriteCoordvecEnd[2] - 10.0)
    
write_short(g_smokepuff_id)
    
write_byte(2)
    
write_byte(50)
    
write_byte(TE_FLAG)
    
message_end()
}

stock get_weapon_attachment(idFloat:output[3], Float:fDis 40.0)
{
    new 
Float:vfEnd[3], viEnd[3]
    
get_user_origin(idviEnd3)  
    
IVecFVec(viEndvfEnd)
    
    new 
Float:fOrigin[3], Float:fAngle[3]
    
    
pev(idpev_originfOrigin)
    
pev(idpev_view_ofsfAngle)
    
    
xs_vec_add(fOriginfAnglefOrigin)
    
    new 
Float:fAttack[3]
    
    
xs_vec_sub(vfEndfOriginfAttack)
    
xs_vec_sub(vfEndfOriginfAttack)
    
    new 
Float:fRate
    
    fRate 
fDis vector_length(fAttack)
    
xs_vec_mul_scalar(fAttackfRatefAttack)
    
    
xs_vec_add(fOriginfAttackoutput)
}

stock create_blood(const Float:origin[3])
{
    
// Show some blood :)
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoordorigin[0])
    
engfunc(EngFunc_WriteCoordorigin[1])
    
engfunc(EngFunc_WriteCoordorigin[2])
    
write_short(m_iBlood[1])
    
write_short(m_iBlood[0])
    
write_byte(75)
    
write_byte(5)
    
message_end()

zmd94 is offline