Raised This Month: $ Target: $400
 0% 

Solved what is written on this line is not executed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Itz
Junior Member
Join Date: Apr 2021
Old 05-23-2021 , 17:59   what is written on this line is not executed
Reply With Quote #1

I was wondering why, when I buy this extra item, it is not unavailable for purchase and not pops up like this item has already been purchased

What is written on this line is not executed

PHP Code:
public zp_fw_items_select_pre(idpItem)
{
    if(
pItem != g_iItem) return ZP_ITEM_AVAILABLE;
    
    if(
zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
    
    if(
g_has_ethereal[id])
    {
        
zp_items_menu_text_add("\r[Buyed]")
        return 
ZP_ITEM_NOT_AVAILABLE;
    }

    return 
ZP_ITEM_AVAILABLE;

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

new const PLUGIN_VERSION[ ]    =  "0.0.1";

const 
OFFSET_WEAPONOWNER    =      41
const OFFSET_LINUX    =    5
const OFFSET_LINUX_WEAPONS     =      4

const WEAP_KEY   =    545464464
const MAX_PLAYERS   =        32

const m_iClip            =        51
const m_fInReload        =        54
const m_flNextAttack        =        83
const m_flNextPrimaryAttack    =    46

enum 
( <<=)
{
    
DROP_PRIMARY 1,
    
DROP_SECONDARY
};

const 
IDLE 
const RELOAD 1
const DRAW 2
const SHOOT_1 
const SHOOT_2 

new const g_iMuzzleFlash[ ]  = "sprites/ex.spr" 
new const 
g_iTrace[ ]  = "sprites/laserbeam.spr" 

#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord,%1)
#define HoldCBaseWeapon(%0)    ( get_user_weapon( %0 ) == g_iWeaponID  && g_pWeaponA[ %0 ] )
#define IsValidPrivateData(%0)    ( pev_valid( %0 ) == 2 )
#define WEAPON_BITSUM ((1<<CSW_UMP45))

new const WEAPON_SOUND_FIRE[ ] = "weapons/ethereal_shoot1.wav";

new 
WEAPON_BASE_NAME[ ]   =  "weapon_ump45";

const 
Float:RELOAD_TIME  =   3.0

const AMMO_WEAPON        =  180 

new V_MODEL_ETHEREAL[ ] = "models/Lp/v_ethereal.mdl";
new 
P_MODEL_ETHEREAL[ ] = "models/Lp/p_ethereal.mdl";
new 
W_MODEL_ETHEREAL[ ] = "models/Lp/w_ethereal.mdl";

new const 
OTHER_SOUNDS[ ] [ ] = 
{
    
"weapons/ethereal_reload.wav" ,
     
"weapons/ethereal_draw.wav" 
};    
 
new const 
TRACE_ATTACK[ ] [ ] = 
{
    
"func_breakable" 
    
"func_wall" 
    
"func_door" ,
    
"func_plat" 
    
"func_rotating" 
    
"worldspawn"
};

new 
g_iItem g_iOriginEvent g_iMaxPlayers g_iForwardIndexgmsgWeaponList;
    
new 
Float:cl_pushangleMAX_PLAYERS ][ ], g_IndexBlood]

new const 
GUNSHOT_DECALS[] = { 4142434445 };

new 
g_pWeaponAMAX_PLAYERS ] , 
    
bool:g_iPrimaryAttack;
    
new 
g_iClipAmmoMAX_PLAYERS ], 
    
g_TmpClipMAX_PLAYERS ] , 
    
g_iWeaponID 0;
    
new 
g_BeamSprite

new const Sound_Zoom[] = { "weapons/zoom.wav" }

new 
g_hasZoom[33], g_has_ethereal[33], Floatg_Reload[33]     

new 
cvar_speed cvar_damage cvar_recoil cvar_ammo cvar_clip cvar_scale_muzzle cvar_one_round

const WEAPONS_PRIMARY_BITSUM     = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(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);

public 
plugin_precache()
{
    
precache_model(V_MODEL_ETHEREAL);
    
precache_model(P_MODEL_ETHEREAL);
    
precache_model(W_MODEL_ETHEREAL);
    
precache_sound(Sound_Zoom);
    
    
precache_sound(WEAPON_SOUND_FIRE);
    
    new 
pFile;
    
    for( 
pFile pFile sizeof OTHER_SOUNDSpFile++ ) 
    {
        
precache_sound OTHER_SOUNDSpFile ] );
    }    
    
    
precache_modelg_iMuzzleFlash 
    
g_BeamSprite precache_modelg_iTrace )
    
    
precache_generic"sprites/weapon_ethereal.txt" );
    
    
precache_generic"sprites/wpn/640hud74.spr" );
    
precache_generic"sprites/wpn/640hud7x.spr" );
    
precache_generic("sprites/wpn/weapon_ethereal.txt");
    
precache_generic("sprites/wpn/640hud2.spr");
    
precache_generic("sprites/wpn/640hud74.spr");
    
precache_generic("sprites/wpn/640hud7.spr");
    
    
g_IndexBlood[0] = precache_model("sprites/blood.spr");
    
g_IndexBlood[1] = precache_model("sprites/bloodspray.spr");
    
    
g_iForwardIndex register_forwardFM_PrecacheEvent"Forward_PrecacheEventPost"true );
}

public 
plugin_init()
{
    
register_plugin"[CSO] Ethereal" PLUGIN_VERSION "Shurik07" );
    
register_clcmd"weapon_ethereal""weapon_hook_an" );
    
    
unregister_forwardFM_PrecacheEventg_iForwardIndextrue );
    
register_forward(FM_SetModel"Forward_SetModel" false );
    
register_forward(FM_PlaybackEvent"Forward_PlayBackEvent" false )
    
register_forward(FM_UpdateClientData"Forward_UpdateClientData" true );
    
register_forward(FM_CmdStart"fw_CmdStart");
    
    
RegisterHam(Ham_Item_AddToPlayerWEAPON_BASE_NAME"CBaseWeapon__AddToPlayer__Pre" , .Post false );
    
RegisterHam(Ham_Item_DeployWEAPON_BASE_NAME "CBaseWeapon__Deploy__Post", .Post true );
    
RegisterHam(Ham_Weapon_PrimaryAttackWEAPON_BASE_NAME"CBaseWeapon__PrimaryAttack__Pre" , .Post false );
    
RegisterHam(Ham_Weapon_PrimaryAttackWEAPON_BASE_NAME"CBaseWeapon_PrimaryAttack_Post", .Post true );
    
RegisterHam(Ham_Item_PostFrameWEAPON_BASE_NAME"CBaseWeapon__PostFrame__Pre" , .Post false );
    
RegisterHam(Ham_Weapon_ReloadWEAPON_BASE_NAME"CBaseWeapon__Reload_Pre" , .Post false );
    
RegisterHam(Ham_Weapon_ReloadWEAPON_BASE_NAME"CBaseWeapon__Reload_Post", .Post true );
    
    
RegisterHam(Ham_TakeDamage"player""CBasePlayer__TakeDamage__Pre" , .Post false );
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("CurWeapon""event_CurWeapon""b""1=1");
    
register_event("DeathMsg""event_DeathMsg""a""1>0");
    
    for ( new 
sizeof TRACE_ATTACK i++ )
    {
             
RegisterHamHam_TraceAttackTRACE_ATTACK], "CbaseEntity__TraceAttack__Post",.Post true );
    }    

    
cvar_speed register_cvar"ethereal_speed" "0.1" )
    
cvar_damage register_cvar"ethereal_damage" "2.5" 
    
cvar_recoil  register_cvar"ethereal_recoil" "0.2" 
    
cvar_ammo register_cvar"ethereal_ammo" "35" 
    
cvar_clip register_cvar"ethereal_clip" "25" 
    
cvar_scale_muzzle register_cvar"ethereal_muzzle_scale" "0.1" 
    
cvar_one_round register_cvar"ethereal_one_round" "0" 

    
g_iItem zp_register_extra_item"Ethereal"35ZP_TEAM_HUMAN );
    
g_iMaxPlayers get_maxplayers();
    
g_iWeaponID get_weaponidWEAPON_BASE_NAME );
}

public 
zp_fw_items_select_pre(idpItem)
{
    if(
pItem != g_iItem) return ZP_ITEM_AVAILABLE;
    
    if(
zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
    
    if(
g_has_ethereal[id])
    {
        
zp_items_menu_text_add("\r[Buyed]")
        return 
ZP_ITEM_NOT_AVAILABLE;
    }

    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_extra_item_selectedpPlayer pItem )
{
    if( 
pItem == g_iItem  )
    {
        
UTIL__DropWeaponspPlayer )
        
        {    
        
drop_primary(pPlayer);
        }
        
        
g_pWeaponApPlayer ]  = true;
         
        new 
pEntity;
             
        
pEntity give_itempPlayer WEAPON_BASE_NAME ); 
         
        if( 
pEntity )
        {
            
cs_set_weapon_ammopEntityget_pcvar_numcvar_clip ) );    
        }    
         
        
cs_set_user_bpammopPlayer g_iWeaponID get_pcvar_numcvar_ammo ) );
         
        
UTIL__WeaponListpPlayer,  "weapon_ethereal" 6AMMO_WEAPON, -1, -115g_iWeaponID );

        new 
sName[32]
        
        
get_user_name(pPlayersName31)
        
        
set_hudmessage((255), (0), (255), -1.00.1710.05.01.01.0, -1)
        
        
show_hudmessage(0"%s comprou a Ethereal!"sName)
        
    }    
}

public 
weapon_hook_anpPlayer  
{
        
engclient_cmdpPlayerWEAPON_BASE_NAME);
        return 
PLUGIN_HANDLED;
}

public 
zp_user_humanized_postpPlayer )
{
    
g_pWeaponApPlayer ] = false;
}

public 
client_disconnectpPlayer )
{
    
g_pWeaponApPlayer ]  = false;
}

public 
event_CurWeapon(id)
{
    if (!
is_user_alive(id) || zp_core_is_zombie(id)) return PLUGIN_HANDLED;
    
    if (
read_data(2) == CSW_UMP45 && g_has_ethereal[id])
    {
        
set_pev(idpev_viewmodel2V_MODEL_ETHEREAL);
        
set_pev(idpev_weaponmodel2P_MODEL_ETHEREAL);
    }
    return 
PLUGIN_CONTINUE;
}

public 
event_round_start()
{
    if(
get_pcvar_num(cvar_one_round))
    {
        for (new 
idid <= 32id++) 
        {
            
g_pWeaponAid ]  = false;
        }
    }
}

public 
event_DeathMsg()
{
    
g_has_ethereal[read_data(2)] = false;
}

public 
Forward_PrecacheEventPost(type, const pName[ ] )
{
    if ( 
equal ("events/ump45.sc"pName ) )
    {
        
g_iOriginEvent get_orig_retval( );
        return 
FMRES_HANDLED;
    }
    return 
FMRES_IGNORED;
}

public 
Forward_SetModelpEntitypModel[])
{
    if( !
is_valid_entpEntity ) ) 
    {
        return 
FMRES_IGNORED;
    }    
    
    static 
szClassName 33 ]
    
entity_get_stringpEntityEV_SZ_classnameszClassNamecharsmax szClassName ) )
        
    if( !
equal szClassName"weaponbox" ) )
    {
        return 
FMRES_IGNORED;
    }    
    
    static 
pOwner pModel
    
    pModel 
find_ent_by_owner ( -1WEAPON_BASE_NAMEpEntity );
    
    
pOwner entity_get_edict(pEntityEV_ENT_owner)
    
    if ( 
g_pWeaponA pOwner ]  && is_valid_ent pModel ) )
    {
        
entity_set_intpModelEV_INT_impulseWEAP_KEY);
        
        
entity_set_modelpEntityW_MODEL_ETHEREAL);

        
g_pWeaponA pOwner ]  = false;
        
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

public 
Forward_UpdateClientDatapPlayer SendWeaponsCD_Handle )
{
    if ( !
HoldCBaseWeaponpPlayer ) )
    {
        return 
HAM_IGNORED;
    }

    static 
Float:fGametime;
    
fGametime get_gametime();
    
    
set_cd CD_HandleCD_flNextAttackfGametime 0.001 );

    return 
FMRES_HANDLED;
}

public 
Forward_PlayBackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if ( ( 
eventid != g_iOriginEvent) || !g_iPrimaryAttack )
    {
        return 
FMRES_IGNORED;
    }    
        
    if (!( 
<= invoker <= g_iMaxPlayers ) )
    {
        return 
FMRES_IGNORED;
    }    
    
    if( 
flags FEV_GLOBAL )
    {    
        
flags &= ~FEV_GLOBAL;
    }

    
playback_event(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}


public 
fw_CmdStart(iduc_handleseed)
{
    if(
g_Reload[id])
        return 
PLUGIN_HANDLED

    
if(!is_user_alive(id)) 
        return 
PLUGIN_HANDLED
    
    
if((get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2))
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weapon(idszClipszAmmo)

        if(
szWeapID == CSW_UMP45 && g_pWeaponA[id] && !g_hasZoom[id] == true)
        {
            
g_hasZoom[id] = true
            cs_set_user_zoom
(idCS_SET_AUGSG552_ZOOM0)
            
emit_sound(idCHAN_ITEMSound_Zoom0.202.400100)
        }
        else if(
szWeapID == CSW_UMP45 && g_pWeaponA[id] && g_hasZoom[id])
        {
            
g_hasZoom[id] = false
            cs_set_user_zoom
(idCS_RESET_ZOOM0)    
        }
    }
    return 
