Raised This Month: $ Target: $400
 0% 

Help / Support What is wrong wid these codes ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 04-15-2013 , 02:55   What is wrong wid these codes ?
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <zombieplague>




#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""700.0")
    
    
g_at4cs zp_register_extra_item("AT4CS"90ZP_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 
zp_extra_item_selected(iditemid)
{

    if (
get_user_flags(idADMIN_BAN))

  {


    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
}

     return 
PLUGIN_HANDLED

}

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 }
*/ 
And ...

PHP Code:
/*                    [ZP] Addon: Critical Hit
                by !Morte
    
    #Description :
            Make a random critical hit when you are shooting an a enemy
    
    #Cvars : 
            zp_criticalhit_damage "3.0" // Damage Multiplier
            
    #Credits : 
            meTaLiCroSS: From his "custom form" :P
                        abdul-rehman: Help with code.

    #Changelog : 
            v1.0: Plugin Release
            v1.1: Added some sounds and effects
            v1.2: Fixed auto-make a critical hit
*/

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < fun >
#include < zp50_class_zombie >
#include < zp50_gamemodes >
#include < zombieplague >
#include < cs_ham_bots_api >
#include < zp50_class_survivor >
#include < zp50_class_hero >







new cvar_criticaldamage
new gSyncHudgMaxPlayers

#define is_valid_user(%1)        ( 1 <= %1 <= gMaxPlayers && is_user_connected(%1) )



public plugin_init( )
{
    
register_plugin"Critical Hits""1.2""!Morte" )
    
    
cvar_criticaldamage register_cvar"zp_criticalhit_damage""3.0" )
    
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" )

    
RegisterHamBotsHam_TakeDamage"fw_TakeDamage" )
    
    
gSyncHud CreateHudSyncObj( );
    
    
gMaxPlayers get_maxplayers( );
}



public 
fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{
            if( 
attacker == victim || !is_valid_userattacker ) )
            return 
HAM_IGNORED;



            if(!
zp_core_is_zombieattacker ) || !zp_class_survivor_getattacker ) || !zp_class_hero_get attacker ))  {         

   
        
            if( 
random_num0100 ) < random_num0100 ) < random_num0100 ))
            {


            
SetHamParamFloat4damage *= get_pcvar_floatcvar_criticaldamage ) )
            
            
            
            
            
set_hudmessage02550, -1.0, -1.006.01.10.00.0)
            
ShowSyncHudMsgattackergSyncHud"Critical Hit!" )

            }
             
            return 
HAM_IGNORED;
        }
        
        
SetHamParamFloat4damage )
        return 
HAM_IGNORED;
    } 
Catastrophe is offline
artos
Senior Member
Join Date: Mar 2010
Old 04-15-2013 , 08:26   Re: What is wrong wid these codes ?
Reply With Quote #2

Give more detailed informations. What is your problem with these plugins?
__________________

Last edited by artos; 04-15-2013 at 08:27.
artos is offline
Send a message via Skype™ to artos
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 04-15-2013 , 10:40   Re: What is wrong wid these codes ?
Reply With Quote #3

With the first one... i tried to put admin flags so that it become an "only for admin" item... or rather i can use flag H and fix my VIP system....

With the second one.... i added custom parameters so that the critical strike does not occur for some specific classes still both wont work...
Catastrophe is offline
artos
Senior Member
Join Date: Mar 2010
Old 04-15-2013 , 19:17   Re: What is wrong wid these codes ?
Reply With Quote #4

In the first plugin change:
PHP Code:
if (get_user_flags(idADMIN_BAN)) 
to

PHP Code:
if (get_user_flags(id) & ADMIN_BAN
__________________

Last edited by artos; 04-15-2013 at 19:17.
artos is offline
Send a message via Skype™ to artos
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 04-16-2013 , 00:52   Re: What is wrong wid these codes ?
Reply With Quote #5

Thank u sooooooo sooooo much,....... I luv u man.... (No homo) ..... seriously i owe u this one....

BTW u found out wht's wrong wid the second plugin ?


EDIT: Yet still the problem remains that when a user with an acces flags bought smthing he gets it for free.... zzz

Last edited by Catastrophe; 04-16-2013 at 01:08.
Catastrophe is offline
artos
Senior Member
Join Date: Mar 2010
Old 04-16-2013 , 08:15   Re: What is wrong wid these codes ?
Reply With Quote #6

Quote:
Originally Posted by Catastrophe View Post
EDIT: Yet still the problem remains that when a user with an acces flags bought smthing he gets it for free.... zzz
You forgot to use zp_set_user_ammopacks command. I didn't wrote about that because I thought you wanted it that way.
__________________
artos is offline
Send a message via Skype™ to artos
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 04-16-2013 , 10:40   Re: What is wrong wid these codes ?
Reply With Quote #7

Lol.... anyways i foud out that the problem was smthing else.... anyways thnxx a ton...
Catastrophe is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode