Raised This Month: $403 Target: $400
 100% 

Gluon gun problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KhaledAwesome
Member
Join Date: Jul 2013
Old 07-12-2018 , 14:55   Gluon gun problem.
Reply With Quote #1

This is what happens when i do admin_gluon "my name" , i recieve an ordinary m249 it doesn't shoot at first but when you click R it reloads and goes back to normal m249 then it starts to be m249 why?


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <beams>
#include <fakemeta>
#include <hamsandwich>

// Access for admin flag
#define ADMIN_EGON            ADMIN_RESERVATION

// Weapon name. If you change it, dont forget to change it in HUD_SPRITES too!!!
new const EGON_NAME[]            = "weapon_egon"

// Weapon models
new const EGON_MODEL_V[]        = "models/v_egon.mdl"
new const EGON_MODEL_P[]        = "models/p_egon.mdl"
new const EGON_MODEL_W[]        = "models/w_egon.mdl"

// Weapon sounds
new const EGON_SOUND_OFF[]        = "weapons/egon_off1.wav"
new const EGON_SOUND_RUN[]        = "weapons/egon_run3.wav"
new const EGON_SOUND_STARTUP[]        = "weapons/egon_windup2.wav"

// Beam sprites
new const EGON_BEAM_SPRITE[]        = "sprites/xbeam1.spr"

// Weapon sprites
new const HUD_SPRITES[][]        =
{
    
"sprites/weapon_egon.txt",    // MUST match with EGON_NAME
    
"sprites/weapon_egon.spr"
};

// View model animation sequences
#define EGON_SEQ_DEPLOY            3
#define EGON_SEQ_SHOOT1            1    //primary attack
#define EGON_SEQ_SHOOT2            2    //secondary attack

// Ammo
#define EGON_DEFAULT_AMMO        100    // Ammo given when buy
#define EGON_MAX_CARRY            200    // Maximum ammo player can carry

// Damage
#define EGON_DAMAGE            20.0    // Primary attack
#define EGON_DAMAGE2            10.0    // Secondary attack

// Radius damage(only for primary attack)
#define EGON_RADIUS_DAMAGE        EGON_DAMAGE/4.0
#define EGON_RADIUS            128.0
    
// Ammo use
#define EGON_AMMOUSE            0.2    // Ammo use primary attack
#define EGON_AMMOUSE2            0.1    // Ammo use secondary attack

// How often damage will be done
#define EGON_PULSE_INTERVAL        0.1    // Secondary attack
#define EGON_DISCHARGE_INTERVAL        0.1    // Primary attack

// This also enables custom unused secondary attack which
// was supposed to be in Half-Life, but was cut. To disable
// it just comment this line.
#define USE_BETA_SECONDARY_ATTACK
//=====================================================================
new g_bsBlockAttack;

enum _:eFireState
{
    
FIRE_OFF 0,
    
FIRE_CHARGE
};

enum _:eFireMode
{
    
FIRE_WIDE 0,
    
FIRE_NARROW
};

new 
g_iMaxClients;
new 
gmsgWeaponList;
new 
gmsgShake;

const 
PRIMARY_WEAPONS_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)

new const 
WEAPON_ENT[]            = "weapon_m249";

#define m_rgpPlayerItems_CWeaponBox    34
#define m_pPlayer            41
#define m_flNextPrimaryAttack        46
#define m_flNextSecondaryAttack        47
#define m_flTimeWeaponIdle        48
#define m_iClip                51
#define m_iDefaultAmmo            56
#define m_iWeaponVolume            239
#define m_rgPlayerAmmoSlot        376

#define pev_fireState            pev_iuser2
#define pev_fireMode            pev_iuser3
#define pev_shakeTime            pev_fuser3
#define pev_pBeam            pev_euser1
#define pev_pNoise            pev_euser2
#define pev_flAmmoUseTime        pev_fuser2

#define EGON_IMPULSE            46928

#define ValidPrivateData(%0)        (pev_valid(%0) == 2)
#define IsEgon(%0)            (pev(%0, pev_iuser1) == EGON_IMPULSE)

#define GetOwner(%0)            (get_pdata_cbase(%0, 41, 4))

#define Instance(%0)            (%0 == -1 ? 0 : %0)
#define IsClient(%0)            (1 <= %0 <= g_iMaxClients)
#define STOP_SOUND(%0,%1,%2)        emit_sound(%0, %1, %2, 0.0, ATTN_NORM, SND_STOP, 0)
#define VectorMA(%0,%1,%2,%3)        (%3[0] = %0[0] + %1[0] * %2, %3[1] = %0[1] + %1[1] * %2, %3[2] = %0[2] + %1[2] * %2)
#define VectorAdd(%0,%1,%2)        (%2[0] = %0[0] + %1[0], %2[1] = %0[1] + %1[1], %2[2] = %0[2] + %1[2])
#define VectorSub(%0,%1,%2)        (%2[0] = %0[0] - %1[0], %2[1] = %0[1] - %1[1], %2[2] = %0[2] - %1[2])
#define VectorLength(%0)        (floatsqroot(%0[0]*%0[0] + %0[1]*%0[1] + %0[2]*%0[2]))  

#define FBitSet(%0,%1)            (%0 & (1 << (%1 & 31)))
#define SetBits(%0,%1)            (%0 |= (1 << (%1 & 31)))
#define ClearBits(%0,%1)        (%0 &= ~(1 << (%1 & 31)))

public plugin_precache()
{
    
precache_model(EGON_MODEL_V);
    
precache_model(EGON_MODEL_P);
    
precache_model(EGON_MODEL_W);
    
    
precache_sound(EGON_SOUND_OFF);
    
precache_sound(EGON_SOUND_RUN);
    
precache_sound(EGON_SOUND_STARTUP);
    
    
precache_model(EGON_BEAM_SPRITE);
    
    for (new 
0sizeof HUD_SPRITESi++)
        
precache_generic(HUD_SPRITES[i]);
        
        
    
RegisterHam(Ham_SpawnWEAPON_ENT"EgonSpawn");
}

public 
plugin_init()
{
    
register_plugin("[ZP[ Extra Item: Gluon Gun""1.0""NiHiLaNTh");
    
    
register_clcmd(EGON_NAME"EgonSwitch");
    
register_concmd("admin_gluon""EgonGive"ADMIN_EGON"<target> - Give a Gluon Gun to the player");
    
    
register_forward(FM_SetModel"fw_SetModel");
    
register_forward(FM_UpdateClientData"fw_UpdateClientData"1);
    
    
RegisterHam(Ham_Item_AddToPlayerWEAPON_ENT"EgonAddToPlayer"1);
    
RegisterHam(Ham_Item_DeployWEAPON_ENT"EgonDeploy"1);
    
RegisterHam(Ham_Item_HolsterWEAPON_ENT"EgonHolster");
    
RegisterHam(Ham_Weapon_PrimaryAttackWEAPON_ENT"EgonPrimaryAttack");
    
RegisterHam(Ham_Weapon_ReloadWEAPON_ENT"EgonReload");
    
#if defined USE_BETA_SECONDARY_ATTACK
    
RegisterHam(Ham_Item_PostFrameWEAPON_ENT"EgonPostFrame");
    
#endif
    
RegisterHam(Ham_Weapon_WeaponIdleWEAPON_ENT"EgonWeaponIdle");
    
    
gmsgWeaponList get_user_msgid("WeaponList");
    
gmsgShake get_user_msgid("ScreenShake");
    
    
g_iMaxClients get_maxplayers();
}

public 
EgonSwitch(pPlayer)
{
    
engclient_cmd(pPlayerWEAPON_ENT);
    return 
PLUGIN_HANDLED;
}

public 
EgonGive(pPlayeriLevelcId)
{
    if (!
cmd_access(pPlayeriLevelcId2))
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
szArg[32]; read_argv(1szArgcharsmax(szArg));
    new 
pTarget cmd_target(pPlayerszArg, (CMDTARGET_ONLY_ALIVE CMDTARGET_ALLOW_SELF));
    
    if (!
pTarget)
    {
        return 
PLUGIN_HANDLED;
    }
    
    
DropWeapons(pTarget);
    
GiveNamedItem(pTargetWEAPON_ENTEGON_IMPULSE);
    
    
client_print(pTargetprint_chat"[AMXX] ADMIN gave a you free gluon gun.");
    
    return 
PLUGIN_HANDLED;
}

public 
fw_SetModel(pEntity, const szModel[])
{
    if (!
pev_valid(pEntity))
        return 
FMRES_IGNORED;
        
    new 
szClass[32]; pev(pEntitypev_classnameszClasscharsmax(szClass));
    
    if (!
equal(szClass"weaponbox"))
        return 
FMRES_IGNORED;
    
    new 
pWeapon = -1;
    
    for (new 
06i++)
    {
        
pWeapon get_pdata_cbase(pEntitym_rgpPlayerItems_CWeaponBox i4);
        
        if (
pWeapon && IsEgon(pWeapon))
        {
            
engfunc(EngFunc_SetModelpEntityEGON_MODEL_W);
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;
}

public 
fw_UpdateClientData(pPlayerSendWeaponshClientData)
{
    if (!
FBitSet(g_bsBlockAttackpPlayer))
        return 
FMRES_IGNORED;
        
    
set_cd(hClientDataCD_flNextAttackget_gametime() + 0.001);
    return 
FMRES_HANDLED;
}

public 
EgonSpawn(pWeapon)
{
    if (!
IsEgon(pWeapon) || !ValidPrivateData(pWeapon))
        return;
        
    
set_pdata_int(pWeaponm_iClip, -14);
    
set_pdata_int(pWeaponm_iDefaultAmmoEGON_DEFAULT_AMMO4);
}

public 
EgonAddToPlayer(pWeaponpPlayer)
{
    if (
IsEgon(pWeapon))
    {
        
message_begin(MSG_ONEgmsgWeaponList, .player pPlayer);
        
write_string(EGON_NAME);
        
write_byte(3);
        
write_byte(EGON_MAX_CARRY);
        
write_byte(-1);
        
write_byte(-1);
        
write_byte(0);
        
write_byte(4);
        
write_byte(CSW_M249);
        
write_byte(0);
        
message_end();
    }
}

public 
EgonDeploy(pWeapon)
{
    if (!
IsEgon(pWeapon) || !ValidPrivateData(pWeapon))
        return;
        
    new 
pPlayer GetOwner(pWeapon);
    
    
SetBits(g_bsBlockAttackpPlayer);
    
    
set_pev(pPlayerpev_viewmodel2EGON_MODEL_V);
    
set_pev(pPlayerpev_weaponmodel2EGON_MODEL_P);
    
    
SendWeaponAnim(pPlayerEGON_SEQ_DEPLOY);
    
    
set_pev(pWeaponpev_fireStateFIRE_OFF);
}

public 
EgonHolster(pWeapon)
{
    if (!
IsEgon(pWeapon) || !ValidPrivateData(pWeapon))
        return;
        
    new 
pPlayer GetOwner(pWeapon);
    
    
ClearBits(g_bsBlockAttackpPlayer);
    
EndAttack(pWeaponpPlayerpev(pWeaponpev_fireState));
}

public 
EgonPrimaryAttack(pWeapon)
{
    if (!
IsEgon(pWeapon) || !ValidPrivateData(pWeapon))
        return 
HAM_IGNORED;
        
    
set_pev(pWeaponpev_fireModeFIRE_WIDE);
    
Attack(pWeaponGetOwner(pWeapon));
    return 
HAM_SUPERCEDE;
}

public 
EgonReload(pWeapon)
{
    if (!
IsEgon(pWeapon))
        return 
HAM_IGNORED;
        
    return 
HAM_SUPERCEDE;
}

#if defined USE_BETA_SECONDARY_ATTACK
public EgonPostFrame(pWeapon)
{
    if (!
IsEgon(pWeapon))
        return 
HAM_IGNORED;
        
    static 
pPlayerpPlayer GetOwner(pWeapon);
    static 
buttonsbuttons pev(pPlayerpev_button);
    
    if ((
buttons IN_ATTACK2) && get_pdata_float(pWeaponm_flNextSecondaryAttack4) <= 0.0)
    {
        
set_pev(pWeaponpev_fireModeFIRE_NARROW);
        
Attack(pWeaponpPlayer);
        
set_pev(pPlayerpev_buttonbuttons & ~IN_ATTACK2);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}
#endif

public EgonWeaponIdle(pWeapon)
{
    if (!
IsEgon(pWeapon) || !ValidPrivateData(pWeapon))
        return;
        
    static 
iFireState;    
    
    if ((
iFireState pev(pWeaponpev_fireState)) != FIRE_OFF)
        
EndAttack(pWeaponGetOwner(pWeapon), iFireState);
}

Attack(pWeaponpPlayer)
{
    new 
iFireState pev(pWeaponpev_fireState);
    
    if (
pev(pPlayerpev_waterlevel) == 3)
    {
        if (
iFireState != FIRE_OFF || pev_valid(pev(pWeaponpev_pBeam)))
        {
            
EndAttack(pWeaponpPlayeriFireState);
        }
        else
        {
            
ExecuteHam(Ham_Weapon_PlayEmptySoundpWeapon);
        }
        
        return;
    }
    
    new 
Float:tTime get_gametime();
    
    switch (
iFireState)
    {
        case 
FIRE_OFF:
        {
            if (!
HasAmmo(pPlayer))
            {
                
set_pdata_float(pWeaponm_flNextPrimaryAttack0.254);
                
set_pdata_float(pWeaponm_flNextSecondaryAttack0.254);
                
ExecuteHam(Ham_Weapon_PlayEmptySoundpWeapon);
                return;
            }
            
            
set_pev(pWeaponpev_flAmmoUseTimetTime);
            
            
EgonFireEvent(pPlayerpev(pWeaponpev_fireMode), true);
            
            
set_pev(pWeaponpev_shakeTime0.0);
            
set_pdata_int(pPlayerm_iWeaponVolume450);
            
set_pdata_float(pWeaponm_flTimeWeaponIdle0.14);
            
set_pev(pWeaponpev_fuser1get_gametime() + 2.0);
            
set_pev(pWeaponpev_dmgtimeget_gametime() + EGON_PULSE_INTERVAL);
            
set_pev(pWeaponpev_fireStateFIRE_CHARGE);
        }
        case 
FIRE_CHARGE:
        {
            
UTIL_MakeVectors(pPlayer);
            
            new 
Float:vecSrc[3]; GetGunPosition(pPlayervecSrc);
            new 
Float:vecAiming[3]; global_get(glb_v_forwardvecAiming);
            
            
Fire(pWeaponpPlayervecSrcvecAiming);
            
set_pdata_int(pPlayerm_iWeaponVolume450);
            
            new 
Float:flNextEventpev(pWeaponpev_fuser1flNextEvent);
            
            if (
flNextEvent <= get_gametime())
            {
                
EgonFireEvent(pPlayerpev(pWeaponpev_fireMode), false);
                
set_pev(pWeaponpev_fuser11000.0);
            }
            
            if (!
HasAmmo(pPlayer))
            {
                
EndAttack(pWeaponpPlayeriFireState);
                
set_pdata_float(pWeaponm_flNextPrimaryAttack1.04);
                
set_pdata_float(pWeaponm_flNextSecondaryAttack1.04);
            }
        }
    }
}

Fire(pWeaponpPlayerFloat:vecOrigSrc[3], Float:vecDir[3])
{
    new 
Float:vecDest[3]; VectorMA(vecOrigSrcvecDir2048.0vecDest);
    new 
tr create_tr2();
        
    
engfunc(EngFunc_TraceLinevecOrigSrcvecDestDONT_IGNORE_MONSTERSpPlayertr);
    
    if (
get_tr2(trTR_AllSolid))
        return;
    
    new 
pEntity Instance(get_tr2(trTR_pHit));
    new 
Float:timedist;
    new 
Float:flDMGTimepev(pWeaponpev_dmgtimeflDMGTime)
    new 
Float:tTime get_gametime();
    new 
Float:vecEndPos[3]; get_tr2(trTR_vecEndPosvecEndPos);
    
    switch (
pev(pWeaponpev_fireMode))
    {
        case 
FIRE_NARROW:
        {
            if (
flDMGTime tTime)
            {
                new 
Float:flTakeDamagepev(pEntitypev_takedamageflTakeDamage);
                
                if (
flTakeDamage != DAMAGE_NO)
                {
                    
ExecuteHamB(Ham_TraceAttackpEntitypPlayerEGON_DAMAGE2vecDirtrDMG_ENERGYBEAM);
                    
ExecuteHamB(Ham_TakeDamagepEntitypPlayerpPlayerEGON_DAMAGE2DMG_ENERGYBEAM);
                }
                
                new 
Float:flAmmoUseTimepev(pWeaponpev_flAmmoUseTimeflAmmoUseTime);
                
                if (
tTime >= flAmmoUseTime)
                {
                    
set_pdata_int(pPlayerm_rgPlayerAmmoSlot 3get_pdata_int(pPlayerm_rgPlayerAmmoSlot 3) - 1);
                    
set_pev(pWeaponpev_flAmmoUseTimetTime EGON_AMMOUSE2);
                }
                
                
set_pev(pWeaponpev_dmgtimetTime EGON_PULSE_INTERVAL);
            }
            
            
timedist = (flDMGTime tTime) / EGON_PULSE_INTERVAL;
        }
        case 
FIRE_WIDE:
        {
            if (
flDMGTime tTime)
            {
                new 
Float:flTakeDamagepev(pEntitypev_takedamageflTakeDamage);
                
                if (
flTakeDamage != DAMAGE_NO)
                {
                    
ExecuteHamB(Ham_TraceAttackpEntitypPlayerEGON_DAMAGEvecDirtrDMG_ENERGYBEAM|DMG_ALWAYSGIB);
                    
ExecuteHamB(Ham_TakeDamagepEntitypPlayerpPlayerEGON_DAMAGEDMG_ENERGYBEAM|DMG_ALWAYSGIB);
                }
                
                new 
Float:vecEndPos[3]; get_tr2(trTR_vecEndPosvecEndPos);
                
RadiusDamage3(vecEndPospWeaponpPlayerEGON_RADIUS_DAMAGEEGON_RADIUSDMG_ENERGYBEAM|DMG_ALWAYSGIB);
                
                if (!
ExecuteHam(Ham_IsAlivepPlayer))
                {
                    return;
                }
                
                new 
Float:flAmmoUseTimepev(pWeaponpev_flAmmoUseTimeflAmmoUseTime);
                
                if (
tTime >= flAmmoUseTime)
                {
                    
set_pdata_int(pPlayerm_rgPlayerAmmoSlot 3get_pdata_int(pPlayerm_rgPlayerAmmoSlot 3) - 1);
                    
set_pev(pWeaponpev_flAmmoUseTimetTime EGON_AMMOUSE);
                }
                
                
set_pev(pWeaponpev_dmgtimetTime EGON_DISCHARGE_INTERVAL);
                
                new 
Float:flShakeTimepev(pWeaponpev_shakeTimeflShakeTime);
                
                if (
flShakeTime tTime)
                {
                    
UTIL_ScreenShake(vecEndPos5.0150.00.75250.0);
                    
set_pev(pWeaponpev_shakeTimetTime 1.5);
                }
            }
            
            
timedist = (flDMGTime tTime) / EGON_DISCHARGE_INTERVAL;
        }
    }
    
    if (
timedist 0.0)
        
timedist 0.0;
    else if (
timedist 1.0)
        
timedist 1.0;
        
    
timedist 1.0 timedist;
    
    
UpdateEffect(pWeaponpPlayervecEndPostimedist);
    
free_tr2(tr);
}

UpdateEffect(pWeaponpPlayerFloat:endPoint[3], Float:timeBlend)
{
    new 
pBeam pev(pWeaponpev_pBeam);
    
    if (!
pev_valid(pBeam))
    {
        
CreateEffect(pWeaponpPlayer);
        
pBeam pev(pWeaponpev_pBeam);
        
        if (!
pev_valid(pBeam))
            return;
    }
    
    
Beam_SetStartPos(pBeamendPoint);
    
Beam_SetBrightness(pBeam255.0 - (timeBlend 180.0));
    
Beam_SetWidth(pBeam40.0 - (timeBlend 20.0));
        
    new 
Float:vecColor[3];    
        
    if (
pev(pWeaponpev_fireMode) == FIRE_WIDE)
    {
        
vecColor[0] = 30.0 + (25.0 timeBlend);
        
vecColor[1] = 30.0 + (30.0 timeBlend);
        
vecColor[2] = 64.0 80.0 floatabs(floatsin(get_gametime() * 1.0));
    }
    else
    {
        
vecColor[0] = 30.0 + (25.0 timeBlend);
        
vecColor[1] = 120.0 + (30.0 timeBlend);
        
vecColor[2] = 64.0 80.0 floatabs(floatsin(get_gametime() * 1.0));
    }
    
    
Beam_SetColor(pBeamvecColor);
    
    
pBeam pev(pWeaponpev_pNoise);
    if (
pev_valid(pBeam))
    {
        
Beam_SetStartPos(pBeamendPoint);
    }
}

CreateEffect(pWeaponpPlayer)
{
    
DestroyEffect(pWeapon);
    
    new 
Float:origin[3]; pev(pPlayerpev_originorigin);
    
    new 
pBeam Beam_Create(EGON_BEAM_SPRITE40.0);
    
Beam_PointEntInit(pBeamoriginpPlayer);
    
Beam_SetFlags(pBeamBEAM_FSINE);
    
Beam_SetEndAttachment(pBeam1);
    
set_pev(pBeampev_spawnflagspev(pBeampev_spawnflags) | SF_BEAM_TEMPORARY);
    
set_pev(pBeampev_ownerpPlayer);
    
    new 
pNoise Beam_Create(EGON_BEAM_SPRITE55.0);
    
Beam_PointEntInit(pNoiseoriginpPlayer);
    
Beam_SetScrollRate(pNoise25.0);
    
Beam_SetBrightness(pNoise100.0);
    
Beam_SetEndAttachment(pNoise1);
    
set_pev(pNoisepev_spawnflagspev(pNoisepev_spawnflags) | SF_BEAM_TEMPORARY);
    
set_pev(pNoisepev_ownerpPlayer);
    
    if (
pev(pWeaponpev_fireMode) == FIRE_WIDE)
    {
        
Beam_SetScrollRate(pBeam50.0);
        
Beam_SetNoise(pBeam20);
        
Beam_SetColor(pNoiseFloat:{50.050.0255.0});
        
Beam_SetNoise(pNoise8);
    }
    else
    {
        
Beam_SetScrollRate(pBeam110.0);
        
Beam_SetNoise(pBeam5);
        
Beam_SetColor(pNoiseFloat:{80.0120.0255.0});
        
Beam_SetNoise(pNoise2);
    }
    
    
set_pev(pWeaponpev_pBeampBeam);
    
set_pev(pWeaponpev_pNoisepNoise);
}

EndAttack(pWeaponpPlayeriFireState)
{
    if (
iFireState != FIRE_OFF)
    {
        
set_pev(pWeaponpev_fireStateFIRE_OFF);
        
        
STOP_SOUND(pPlayerCHAN_STATICEGON_SOUND_RUN);
        
emit_sound(pPlayerCHAN_WEAPONEGON_SOUND_OFF0.98ATTN_NORM0100);
    }
    
    
set_pdata_float(pWeaponm_flTimeWeaponIdle2.04);
    
set_pdata_float(pWeaponm_flNextPrimaryAttack0.54);
    
set_pdata_float(pWeaponm_flNextSecondaryAttack0.54);
    
    
DestroyEffect(pWeapon);
}

DestroyEffect(pWeapon)
{
    new 
pBeam pev(pWeaponpev_pBeam);
    
    if (
pev_valid(pBeam))
    {
        
engfunc(EngFunc_RemoveEntitypBeam);
        
set_pev(pWeaponpev_pBeam, -1);
    }
    
    new 
pNoise pev(pWeaponpev_pNoise);
    
    if (
pev_valid(pNoise))
    {
        
engfunc(EngFunc_RemoveEntitypNoise);
        
set_pev(pWeaponpev_pNoise, -1);
    }
}

EgonFireEvent(pPlayeriFireModebool:bStartup)
{
    if (
bStartup)
    {
        if (
iFireMode == FIRE_WIDE)
            
emit_sound(pPlayerCHAN_WEAPONEGON_SOUND_STARTUP0.98ATTN_NORM0125);
        else
            
emit_sound(pPlayerCHAN_WEAPONEGON_SOUND_STARTUP0.9ATTN_NORM0100);
    }
    else
    {
        if (
iFireMode == FIRE_WIDE)
            
emit_sound(pPlayerCHAN_STATICEGON_SOUND_RUN0.98ATTN_NORM0125);
        else
            
emit_sound(pPlayerCHAN_STATICEGON_SOUND_RUN0.9ATTN_NORM0100);
    }
    
    
SendWeaponAnim(pPlayeriFireMode == FIRE_WIDE EGON_SEQ_SHOOT1 EGON_SEQ_SHOOT2);
}

bool:HasAmmo(pPlayer)
{
    if (
get_pdata_int(pPlayerm_rgPlayerAmmoSlot 3) <= 0)
        return 
false;
    
    return 
true;
}

GetGunPosition(pPlayerFloat:vecSrc[3])
{
    new 
Float:origin[3]; pev(pPlayerpev_originorigin);
    new 
Float:view_ofs[3]; pev(pPlayerpev_view_ofsview_ofs);
    
    
VectorAdd(originview_ofsvecSrc);
}

SendWeaponAnim(pPlayeriAnimIndex)
{
    
set_pev(pPlayerpev_weaponanimiAnimIndex);
    
    
message_begin(MSG_ONESVC_WEAPONANIM, .player pPlayer);
    
write_byte(iAnimIndex);
    
write_byte(0);
    
message_end();
    
    
//TODO. Add weapon anims for the observers
}

BodyTarget(pEntityFloat:vecSrc[3])
{
    new 
Float:origin[3]; pev(pEntitypev_originorigin);
    
    if (
IsClient(pEntity))
    {
        new 
Float:view_ofs[3]; pev(pEntitypev_view_ofsview_ofs);
        
        
VectorAdd(originview_ofsorigin);
    }
    
    
vecSrc origin;
}

RadiusDamage3(Float:vecSrc[3], pevInflictorpevAttackerFloat:flDamageFloat:flRadiusbitsDamageType)
{
    new 
pEntity = -1;
    new 
tr create_tr2();
    new 
Float:flAdjustedDamageFloat:falloff;
    new 
Float:vecSpot[3];
    
    if (
flRadius 0)
        
falloff flDamage flRadius;
    else
        
falloff 1.0;
        
    new 
bool:bInWater bool:(engfunc(EngFunc_PointContentsvecSrc) == CONTENTS_WATER);
    
    
vecSrc[2] += 1.0;
    
    if (!
pevAttacker)
        
pevAttacker pevInflictor;
        
    while ((
pEntity engfunc(EngFunc_FindEntityInSpherepEntityvecSrcflRadius)) != 0)
    {
        static 
Float:flTakeDamagepev(pEntitypev_takedamageflTakeDamage);
        
        if (
flTakeDamage != DAMAGE_NO)
        {
            if (
bInWater && pev(pEntitypev_waterlevel) == 0)
                continue;
                
            if (!
bInWater && pev(pEntitypev_waterlevel) == 3)
                continue;
        
            
BodyTarget(pEntityvecSrc);
            
engfunc(EngFunc_TraceLinevecSrcvecSpotDONT_IGNORE_MONSTERSpevInflictortr);
            
            static 
Float:flFractionget_tr2(trTR_flFractionflFraction);
            
            if (
flFraction == 1.0 || get_tr2(trTR_pHit) == pEntity)
            {
                if (
get_tr2(trTR_StartSolid))
                {
                    
set_tr2(trTR_vecEndPosvecSrc);
                    
set_tr2(trTR_flFraction0.0);
                    
                    
flFraction 0.0;
                }
                
                static 
Float:vecEnd[3]; get_tr2(trTR_vecEndPosvecEnd);
                
                
VectorSub(vecSrcvecEndvecEnd);
            
                
flAdjustedDamage VectorLength(vecEnd) * falloff;
                
flAdjustedDamage flDamage flAdjustedDamage;
                
                if (
flAdjustedDamage 0)
                {
                    
flAdjustedDamage 0.0;
                }
            
                
ExecuteHamB(Ham_TakeDamagepEntitypevInflictorpevAttackerflAdjustedDamagebitsDamageType);
            }
        }
    }
}                    

UTIL_MakeVectors(pPlayer)
{
    new 
Float:v_angle[3], Float:punchangle[3];
    
    
pev(pPlayerpev_v_anglev_angle);
    
pev(pPlayerpev_punchanglepunchangle);
    
    
VectorAdd(v_anglepunchanglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);
}

UTIL_ScreenShake(Float:center[3], Float:amplitudeFloat:frequencyFloat:durationFloat:radius)
{
    new 
i;
    new 
Float:localAmplitude;
    new 
finalDuration FixedUnsigned16(duration1<<12);
    new 
finalFrequency FixedUnsigned16(frequency1<<8);
    
    for (
1<= g_iMaxClientsi++)
    {
        if (!
is_user_alive(i) || !(pev(ipev_flags) & FL_ONGROUND))
            continue;
            
        
localAmplitude 0.0;
        
        if (
radius <= 0)
        {
            
localAmplitude amplitude;
        }
        else
        {
            static 
Float:delta[3], Float:origin[3];
            
pev(ipev_originorigin);
            
VectorSub(centerorigindelta);
            
            static 
Float:distancedistance VectorLength(delta);
            
            if (
distance radius)
                
localAmplitude amplitude;
        }
            
        if (
localAmplitude)
        {
            static 
finalAmplitudefinalAmplitude FixedUnsigned16(localAmplitude1<<12);
            
            
message_begin(MSG_ONEgmsgShake, .player i);
            
write_short(finalAmplitude);
            
write_short(finalDuration);
            
write_short(finalFrequency);
            
message_end();
        }
    }
}

FixedUnsigned16(Float:valuescale)
{
    new 
output floatround(value scale);
    
    if (
output 0)
        
output 0;
    else if (
output 0xFFFF)
        
output 0xFFFF;

    return 
output;
}

DropWeapons(pPlayer)
{
    new 
aWeapons[32], numWeaponsindexiWeaponIndex;
    
    
get_user_weapons(pPlayeraWeaponsnumWeapons);
    
    for (
index 0index numWeaponsindex++)
    {
        
iWeaponIndex aWeapons[index];
        
        if ((
1<<iWeaponIndex) & PRIMARY_WEAPONS_BITSUM)
        {
            new 
szWeapon[32];
            
get_weaponname(iWeaponIndexszWeaponcharsmax(szWeapon));
            
engclient_cmd(pPlayer"drop"szWeapon);
        }
    }
}

GiveNamedItem(pPlayer, const szWeapon[], iWeaponIndex)
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringszWeapon));
    
    if (!
pev_valid(pEntity))
    {
        return 
0;
    }
    
    new 
Float:vecSrc[3]; pev(pPlayerpev_originvecSrc);
    
    
set_pev(pEntitypev_originvecSrc);
    
set_pev(pEntitypev_iuser1iWeaponIndex);
    
set_pev(pEntitypev_spawnflagspev(pEntitypev_spawnflags) | SF_NORESPAWN);
    
    
dllfunc(DLLFunc_SpawnpEntity);
    
    new 
iSavedSolid pev(pEntitypev_solid);
    
    
dllfunc(DLLFunc_TouchpEntitypPlayer);
    
    if (
pev(pEntitypev_solid) != iSavedSolid)
    {
        return 
pEntity;
    }
    
    
engfunc(EngFunc_RemoveEntitypEntity);
    return -
1;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 
https://imgur.com/a/hZisKDj

Last edited by KhaledAwesome; 07-12-2018 at 14:56.
KhaledAwesome is offline
Reply


Thread Tools
Display Modes

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 03:10.


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