PLUGIN_HANDLED
}

public 
CbaseEntity__TraceAttack__Post(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if ( !
is_user_connectediAttacker ) || !HoldCBaseWeaponiAttacker )  )
    {
        return 
HAM_HANDLED;
    }
     
    new 
Float:vecEnd[3];
    
    
get_tr2(ptrTR_vecEndPosvecEnd);
    
    new 
iDecal GUNSHOT_DECALSrandom_numsizeofGUNSHOT_DECALS ) - ) ]
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_GUNSHOTDECAL);
    
write_coord_fvecEnd[0]);
    
write_coord_f(vecEnd[1]);
    
write_coord_f(vecEnd[2]);
    
write_short(iEnt);
    
write_byte(iDecal);
    
message_end();
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__AddToPlayer__PrepEnity pPlayer )
{
    if( !
pev_validpEnity ) && !is_user_connectedpPlayer ) ) 
    {
         return 
HAM_IGNORED;
    }
    
    if( 
pevpEnitypev_impulse ) == WEAP_KEY || g_pWeaponApPlayer ] )
    {
        
g_pWeaponApPlayer ] = true;
        
        
UTIL__WeaponListpPlayer,  "weapon_ethereal" 6AMMO_WEAPON, -1, -115g_iWeaponID );

        return 
HAM_HANDLED;
    }
    else
    {
        
UTIL__WeaponListpPlayerWEAPON_BASE_NAME 6AMMO_WEAPON, -1, -115g_iWeaponID );
    }    

    return 
HAM_IGNORED;
}

public 
CBaseWeapon__Deploy__PostpEntity )
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }
    
    new 
pId 
    pId 
get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );
    
    if (!
g_pWeaponA[pId] )
    {
        return 
HAM_IGNORED;
    }    
    
    
set_pev(pIdpev_viewmodel2V_MODEL_ETHEREAL);
    
    
set_pdata_floatpIdm_flNextAttack1.0OFFSET_LINUX);
    
    
UTIL_SenwWeaponAnimpIdDRAW );

    
    
set_pev(pIdpev_weaponmodel2P_MODEL_ETHEREAL);
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__PrimaryAttack__Pre(pEntity)
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_IGNORED;
    }

    new     
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    
g_iClipAmmo[pId] = cs_get_weapon_ammo(pEntity);

    
pevpId pev_punchangle cl_pushanglepId ] );

    
g_iPrimaryAttack true;
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon_PrimaryAttack_PostpEntity )
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_IGNORED;
    }
    
    
g_iPrimaryAttack false;
    
    new 
pId get_pdata_cbasepEntityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS );
    
    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    if (!
g_iClipAmmo[pId])
    {
            return 
HAM_IGNORED;
    }    
    
    
        
    
emit_soundpIdCHAN_WEAPONWEAPON_SOUND_FIREVOL_NORMATTN_NORM0PITCH_NORM );
    
UTIL_SenwWeaponAnimpIdrandom_numSHOOT_1 SHOOT_2 ) );
    
    
LaserBeam(pId 100 50 253 )
    
    
#if defined SET__MUZZLE
    
UTIL_MakeMuzzlepId 
    
#endif
    
    
new Float:Push];
    
    
pevpIdpev_punchanglePush );
    
xs_vec_subPush cl_pushanglepId ] , Push );
        
    
xs_vec_mul_scalarPushget_pcvar_floatcvar_recoil ) , Push );
    
xs_vec_addPushcl_pushanglepId ] , Push );
    
set_pevpIdpev_punchanglePush );
        
    
set_pdata_floatpEntitym_flNextPrimaryAttack get_pcvar_floatcvar_speed ) , OFFSET_LINUX_WEAPONS );
    
    return 
HAM_IGNORED;
}


public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:damage)
{
    if ( 
pevVictim == pevAttacker || !pevAttacker )
    {
        return 
HAM_HANDLED;
    }

    if ( !
is_user_connectedpevAttacker ) || !HoldCBaseWeaponpevAttacker )  )
    {
        return 
HAM_HANDLED;
    }
    
    
SetHamParamFloat(4damage get_pcvar_floatcvar_damage )  )
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__PostFrame__PrepEntity 
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }

    new 
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
is_user_connectedpId ) && !HoldCBaseWeaponpId ) && !g_iMaxPlayers )
    {
        return 
HAM_HANDLED;
    }
    
    new 
fInReload get_pdata_intpEntity54OFFSET_LINUX_WEAPONS );
    new 
Float:flNextAttack get_pdata_floatpIdm_flNextAttackOFFSET_LINUX_WEAPONS );
    new 
iClip  get_pdata_intpEntitym_iClipOFFSET_LINUX_WEAPONS );
    new 
iAmmoType 376 get_pdata_intpEntity49OFFSET_LINUX_WEAPONS );
    new 
iBpAmmo  get_pdata_intpIdiAmmoTypeOFFSET_LINUX );
    
    if ( 
fInReload && flNextAttack <= 1.4 )
    {
        new 
minget_pcvar_numcvar_clip )  - iClipiBpAmmo);
    
        
set_pdata_intpEntitym_iClipiClip jOFFSET_LINUX_WEAPONS );
        
set_pdata_intpIdiAmmoTypeiBpAmmo-jOFFSET_LINUX );
        
set_pdata_intpEntity540OFFSET_LINUX_WEAPONS );

        
fInReload 0;
    }     
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__Reload_Pre(pEntity
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_HANDLED;
    }

    new 
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
is_user_connectedpId ) || !HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }
    
    static 
iClipExtra;
    
iClipExtra get_pcvar_numcvar_clip );
    
    
g_TmpClip[pId] = -1;
    
    new 
iAmmoType 376 get_pdata_intpEntity49OFFSET_LINUX_WEAPONS );
    new 
iBpAmmo get_pdata_intpIdiAmmoTypeOFFSET_LINUX );
    new 
iClip get_pdata_intpEntitym_iClipOFFSET_LINUX );
    
    if ( 
iBpAmmo <= || iClip >= iClipExtra )
    {
       return 
HAM_SUPERCEDE;
    }  
    
    
g_TmpClip[pId] = iClip;
    
    return 
HAM_HANDLED;
}

public 
CBaseWeapon__Reload_PostpEntity 
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }

    new 
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );
    
    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    if (
g_TmpClippId ] == -1)
    {
        return 
HAM_IGNORED;
    }

    
    
set_pdata_floatpIdm_flNextAttackRELOAD_TIME OFFSET_LINUX);
    
    
UTIL_SenwWeaponAnim(pIdRELOAD);

    return 
HAM_HANDLED;
}

public 
Sprite(id)
{
    
    
message_begin(MSG_ONEgmsgWeaponList, {0,0,0}, id)
    
write_string("weapon_ethereal")  
    
write_byte(6)
    
write_byte(100)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(15)
    
write_byte(12)
    
write_byte(0)
    
message_end()

}

stock UTIL__DropWeaponspPlayer )
{
    for( new 
pWeapon CSW_P228pWeapon <= CSW_P90pWeapon++ )
    {
        if( ( ( 
<< pWeapon ) & WEAPONS_PRIMARY_BITSUM ) )
        {
            new 
strWeaponName32 ];
            
get_weaponnamepWeaponstrWeaponNamecharsmaxstrWeaponName ) );
                        
            if(
equal(strWeaponNameWEAPON_BASE_NAME) )
            {
                
engclient_cmdpPlayer"drop"strWeaponName );
            }
        }
    }
}

stock UTIL_SenwWeaponAnim(const pPlayer, const Sequence)
{
    
set_pev(pPlayerpev_weaponanimSequence)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, .player pPlayer)
    
write_byte(Sequence)
    
write_byte(pev(pPlayerpev_body))
    
message_end()
}

UTIL__WeaponListpPlayer, const szWeapon[ ], intint2int3int4int5int6int7int8 )
{
    
message_beginMSG_ONEget_user_msgid"WeaponList" ) , _pPlayer );
    
write_stringszWeapon );
    
write_byte( int );
    
write_byteint2);
    
write_byteint3 );
    
write_byteint4 );
    
write_byteint5 );
    
write_byteint6 );
    
write_byteint7 );
    
write_byteint8 );
    
message_end( );
}

stock UTIL_MakeMuzzlepId   
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite")) 
    
    new 
Float:vecOrigin]
    
pevpIdpev_originvecOrigin )

    
entity_set_originpEntityvecOrigin )
    
    
entity_set_modelpEntityg_iMuzzleFlash )

    
entity_set_intpEntityEV_INT_solidSOLID_NOT )
    
entity_set_intpEntityEV_INT_movetypeMOVETYPE_NOCLIP )
    
    
entity_set_stringpEntityEV_SZ_classname"muzzle_et" )

    
    
entity_set_floatpEntityEV_FL_animtimeget_gametime() )
    
entity_set_floatpEntityEV_FL_framerate50.0 )       
    
set_pevpEntitypev_scaleget_pcvar_floatcvar_scale_muzzle )  )

    
set_pevpEntitypev_spawnflagsSF_SPRITE_ONCE)

    
set_pev(pEntitypev_rendermode,  kRenderTransAdd)
    
    
set_pev(pEntitypev_renderamt,   255.0)

    
set_pev(pEntitypev_skinpId )
    
set_pev(pEntitypev_body1)
    
set_pev(pEntitypev_aimentpId)

    
entity_set_float(pEntityEV_FL_nextthinkget_gametime() + 5.0 );
    
    
DispatchSpawnpEntity );
    
    
set_task1.0 "rem_ent" pEntity 
}        

public 
rem_entiEnt 
{
    
remove_entityiEnt 
}    

stock LaserBeam(id Size Red Grenn Blue 
{
    static 
End[3]
    
get_user_origin(idEnd3)    
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte (TE_BEAMENTPOINT)
    
write_shortid |0x1000 )
    
write_coord(End[0])
    
write_coord(End[1])
    
write_coord(End[2])
    
write_short(g_BeamSprite)
    
write_byte(0)
    
write_byte(1)
    
write_byte(1)
    
write_byte(Size)
    
write_byte(4)
    
write_byte(Red)
    
write_byte(Grenn)
    
write_byte(Blue)
    
write_byte(255)
    
write_byte(0)
    
message_end()
}    

stock drop_primary(id)
{
    new 
weapons[32], num;
    
get_user_weapons(idweaponsnum);
    for (new 
0numi++)
    {
        if (
WEAPON_BITSUM & (1<<weapons[i]))
        {
            static 
wname[32];
            
get_weaponname(weapons[i], wnamesizeof wname 1);
            
engclient_cmd(id"drop"wname);
        }
    }


Last edited by Itz; 05-23-2021 at 23:30.
Itz is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-23-2021 , 20:17   Re: what is written on this line is not executed
Reply With Quote #2

I don't see you setting
Code:
g_has_ethereal
to true anywhere.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Itz
Junior Member
Join Date: Apr 2021
Old 05-23-2021 , 21:00   Re: what is written on this line is not executed
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
I don't see you setting
Code:
g_has_ethereal
to true anywhere.
I add real g_has_ethereal = true, but when i buy and drop the item i can't more buy

Last edited by Itz; 05-23-2021 at 21:01.
Itz is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-23-2021 , 21:36   Re: what is written on this line is not executed
Reply With Quote #4

PHP Code:
g_has_ethereal 
You haven't set it back to false anywhere else except when player dead or Infected

If a new round started and you remove the weapon or drop the weapon, the player can't buy the weapon again.

Then they can bought an UMP and get the weapon for free
__________________
My plugin:
Celena Luna is offline
Itz
Junior Member
Join Date: Apr 2021
Old 05-23-2021 , 22:42   Re: what is written on this line is not executed
Reply With Quote #5

Quote:
Originally Posted by Celena Luna View Post
PHP Code:
g_has_ethereal 
You haven't set it back to false anywhere else except when player dead or Infected

If a new round started and you remove the weapon or drop the weapon, the player can't buy the weapon again.

Then they can bought an UMP and get the weapon for free

I made the following changes

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

new const PLUGIN_VERSION[ ]    =  "0.0.1";

const 
OFFSET_WEAPONOWNER    =      41
const OFFSET_LINUX    =    5
const OFFSET_LINUX_WEAPONS     =      4

const WEAP_KEY   =    545464464
const MAX_PLAYERS   =        32

const m_iClip            =        51
const m_fInReload        =        54
const m_flNextAttack        =        83
const m_flNextPrimaryAttack    =    46

enum 
( <<=)
{
    
DROP_PRIMARY 1,
    
DROP_SECONDARY
};

const 
IDLE 
const RELOAD 1
const DRAW 2
const SHOOT_1 
const SHOOT_2 

new const g_iMuzzleFlash[ ]  = "sprites/ex.spr" 
new const 
g_iTrace[ ]  = "sprites/laserbeam.spr" 

#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord,%1)
#define HoldCBaseWeapon(%0)    ( get_user_weapon( %0 ) == g_iWeaponID  && g_pWeaponA[ %0 ] )
#define IsValidPrivateData(%0)    ( pev_valid( %0 ) == 2 )
#define WEAPON_BITSUM ((1<<CSW_UMP45))

new const WEAPON_SOUND_FIRE[ ] = "weapons/ethereal_shoot1.wav";

new 
WEAPON_BASE_NAME[ ]   =  "weapon_ump45";

const 
Float:RELOAD_TIME  =   3.0

const AMMO_WEAPON        =  180 

new V_MODEL_ETHEREAL[ ] = "models/Lp/v_ethereal.mdl";
new 
P_MODEL_ETHEREAL[ ] = "models/Lp/p_ethereal.mdl";
new 
W_MODEL_ETHEREAL[ ] = "models/Lp/w_ethereal.mdl";

new const 
OTHER_SOUNDS[ ] [ ] = 
{
    
"weapons/ethereal_reload.wav" ,
     
"weapons/ethereal_draw.wav" 
};    
 
new const 
TRACE_ATTACK[ ] [ ] = 
{
    
"func_breakable" 
    
"func_wall" 
    
"func_door" ,
    
"func_plat" 
    
"func_rotating" 
    
"worldspawn"
};

new 
g_iItem g_iOriginEvent g_iMaxPlayers g_iForwardIndexgmsgWeaponList;
    
new 
Float:cl_pushangleMAX_PLAYERS ][ ], g_IndexBlood]

new const 
GUNSHOT_DECALS[] = { 4142434445 };

new 
g_pWeaponAMAX_PLAYERS ] , 
    
bool:g_iPrimaryAttack;
    
new 
g_iClipAmmoMAX_PLAYERS ], 
    
g_TmpClipMAX_PLAYERS ] , 
    
g_iWeaponID 0;
    
new 
g_BeamSprite

new const Sound_Zoom[] = { "weapons/zoom.wav" }

new 
g_hasZoom[33], g_has_ethereal[33], Floatg_Reload[33]     

new 
cvar_speed cvar_damage cvar_recoil cvar_ammo cvar_clip cvar_scale_muzzle cvar_one_round

const WEAPONS_PRIMARY_BITSUM     = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(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);

public 
plugin_precache()
{
    
precache_model(V_MODEL_ETHEREAL);
    
precache_model(P_MODEL_ETHEREAL);
    
precache_model(W_MODEL_ETHEREAL);
    
precache_sound(Sound_Zoom);
    
    
precache_sound(WEAPON_SOUND_FIRE);
    
    new 
pFile;
    
    for( 
pFile pFile sizeof OTHER_SOUNDSpFile++ ) 
    {
        
precache_sound OTHER_SOUNDSpFile ] );
    }    
    
    
precache_modelg_iMuzzleFlash 
    
g_BeamSprite precache_modelg_iTrace )
    
    
precache_generic"sprites/weapon_ethereal.txt" );
    
    
precache_generic"sprites/wpn/640hud74.spr" );
    
precache_generic"sprites/wpn/640hud7x.spr" );
    
precache_generic("sprites/wpn/weapon_ethereal.txt");
    
precache_generic("sprites/wpn/640hud2.spr");
    
precache_generic("sprites/wpn/640hud74.spr");
    
precache_generic("sprites/wpn/640hud7.spr");
    
    
g_IndexBlood[0] = precache_model("sprites/blood.spr");
    
g_IndexBlood[1] = precache_model("sprites/bloodspray.spr");
    
    
g_iForwardIndex register_forwardFM_PrecacheEvent"Forward_PrecacheEventPost"true );
}

public 
plugin_init()
{
    
register_plugin"[CSO] Ethereal" PLUGIN_VERSION "Shurik07" );
    
register_clcmd"weapon_ethereal""weapon_hook_an" );
    
    
unregister_forwardFM_PrecacheEventg_iForwardIndextrue );
    
register_forward(FM_SetModel"Forward_SetModel" false );
    
register_forward(FM_PlaybackEvent"Forward_PlayBackEvent" false )
    
register_forward(FM_UpdateClientData"Forward_UpdateClientData" true );
    
register_forward(FM_CmdStart"fw_CmdStart");
    
    
RegisterHam(Ham_Item_AddToPlayerWEAPON_BASE_NAME"CBaseWeapon__AddToPlayer__Pre" , .Post false );
    
RegisterHam(Ham_Item_DeployWEAPON_BASE_NAME "CBaseWeapon__Deploy__Post", .Post true );
    
RegisterHam(Ham_Weapon_PrimaryAttackWEAPON_BASE_NAME"CBaseWeapon__PrimaryAttack__Pre" , .Post false );
    
RegisterHam(Ham_Weapon_PrimaryAttackWEAPON_BASE_NAME"CBaseWeapon_PrimaryAttack_Post", .Post true );
    
RegisterHam(Ham_Item_PostFrameWEAPON_BASE_NAME"CBaseWeapon__PostFrame__Pre" , .Post false );
    
RegisterHam(Ham_Weapon_ReloadWEAPON_BASE_NAME"CBaseWeapon__Reload_Pre" , .Post false );
    
RegisterHam(Ham_Weapon_ReloadWEAPON_BASE_NAME"CBaseWeapon__Reload_Post", .Post true );
    
    
RegisterHam(Ham_TakeDamage"player""CBasePlayer__TakeDamage__Pre" , .Post false );
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("CurWeapon""event_CurWeapon""b""1=1");
    
register_event("DeathMsg""event_DeathMsg""a""1>0");
    
    for ( new 
sizeof TRACE_ATTACK i++ )
    {
             
RegisterHamHam_TraceAttackTRACE_ATTACK], "CbaseEntity__TraceAttack__Post",.Post true );
    }    

    
cvar_speed register_cvar"ethereal_speed" "0.1" )
    
cvar_damage register_cvar"ethereal_damage" "2.5" 
    
cvar_recoil  register_cvar"ethereal_recoil" "0.2" 
    
cvar_ammo register_cvar"ethereal_ammo" "35" 
    
cvar_clip register_cvar"ethereal_clip" "25" 
    
cvar_scale_muzzle register_cvar"ethereal_muzzle_scale" "0.1" 
    
cvar_one_round register_cvar"ethereal_one_round" "0" 

    
g_iItem zp_register_extra_item"Ethereal"35ZP_TEAM_HUMAN );
    
g_iMaxPlayers get_maxplayers();
    
g_iWeaponID get_weaponidWEAPON_BASE_NAME );
}

public 
client_disconnect(id)
{
    
g_has_ethereal[id] = false;
}

public 
client_connect(id)
{
    
g_has_ethereal[id] = false;
}

public 
zp_fw_core_infect_post(id)
{
    
g_has_ethereal[id] = false;
}

public 
zp_fw_items_select_pre(idpItem)
{
    if(
pItem != g_iItem) return ZP_ITEM_AVAILABLE;
    
    if(
zp_core_is_zombie(id)) return ZP_ITEM_DONT_SHOW;
    
    if(
g_has_ethereal[id])
    {
        
zp_items_menu_text_add("\r[Buyed]")
        return 
ZP_ITEM_NOT_AVAILABLE;
    }

    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_extra_item_selectedpPlayer pItem )
{
    if( 
pItem == g_iItem  )
    {
        
UTIL__DropWeaponspPlayer )
        
        {    
        
drop_primary(pPlayer);
        }
        
        
g_has_ethereal[pPlayer] = true;
        
        
g_pWeaponApPlayer ]  = true;
         
        new 
pEntity;
             
        
pEntity give_itempPlayer WEAPON_BASE_NAME ); 
         
        if( 
pEntity )
        {
            
cs_set_weapon_ammopEntityget_pcvar_numcvar_clip ) );    
        }    
         
        
cs_set_user_bpammopPlayer g_iWeaponID get_pcvar_numcvar_ammo ) );
         
        
UTIL__WeaponListpPlayer,  "weapon_ethereal" 6AMMO_WEAPON, -1, -115g_iWeaponID );

        new 
sName[32]
        
        
get_user_name(pPlayersName31)
        
        
set_hudmessage((255), (0), (255), -1.00.1710.05.01.01.0, -1)
        
        
show_hudmessage(0"%s comprou a Ethereal!"sName)
        
    }    
}

public 
weapon_hook_anpPlayer  
{
        
engclient_cmdpPlayerWEAPON_BASE_NAME);
        return 
PLUGIN_HANDLED;
}

public 
zp_user_humanized_postpPlayer )
{
    
g_pWeaponApPlayer ] = false;
}

public 
event_CurWeapon(id)
{
    if (!
is_user_alive(id) || zp_core_is_zombie(id)) return PLUGIN_HANDLED;
    
    if (
read_data(2) == CSW_UMP45 && g_has_ethereal[id])
    {
        
set_pev(idpev_viewmodel2V_MODEL_ETHEREAL);
        
set_pev(idpev_weaponmodel2P_MODEL_ETHEREAL);
    }
    return 
PLUGIN_CONTINUE;
}

public 
event_round_start()
{
    if(
get_pcvar_num(cvar_one_round))
    {
        for (new 
idid <= 32id++) 
        {
            
g_pWeaponAid ]  = false;
        }
    }
}

public 
event_DeathMsg()
{
    
g_has_ethereal[read_data(2)] = false;
}

public 
Forward_PrecacheEventPost(type, const pName[ ] )
{
    if ( 
equal ("events/ump45.sc"pName ) )
    {
        
g_iOriginEvent get_orig_retval( );
        return 
FMRES_HANDLED;
    }
    return 
FMRES_IGNORED;
}

public 
Forward_SetModelpEntitypModel[])
{
    if( !
is_valid_entpEntity ) ) 
    {
        return 
FMRES_IGNORED;
    }    
    
    static 
szClassName 33 ]
    
entity_get_stringpEntityEV_SZ_classnameszClassNamecharsmax szClassName ) )
        
    if( !
equal szClassName"weaponbox" ) )
    {
        return 
FMRES_IGNORED;
    }    
    
    static 
pOwner pModel
    
    pModel 
find_ent_by_owner ( -1WEAPON_BASE_NAMEpEntity );
    
    
pOwner entity_get_edict(pEntityEV_ENT_owner)
    
    if ( 
g_pWeaponA pOwner ]  && is_valid_ent pModel ) )
    {
        
entity_set_intpModelEV_INT_impulseWEAP_KEY);
        
        
entity_set_modelpEntityW_MODEL_ETHEREAL);

        
g_pWeaponA pOwner ]  = false;
        
        return 
FMRES_SUPERCEDE;
    }

    return 
FMRES_IGNORED;
}

public 
Forward_UpdateClientDatapPlayer SendWeaponsCD_Handle )
{
    if ( !
HoldCBaseWeaponpPlayer ) )
    {
        return 
HAM_IGNORED;
    }

    static 
Float:fGametime;
    
fGametime get_gametime();
    
    
set_cd CD_HandleCD_flNextAttackfGametime 0.001 );

    return 
FMRES_HANDLED;
}

public 
Forward_PlayBackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if ( ( 
eventid != g_iOriginEvent) || !g_iPrimaryAttack )
    {
        return 
FMRES_IGNORED;
    }    
        
    if (!( 
<= invoker <= g_iMaxPlayers ) )
    {
        return 
FMRES_IGNORED;
    }    
    
    if( 
flags FEV_GLOBAL )
    {    
        
flags &= ~FEV_GLOBAL;
    }

    
playback_event(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}


public 
fw_CmdStart(iduc_handleseed)
{
    if(
g_Reload[id])
        return 
PLUGIN_HANDLED

    
if(!is_user_alive(id)) 
        return 
PLUGIN_HANDLED
    
    
if((get_uc(uc_handleUC_Buttons) & IN_ATTACK2) && !(pev(idpev_oldbuttons) & IN_ATTACK2))
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weapon(idszClipszAmmo)

        if(
szWeapID == CSW_UMP45 && g_pWeaponA[id] && !g_hasZoom[id] == true)
        {
            
g_hasZoom[id] = true
            cs_set_user_zoom
(idCS_SET_AUGSG552_ZOOM0)
            
emit_sound(idCHAN_ITEMSound_Zoom0.202.400100)
        }
        else if(
szWeapID == CSW_UMP45 && g_pWeaponA[id] && g_hasZoom[id])
        {
            
g_hasZoom[id] = false
            cs_set_user_zoom
(idCS_RESET_ZOOM0)    
        }
    }
    return 
PLUGIN_HANDLED
}

public 
CbaseEntity__TraceAttack__Post(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if ( !
is_user_connectediAttacker ) || !HoldCBaseWeaponiAttacker )  )
    {
        return 
HAM_HANDLED;
    }
     
    new 
Float:vecEnd[3];
    
    
get_tr2(ptrTR_vecEndPosvecEnd);
    
    new 
iDecal GUNSHOT_DECALSrandom_numsizeofGUNSHOT_DECALS ) - ) ]
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_GUNSHOTDECAL);
    
write_coord_fvecEnd[0]);
    
write_coord_f(vecEnd[1]);
    
write_coord_f(vecEnd[2]);
    
write_short(iEnt);
    
write_byte(iDecal);
    
message_end();
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__AddToPlayer__PrepEnity pPlayer )
{
    if( !
pev_validpEnity ) && !is_user_connectedpPlayer ) ) 
    {
         return 
HAM_IGNORED;
    }
    
    if( 
pevpEnitypev_impulse ) == WEAP_KEY || g_pWeaponApPlayer ] )
    {
        
g_pWeaponApPlayer ] = true;
        
        
UTIL__WeaponListpPlayer,  "weapon_ethereal" 6AMMO_WEAPON, -1, -115g_iWeaponID );

        return 
HAM_HANDLED;
    }
    else
    {
        
UTIL__WeaponListpPlayerWEAPON_BASE_NAME 6AMMO_WEAPON, -1, -115g_iWeaponID );
    }    

    return 
HAM_IGNORED;
}

public 
CBaseWeapon__Deploy__PostpEntity )
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }
    
    new 
pId 
    pId 
get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );
    
    if (!
g_pWeaponA[pId] )
    {
        return 
HAM_IGNORED;
    }    
    
    
set_pev(pIdpev_viewmodel2V_MODEL_ETHEREAL);
    
    
set_pdata_floatpIdm_flNextAttack1.0OFFSET_LINUX);
    
    
UTIL_SenwWeaponAnimpIdDRAW );

    
    
set_pev(pIdpev_weaponmodel2P_MODEL_ETHEREAL);
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__PrimaryAttack__Pre(pEntity)
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_IGNORED;
    }

    new     
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    
g_iClipAmmo[pId] = cs_get_weapon_ammo(pEntity);

    
pevpId pev_punchangle cl_pushanglepId ] );

    
g_iPrimaryAttack true;
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon_PrimaryAttack_PostpEntity )
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_IGNORED;
    }
    
    
g_iPrimaryAttack false;
    
    new 
pId get_pdata_cbasepEntityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS );
    
    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    if (!
g_iClipAmmo[pId])
    {
            return 
HAM_IGNORED;
    }    
    
    
        
    
emit_soundpIdCHAN_WEAPONWEAPON_SOUND_FIREVOL_NORMATTN_NORM0PITCH_NORM );
    
UTIL_SenwWeaponAnimpIdrandom_numSHOOT_1 SHOOT_2 ) );
    
    
LaserBeam(pId 100 50 253 )
    
    
#if defined SET__MUZZLE
    
UTIL_MakeMuzzlepId 
    
#endif
    
    
new Float:Push];
    
    
pevpIdpev_punchanglePush );
    
xs_vec_subPush cl_pushanglepId ] , Push );
        
    
xs_vec_mul_scalarPushget_pcvar_floatcvar_recoil ) , Push );
    
xs_vec_addPushcl_pushanglepId ] , Push );
    
set_pevpIdpev_punchanglePush );
        
    
set_pdata_floatpEntitym_flNextPrimaryAttack get_pcvar_floatcvar_speed ) , OFFSET_LINUX_WEAPONS );
    
    return 
HAM_IGNORED;
}


public 
CBasePlayer__TakeDamage__PrepevVictimpevInflictorpevAttackerFloat:damage)
{
    if ( 
pevVictim == pevAttacker || !pevAttacker )
    {
        return 
HAM_HANDLED;
    }

    if ( !
is_user_connectedpevAttacker ) || !HoldCBaseWeaponpevAttacker )  )
    {
        return 
HAM_HANDLED;
    }
    
    
SetHamParamFloat(4damage get_pcvar_floatcvar_damage )  )
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__PostFrame__PrepEntity 
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }

    new 
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
is_user_connectedpId ) && !HoldCBaseWeaponpId ) && !g_iMaxPlayers )
    {
        return 
HAM_HANDLED;
    }
    
    new 
fInReload get_pdata_intpEntity54OFFSET_LINUX_WEAPONS );
    new 
Float:flNextAttack get_pdata_floatpIdm_flNextAttackOFFSET_LINUX_WEAPONS );
    new 
iClip  get_pdata_intpEntitym_iClipOFFSET_LINUX_WEAPONS );
    new 
iAmmoType 376 get_pdata_intpEntity49OFFSET_LINUX_WEAPONS );
    new 
iBpAmmo  get_pdata_intpIdiAmmoTypeOFFSET_LINUX );
    
    if ( 
fInReload && flNextAttack <= 1.4 )
    {
        new 
minget_pcvar_numcvar_clip )  - iClipiBpAmmo);
    
        
set_pdata_intpEntitym_iClipiClip jOFFSET_LINUX_WEAPONS );
        
set_pdata_intpIdiAmmoTypeiBpAmmo-jOFFSET_LINUX );
        
set_pdata_intpEntity540OFFSET_LINUX_WEAPONS );

        
fInReload 0;
    }     
    
    return 
HAM_IGNORED;
}

public 
CBaseWeapon__Reload_Pre(pEntity
{
    if( !
IsValidPrivateDatapEntity ) )
    {
        return 
HAM_HANDLED;
    }

    new 
pId;

    
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );

    if ( !
is_user_connectedpId ) || !HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }
    
    static 
iClipExtra;
    
iClipExtra get_pcvar_numcvar_clip );
    
    
g_TmpClip[pId] = -1;
    
    new 
iAmmoType 376 get_pdata_intpEntity49OFFSET_LINUX_WEAPONS );
    new 
iBpAmmo get_pdata_intpIdiAmmoTypeOFFSET_LINUX );
    new 
iClip get_pdata_intpEntitym_iClipOFFSET_LINUX );
    
    if ( 
iBpAmmo <= || iClip >= iClipExtra )
    {
       return 
HAM_SUPERCEDE;
    }  
    
    
g_TmpClip[pId] = iClip;
    
    return 
HAM_HANDLED;
}

public 
CBaseWeapon__Reload_PostpEntity 
{
    if( !
IsValidPrivateDatapEntity ) )
    {
                return 
HAM_HANDLED;
    }

    new 
pId get_pdata_cbasepEntity OFFSET_WEAPONOWNER OFFSET_LINUX_WEAPONS );
    
    if ( !
HoldCBaseWeaponpId ) )
    {
        return 
HAM_IGNORED;
    }

    if (
g_TmpClippId ] == -1)
    {
        return 
HAM_IGNORED;
    }

    
    
set_pdata_floatpIdm_flNextAttackRELOAD_TIME OFFSET_LINUX);
    
    
UTIL_SenwWeaponAnim(pIdRELOAD);

    return 
HAM_HANDLED;
}

public 
Sprite(id)
{
    
    
message_begin(MSG_ONEgmsgWeaponList, {0,0,0}, id)
    
write_string("weapon_ethereal")  
    
write_byte(6)
    
write_byte(100)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(15)
    
write_byte(12)
    
write_byte(0)
    
message_end()

}

stock UTIL__DropWeaponspPlayer )
{
    for( new 
pWeapon CSW_P228pWeapon <= CSW_P90pWeapon++ )
    {
        if( ( ( 
<< pWeapon ) & WEAPONS_PRIMARY_BITSUM ) )
        {
            new 
strWeaponName32 ];
            
get_weaponnamepWeaponstrWeaponNamecharsmaxstrWeaponName ) );
                        
            if(
equal(strWeaponNameWEAPON_BASE_NAME) )
            {
                
engclient_cmdpPlayer"drop"strWeaponName );
            }
        }
    }
}

stock UTIL_SenwWeaponAnim(const pPlayer, const Sequence)
{
    
set_pev(pPlayerpev_weaponanimSequence)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, .player pPlayer)
    
write_byte(Sequence)
    
write_byte(pev(pPlayerpev_body))
    
message_end()
}

UTIL__WeaponListpPlayer, const szWeapon[ ], intint2int3int4int5int6int7int8 )
{
    
message_beginMSG_ONEget_user_msgid"WeaponList" ) , _pPlayer );
    
write_stringszWeapon );
    
write_byte( int );
    
write_byteint2);
    
write_byteint3 );
    
write_byteint4 );
    
write_byteint5 );
    
write_byteint6 );
    
write_byteint7 );
    
write_byteint8 );
    
message_end( );
}

stock UTIL_MakeMuzzlepId   
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite")) 
    
    new 
Float:vecOrigin]
    
pevpIdpev_originvecOrigin )

    
entity_set_originpEntityvecOrigin )
    
    
entity_set_modelpEntityg_iMuzzleFlash )

    
entity_set_intpEntityEV_INT_solidSOLID_NOT )
    
entity_set_intpEntityEV_INT_movetypeMOVETYPE_NOCLIP )
    
    
entity_set_stringpEntityEV_SZ_classname"muzzle_et" )

    
    
entity_set_floatpEntityEV_FL_animtimeget_gametime() )
    
entity_set_floatpEntityEV_FL_framerate50.0 )       
    
set_pevpEntitypev_scaleget_pcvar_floatcvar_scale_muzzle )  )

    
set_pevpEntitypev_spawnflagsSF_SPRITE_ONCE)

    
set_pev(pEntitypev_rendermode,  kRenderTransAdd)
    
    
set_pev(pEntitypev_renderamt,   255.0)

    
set_pev(pEntitypev_skinpId )
    
set_pev(pEntitypev_body1)
    
set_pev(pEntitypev_aimentpId)

    
entity_set_float(pEntityEV_FL_nextthinkget_gametime() + 5.0 );
    
    
DispatchSpawnpEntity );
    
    
set_task1.0 "rem_ent" pEntity 
}        

public 
rem_entiEnt 
{
    
remove_entityiEnt 
}    

stock LaserBeam(id Size Red Grenn Blue 
{
    static 
End[3]
    
get_user_origin(idEnd3)    
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte (TE_BEAMENTPOINT)
    
write_shortid |0x1000 )
    
write_coord(End[0])
    
write_coord(End[1])
    
write_coord(End[2])
    
write_short(g_BeamSprite)
    
write_byte(0)
    
write_byte(1)
    
write_byte(1)
    
write_byte(Size)
    
write_byte(4)
    
write_byte(Red)
    
write_byte(Grenn)
    
write_byte(Blue)
    
write_byte(255)
    
write_byte(0)
    
message_end()
}    

stock drop_primary(id)
{
    new 
weapons[32], num;
    
get_user_weapons(idweaponsnum);
    for (new 
0numi++)
    {
        if (
WEAPON_BITSUM & (1<<weapons[i]))
        {
            static 
wname[32];
            
get_weaponname(weapons[i], wnamesizeof wname 1);
            
engclient_cmd(id"drop"wname);
        }
    }


Last edited by Itz; 05-23-2021 at 22:42.
Itz is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-23-2021 , 23:17   Re: what is written on this line is not executed
Reply With Quote #6

Add in this 2 places:
Code:
public Forward_SetModel( pEntity, pModel[]) {     if( !is_valid_ent( pEntity ) )     {         return FMRES_IGNORED;     }             static szClassName [ 33 ]     entity_get_string( pEntity, EV_SZ_classname, szClassName, charsmax ( szClassName ) )             if( !equal ( szClassName, "weaponbox" ) )     {         return FMRES_IGNORED;     }             static pOwner , pModel         pModel = find_ent_by_owner ( -1, WEAPON_BASE_NAME, pEntity );         pOwner = entity_get_edict(pEntity, EV_ENT_owner)         if ( g_pWeaponA [ pOwner ]  && is_valid_ent ( pModel ) )     {         entity_set_int( pModel, EV_INT_impulse, WEAP_KEY);                 entity_set_model( pEntity, W_MODEL_ETHEREAL);         g_pWeaponA [ pOwner ]  = false;         g_has_ethereal[pOwner] = false;                 return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; }

And

Code:
public CBaseWeapon__AddToPlayer__Pre( pEnity , pPlayer ) {     if( !pev_valid( pEnity ) && !is_user_connected( pPlayer ) )     {          return HAM_IGNORED;     }         if( pev( pEnity, pev_impulse ) == WEAP_KEY || g_pWeaponA[ pPlayer ] )     {         g_pWeaponA[ pPlayer ] = true;         g_has_ethereal[pPlayer] = true;                 UTIL__WeaponList( pPlayer,  "weapon_ethereal" , 6, AMMO_WEAPON, -1, -1, 0 , 15, g_iWeaponID , 0 );         return HAM_HANDLED;     }     else     {         UTIL__WeaponList( pPlayer, WEAPON_BASE_NAME , 6, AMMO_WEAPON, -1, -1, 0 , 15, g_iWeaponID , 0 );     }         return HAM_IGNORED; }

And to be honest, g_pWeaponA is g_has_ethereal already
__________________
My plugin:
Celena Luna is offline
Itz
Junior Member
Join Date: Apr 2021
Old 05-23-2021 , 23:28   Re: what is written on this line is not executed
Reply With Quote #7

Quote:
Originally Posted by Celena Luna View Post
Add in this 2 places:
Code:
public Forward_SetModel( pEntity, pModel[]) {     if( !is_valid_ent( pEntity ) )     {         return FMRES_IGNORED;     }             static szClassName [ 33 ]     entity_get_string( pEntity, EV_SZ_classname, szClassName, charsmax ( szClassName ) )             if( !equal ( szClassName, "weaponbox" ) )     {         return FMRES_IGNORED;     }             static pOwner , pModel         pModel = find_ent_by_owner ( -1, WEAPON_BASE_NAME, pEntity );         pOwner = entity_get_edict(pEntity, EV_ENT_owner)         if ( g_pWeaponA [ pOwner ]  && is_valid_ent ( pModel ) )     {         entity_set_int( pModel, EV_INT_impulse, WEAP_KEY);                 entity_set_model( pEntity, W_MODEL_ETHEREAL);         g_pWeaponA [ pOwner ]  = false;         g_has_ethereal[pOwner] = false;                 return FMRES_SUPERCEDE;     }     return FMRES_IGNORED; }

And

Code:
public CBaseWeapon__AddToPlayer__Pre( pEnity , pPlayer ) {     if( !pev_valid( pEnity ) && !is_user_connected( pPlayer ) )     {          return HAM_IGNORED;     }         if( pev( pEnity, pev_impulse ) == WEAP_KEY || g_pWeaponA[ pPlayer ] )     {         g_pWeaponA[ pPlayer ] = true;         g_has_ethereal[pPlayer] = true;                 UTIL__WeaponList( pPlayer,  "weapon_ethereal" , 6, AMMO_WEAPON, -1, -1, 0 , 15, g_iWeaponID , 0 );         return HAM_HANDLED;     }     else     {         UTIL__WeaponList( pPlayer, WEAPON_BASE_NAME , 6, AMMO_WEAPON, -1, -1, 0 , 15, g_iWeaponID , 0 );     }         return HAM_IGNORED; }

And to be honest, g_pWeaponA is g_has_ethereal already
Now it's working perfectly

Thank you for your help
Itz 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 22:03.


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