бесконечные патроны

Сообщения
78
Реакции
1
переделал плагин под миниган, но при стрельбе патроны не уменьшаються, хотя в хуке прописывается что патронов там должно быть 200, но ставиться именно 56, с чем это может быть связано?
C#:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <reapi>

#define GetPlayer(%0)                   get_member( %0, m_pPlayer )
#define GetCharge(%0)                   get_member( %0, m_Weapon_iWeaponState )
#define SetCharge(%0,%1)                set_member( %0, m_Weapon_iWeaponState, %1 )
#define INSTANCE(%0)                    ( ( %0 == -1 ) ? 0 : %0 )
#define IsCustomWeapon(%0,%1)            bool: ( get_entvar( %0, var_impulse ) == %1 )
#define GetWeaponClip(%0)                get_member( %0, m_Weapon_iClip )
#define SetWeaponClip(%0,%1)            set_member( %0, m_Weapon_iClip, %1 )
#define GetWeaponAmmoType(%0)            get_member( %0, m_Weapon_iPrimaryAmmoType )
#define SetWeaponAmmoType(%0,%1)        set_member( %0, m_Weapon_iPrimaryAmmoType, %1 )
#define GetWeaponAmmo(%0,%1)            get_member( %0, m_rgAmmo, %1 )
#define SetWeaponAmmo(%0,%1,%2)            set_member( %0, m_rgAmmo, %1, %2 )

enum {  
    WEAPON_ANIM_IDLE,
    WEAPON_ANIM_DRAW,
    WEAPON_ANIM_SHOOT,
    WEAPON_ANIM_RELOAD,
    WEAPON_ANIM_FIRE_READY,
    WEAPON_ANIM_IDLE_CHANGE,
    WEAPON_ANIM_FIRE_CHANGE
};

new const Float: WEAPON_ANIM_TIME[ ] = {
    10.0,   // Idle
    1.0,    // Deploy
    5.0,    // Reload
    1.8,    // FireReady
    1.5,    // FireEnd
    0.5     // Charge
};

new const WEAPON_REFERENCE[ ] = "weapon_m249";
new const WEAPON_WEAPONLIST[ ] = "weapon_m134";
new const WEAPON_MODEL_VIEW[ ] = "models/M134/v_m134.mdl";
new const WEAPON_MODEL_PLAYER[ ] = "models/M134/p_m134.mdl";
new const WEAPON_MODEL_WORLD[ ] = "models/M134/w_m134.mdl";
new const WEAPON_SOUNDS[ ][ ] = {
    "weapons/m134-1.wav",
    "weapons/m134_spinup.wav",
    "weapons/m134_spindown.wav",
    "weapons/m134_pinpull.wav",
    "weapons/m134_clipoff.wav",
    "weapons/m134_clipon.wav"
};

const WEAPON_MODEL_WORLD_BODY = 0;

const WEAPON_CLIP = 200; // Патроны в обойме.
const WEAPON_AMMO = 200; // Запасные патроны.
const Float: WEAPON_DAMAGE = 10.0; // Урон
const WEAPON_DMG_TYPE = ( DMG_BULLET | DMG_NEVERGIB );
const Float: WEAPON_FIRE_RATE = 0.09; // Скорострельность.
const Float: WEAPON_MOVE_SPEED = 225.0; // Скорость бега.

new g_iAllocString_WeaponUID;

public plugin_init( ) {
    register_clcmd("m134_new", "Native__GiveWeapon")

    register_forward( FM_UpdateClientData, "UpdateClientData_Post", true );

    RegisterHookChain( RG_CWeaponBox_SetModel, "CWeaponBox__SetModel_Pre", false );

    RegisterHam( Ham_Spawn, WEAPON_REFERENCE, "CBasePlayerWeapon__Spawn_Post", true );
    RegisterHam( Ham_Item_Deploy, WEAPON_REFERENCE, "CBasePlayerWeapon__Deploy_Post", true );
    RegisterHam( Ham_Item_Holster, WEAPON_REFERENCE, "CBasePlayerWeapon__Holster_Post", true );
    RegisterHam( Ham_Item_AddToPlayer, WEAPON_REFERENCE, "CBasePlayerWeapon__AddToPlayer_Post", true );

    RegisterHam( Ham_Weapon_Reload, WEAPON_REFERENCE, "CBasePlayerWeapon__Reload_Pre", false );
    RegisterHam( Ham_Weapon_WeaponIdle, WEAPON_REFERENCE, "CBasePlayerWeapon__WeaponIdle_Pre", false );
    RegisterHam( Ham_Weapon_PrimaryAttack, WEAPON_REFERENCE, "CBasePlayerWeapon__PrimaryAttack_Pre", false );
    RegisterHam( Ham_Weapon_SecondaryAttack, WEAPON_REFERENCE, "CBasePlayerHam_Weapon_SecondaryAttack_Pre", false );

    g_iAllocString_WeaponUID = engfunc( EngFunc_AllocString, WEAPON_WEAPONLIST );
}

public plugin_precache( ) {
    engfunc( EngFunc_PrecacheModel, WEAPON_MODEL_VIEW );
    engfunc( EngFunc_PrecacheModel, WEAPON_MODEL_PLAYER );
    engfunc( EngFunc_PrecacheModel, WEAPON_MODEL_WORLD );

    for ( new i; i < sizeof WEAPON_SOUNDS; i++ )
        engfunc( EngFunc_PrecacheSound, WEAPON_SOUNDS[ i ] );

    UTIL_PrecacheWeaponlist( WEAPON_WEAPONLIST );
}

public plugin_natives( ) register_native( "give_user_m134predator", "Native__GiveWeapon" );

public Native__GiveWeapon( id )
    return rg_give_custom_item( id, WEAPON_REFERENCE, GT_DROP_AND_REPLACE, g_iAllocString_WeaponUID );

public UpdateClientData_Post( const pPlayer, const iSendWeapons, const CD_Handle ) {
    if ( !is_user_alive( pPlayer ) )
        return;

    static pActiveItem; pActiveItem = get_member( pPlayer, m_pActiveItem );
    if ( is_nullent( pActiveItem ) || !IsCustomWeapon( pActiveItem, g_iAllocString_WeaponUID ) )
        return;

    set_cd( CD_Handle, CD_flNextAttack, get_gametime( ) + 0.001  );
}

public CWeaponBox__SetModel_Pre( const pWeaponBox, const szModel[ ] ) {
    if ( !IsCustomWeapon( UTIL_GetWeaponBoxItem( pWeaponBox ), g_iAllocString_WeaponUID ) )
        return HC_CONTINUE;

    SetHookChainArg( 2, ATYPE_STRING, WEAPON_MODEL_WORLD );
    set_entvar( pWeaponBox, var_body, WEAPON_MODEL_WORLD_BODY );

    return HC_CONTINUE;
}

public CBasePlayerWeapon__Spawn_Post( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return;

    SetWeaponClip( pItem, WEAPON_CLIP );
    set_member( pItem, m_Weapon_iDefaultAmmo, WEAPON_AMMO );
    set_member( pItem, m_Weapon_bHasSecondaryAttack, true );

    set_entvar( pItem, var_classname, WEAPON_WEAPONLIST );

    rg_set_iteminfo( pItem, ItemInfo_pszName, WEAPON_WEAPONLIST );
    rg_set_iteminfo( pItem, ItemInfo_iMaxClip, WEAPON_CLIP );
    rg_set_iteminfo( pItem, ItemInfo_iMaxAmmo1, WEAPON_AMMO );
}

public CBasePlayerWeapon__Deploy_Post( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return;

    new pPlayer = GetPlayer( pItem );

    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_DRAW );

    set_entvar( pPlayer, var_viewmodel, WEAPON_MODEL_VIEW );
    set_entvar( pPlayer, var_weaponmodel, WEAPON_MODEL_PLAYER );

    set_member( pPlayer, m_flNextAttack, WEAPON_ANIM_TIME[ 1 ] );

    set_member( pItem, m_Weapon_fMaxSpeed, WEAPON_MOVE_SPEED );
    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 1 ] );

    set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_ANIM_TIME[ 1 ] );
    set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 1 ] );
}

public CBasePlayerWeapon__Holster_Post( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return;

    SetCharge( pItem, 0 );
}

public CBasePlayerWeapon__AddToPlayer_Post( const pItem ) {
    new iWeaponUID = get_entvar( pItem, var_impulse );
    if ( iWeaponUID != 0 && iWeaponUID != g_iAllocString_WeaponUID )
        return;

    new pPlayer = GetPlayer( pItem );

    UTIL_WeaponList( pPlayer, pItem );
}

public CBasePlayerWeapon__Reload_Pre( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return HAM_IGNORED;

    new pPlayer = GetPlayer( pItem );
    new iClip = GetWeaponClip( pItem );
    new iAmmoType = GetWeaponAmmoType( pItem );
    new iAmmo = GetWeaponAmmo( pPlayer, iAmmoType );
   
    if ( iAmmo <= 0 || iClip == rg_get_iteminfo( pItem, ItemInfo_iMaxClip ) )
        return HAM_IGNORED;

    if ( GetCharge( pItem ) ) {
        CBasePlayerWeapon__ShootEnd( pItem, pPlayer );
        return HAM_IGNORED;
    }

    ExecuteHam( Ham_Weapon_Reload, pItem );

    set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_ANIM_TIME[ 2 ] );
    set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 2 ] );
    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 2 ] );

    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_RELOAD );

    return HAM_SUPERCEDE;
}

public CBasePlayerWeapon__WeaponIdle_Pre( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return HAM_IGNORED;

    if ( get_member( pItem, m_Weapon_flNextPrimaryAttack ) > 0.0 )
        return HAM_IGNORED;

    new pPlayer = GetPlayer( pItem );

    if ( GetCharge( pItem ) ) {
        CBasePlayerWeapon__ShootEnd( pItem, pPlayer );
        return HAM_IGNORED;
    }

    if ( get_member( pItem, m_Weapon_flTimeWeaponIdle ) > 0.0 )
        return HAM_IGNORED;

    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_IDLE );
    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 0 ] );

    return HAM_SUPERCEDE;
}

public CBasePlayerWeapon__PrimaryAttack_Pre( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return HAM_IGNORED;

    new pPlayer = GetPlayer( pItem )

    switch( GetCharge( pItem ) ) {
        case 0: {
            UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_FIRE_READY );
            rg_send_audio( pPlayer, WEAPON_SOUNDS[ 1 ]);

            set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 3 ] );
            set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_ANIM_TIME[ 3 ] );
            set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 3 ] );

            SetCharge( pItem, 1 );
        }
        case 1: {
            CBasePlayerWeapon__Shoot( pItem, pPlayer );
        }
    }
    return HAM_SUPERCEDE;
}

public CBasePlayerHam_Weapon_SecondaryAttack_Pre( const pItem ) {
    if ( !IsCustomWeapon( pItem, g_iAllocString_WeaponUID ) )
        return HAM_IGNORED;

    new pPlayer = GetPlayer( pItem );

    switch( GetCharge( pItem ) ) {
        case 0: {
            UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_FIRE_READY );
            rg_send_audio( pPlayer, WEAPON_SOUNDS[ 1 ]);

            set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 3 ] );
            set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_ANIM_TIME[ 3 ] );
            set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 3 ] );

            SetCharge( pItem, 1 );
        }
        case 1: {
            UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_FIRE_CHANGE );

            set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 5 ] );
        }
    }
    return HAM_SUPERCEDE;
}

/*                 STOCK                      */

stock CBasePlayerWeapon__Shoot( const pItem, const pPlayer ) {
    static iClip; iClip = GetWeaponClip( pItem );
    if ( !iClip ) {
        CBasePlayerWeapon__ShootEnd( pItem, pPlayer );
        return;
    }

    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_SHOOT );
    rg_send_audio( pPlayer, WEAPON_SOUNDS[ 0 ]);
    UTIL_FireBuckshots( pPlayer, pItem, Float: { 0.05, 0.05, 0.0 }, 3000.0, WEAPON_DAMAGE, WEAPON_DMG_TYPE );

    new Float: vecPunchAngle[ 3 ]; get_entvar( pPlayer, var_punchangle, vecPunchAngle );
    vecPunchAngle[ 0 ] -= random_float( 0.25, 0.75 );
    set_entvar( pPlayer, var_punchangle, vecPunchAngle );

    set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_FIRE_RATE );
    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_FIRE_RATE + 0.5 );
    SetWeaponClip( pItem, iClip-- );
}

stock CBasePlayerWeapon__ShootEnd( const pItem, const pPlayer ) {
    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_IDLE_CHANGE );
    rg_send_audio( pPlayer, WEAPON_SOUNDS[ 2 ], PITCH_LOW);

    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_ANIM_TIME[ 4 ] );
    set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_ANIM_TIME[ 4 ] );
    set_member( pItem, m_Weapon_flNextSecondaryAttack, WEAPON_ANIM_TIME[ 4 ] );

    SetCharge( pItem, 0 );
}

stock UTIL_SendWeaponAnim( const pPlayer, const iAnim ) {
    set_entvar( pPlayer, var_weaponanim, iAnim );

    message_begin( MSG_ONE, SVC_WEAPONANIM, _, pPlayer );
    write_byte( iAnim );
    write_byte( 0 );
    message_end( );
}

stock UTIL_PrecacheWeaponlist( const szWeaponList[ ] ) {
    new szBuffer[ 128 ], pFile;
    format( szBuffer, charsmax( szBuffer ), "sprites/%s.txt", szWeaponList );
    engfunc( EngFunc_PrecacheGeneric, szBuffer );

    if ( !( pFile = fopen( szBuffer, "rb" ) ) )
        return;

    new szSprName[ 64 ], iPos;
    while ( !feof( pFile ) ) {
        fgets( pFile, szBuffer, charsmax( szBuffer ) );
        trim( szBuffer );

        if ( !strlen( szBuffer ) )
            continue;

        if ( ( iPos = containi( szBuffer, "640" ) ) == -1 )
            continue;
               
        format( szBuffer, charsmax( szBuffer ), "%s", szBuffer[ iPos + 3 ] );      
        trim( szBuffer );

        strtok( szBuffer, szSprName, charsmax( szSprName ), szBuffer, charsmax( szBuffer ), ' ', 1 );
        trim( szSprName );

        engfunc( EngFunc_PrecacheGeneric, fmt( "sprites/%s.spr", szSprName ) );
    }
    fclose( pFile );
}

stock UTIL_WeaponList( const pPlayer, const pItem )  {
    static iMsgID_Weaponlist; if ( !iMsgID_Weaponlist ) iMsgID_Weaponlist = get_user_msgid( "WeaponList" );
    new szWeaponName[ 32 ]; rg_get_iteminfo( pItem, ItemInfo_pszName, szWeaponName, charsmax( szWeaponName ) );

    message_begin( MSG_ONE, iMsgID_Weaponlist, _, pPlayer );
    write_string( szWeaponName );
    write_byte( GetWeaponAmmoType( pItem ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iMaxAmmo1 ) );
    write_byte( get_member( pItem, m_Weapon_iSecondaryAmmoType ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iMaxAmmo2 ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iSlot ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iPosition ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iId ) );
    write_byte( rg_get_iteminfo( pItem, ItemInfo_iFlags ) );
    message_end( );
}

stock UTIL_GetWeaponBoxItem( const pWeaponBox ) {
    for ( new iSlot, pItem; iSlot < MAX_ITEM_TYPES; iSlot++ ) {
        if ( !is_nullent( ( pItem = get_member( pWeaponBox, m_WeaponBox_rgpPlayerItems, iSlot ) ) ) )
            return pItem;
    }
    return NULLENT;
}

stock UTIL_FireBuckshots( const pPlayer, const pItem, const Float: vecSpread[ 3 ] = NULL_VECTOR, const Float: flDistance, const Float: flBaseDamage, const bitsDamageType ) {
    new Float: vecOrigin[ 3 ]; get_entvar( pPlayer, var_origin, vecOrigin );
    new Float: vecViewOfs[ 3 ]; get_entvar( pPlayer, var_view_ofs, vecViewOfs );
    xs_vec_add( vecOrigin, vecViewOfs, vecOrigin );

    new Float: vecPunchAngle[ 3 ]; get_entvar( pPlayer, var_punchangle, vecPunchAngle );
    new Float: vecViewAngle[ 3 ]; get_entvar( pPlayer, var_v_angle, vecViewAngle );
    xs_vec_add( vecViewAngle, vecPunchAngle, vecViewAngle );

    new Float: vecForward[ 3 ], Float: vecRight[ 3 ], Float: vecUp[ 3 ];
    engfunc( EngFunc_AngleVectors, vecViewAngle, vecForward, vecRight, vecUp );

    new Float: flXYZ[ 3 ], Float: vecDirection[ 3 ], Float: vecEndPos[ 3 ], Float: vecPlaneNormal[ 3 ];
    new pTrace = create_tr2( ), pHit, Float: flFraction, Float: flDamage;

    rg_multidmg_clear( );
    do {
        flXYZ[ 0 ] = random_float( -0.5, 0.5 ) + random_float( -0.5, 0.5 );
        flXYZ[ 1 ] = random_float( -0.5, 0.5 ) + random_float( -0.5, 0.5 );
        flXYZ[ 2 ] = flXYZ[ 0 ] * flXYZ[ 0 ] + flXYZ[ 1 ] * flXYZ[ 1 ];
    } while ( flXYZ[ 2 ] > 1.0 );

    vecDirection[ 0 ] = vecForward[ 0 ] + flXYZ[ 0 ] * vecSpread[ 0 ] * vecRight[ 0 ] + flXYZ[ 1 ] * vecSpread[ 1 ] * vecUp[ 0 ];
    vecDirection[ 1 ] = vecForward[ 1 ] + flXYZ[ 0 ] * vecSpread[ 0 ] * vecRight[ 1 ] + flXYZ[ 1 ] * vecSpread[ 1 ] * vecUp[ 1 ];
    vecDirection[ 2 ] = vecForward[ 2 ] + flXYZ[ 0 ] * vecSpread[ 0 ] * vecRight[ 2 ] + flXYZ[ 1 ] * vecSpread[ 1 ] * vecUp[ 2 ];

    xs_vec_add_scaled( vecOrigin, vecDirection, flDistance, vecEndPos );

    engfunc( EngFunc_TraceLine, vecOrigin, vecEndPos, DONT_IGNORE_MONSTERS, pPlayer, pTrace );
    get_tr2( pTrace, TR_flFraction, flFraction );

    if ( flFraction != 1.0 ) {
        pHit = INSTANCE( get_tr2( pTrace, TR_pHit ) );
        flDamage = ( ( 1.0 - flFraction ) * flBaseDamage );

        ExecuteHamB( Ham_TraceAttack, pHit, pPlayer, flDamage, vecDirection, pTrace, bitsDamageType );

        get_tr2( pTrace, TR_vecEndPos, vecEndPos );

        if ( engfunc( EngFunc_PointContents, vecEndPos ) != CONTENTS_SKY ) {
            get_tr2( pTrace, TR_vecPlaneNormal, vecPlaneNormal );
            UTIL_HitWallEffects( pHit, vecEndPos, .vecDirection = vecPlaneNormal );
        }
    }
    free_tr2( pTrace );
    rg_multidmg_apply( pItem, pPlayer );
}

stock UTIL_HitWallEffects( const pEntity, const Float: vecOrigin[ 3 ], const bool: bSparks = true, Float: vecDirection[ 3 ], const iColor = 4 ) {
    if ( pEntity && is_nullent( pEntity ) || ( get_entvar( pEntity, var_flags ) & FL_KILLME ) || !ExecuteHam( Ham_IsBSPModel, pEntity ) )
        return;

    new iDecalID = UTIL_DamageDecal( pEntity );
    if ( iDecalID == -1 )
        return;

    message_begin_f( MSG_PAS, SVC_TEMPENTITY, vecOrigin );
    UTIL_TE_GUNSHOTDECAL( vecOrigin, pEntity, iDecalID );

    if ( bSparks ) {
        xs_vec_mul_scalar( vecDirection, random_float( 25.0, 30.0 ), vecDirection );
        message_begin_f( MSG_PAS, SVC_TEMPENTITY, vecOrigin );
        UTIL_TE_STREAK_SPLASH( vecOrigin, vecDirection, iColor, random_num( 10, 20 ), 3, 64 );
    }
}

stock UTIL_DamageDecal( const pEntity ) {
    new iRenderMode = get_entvar( pEntity, var_rendermode );
    if ( iRenderMode == kRenderTransAlpha )
        return -1;

    static iGlassDecalID; if ( !iGlassDecalID ) iGlassDecalID = engfunc( EngFunc_DecalIndex, "{bproof1" );
    if ( iRenderMode != kRenderNormal )
        return iGlassDecalID;

    static iShotDecalID; if ( !iShotDecalID ) iShotDecalID = engfunc( EngFunc_DecalIndex, "{shot1" );
    return ( iShotDecalID - random_num( 0, 4 ) );
}

stock UTIL_TE_GUNSHOTDECAL( const Float: vecOrigin[ 3 ], const pEntity, const iDecalID ) {
    write_byte( TE_GUNSHOTDECAL );
    write_coord_f( vecOrigin[ 0 ] );
    write_coord_f( vecOrigin[ 1 ] );
    write_coord_f( vecOrigin[ 2 ] );
    write_short( pEntity );
    write_byte( iDecalID );
    message_end( );
}

stock UTIL_TE_STREAK_SPLASH( const Float: vecOrigin[ 3 ], const Float: vecDirection[ 3 ], const iColor, const iCount, const iSpeed, const iNoise ) {
    write_byte( TE_STREAK_SPLASH );
    write_coord_f( vecOrigin[ 0 ] );
    write_coord_f( vecOrigin[ 1 ] );
    write_coord_f( vecOrigin[ 2 ] );
    write_coord_f( vecDirection[ 0 ] );
    write_coord_f( vecDirection[ 1 ] );
    write_coord_f( vecDirection[ 2 ] );
    write_byte( iColor );
    write_short( iCount );
    write_short( iSpeed );
    write_short( iNoise );
    message_end( );
}
 
Сообщения
3,593
Реакции
1,576
Помог
141 раз(а)
Связано с тем, что на клиенте не отображается количество патронов свыше 128. Они начинают визуально убавляться, т.е. 129 патронов показывает как 127 и т.д.
 
Сообщения
78
Реакции
1
Nordic Warrior, хорошо, но даже если поставить 100 патронов, всё ровно ставиться 56, и при стрельбе не уменьшается
 
Сообщения
78
Реакции
1
всё, нашёл проблему, исправил
 
Сообщения
78
Реакции
1
C#:
stock CBasePlayerWeapon__Shoot( const pItem, const pPlayer ) {
    static iClip; iClip = GetWeaponClip( pItem );
    if ( !iClip ) {
        CBasePlayerWeapon__ShootEnd( pItem, pPlayer );
        return;
    }

    UTIL_SendWeaponAnim( pPlayer, WEAPON_ANIM_SHOOT );
    rg_send_audio( pPlayer, WEAPON_SOUNDS[ 0 ]);
    UTIL_FireBuckshots( pPlayer, pItem, Float: { 0.05, 0.05, 0.0 }, 3000.0, WEAPON_DAMAGE, WEAPON_DMG_TYPE );

    new Float: vecPunchAngle[ 3 ]; get_entvar( pPlayer, var_punchangle, vecPunchAngle );
    vecPunchAngle[ 0 ] -= random_float( 0.25, 0.75 );
    set_entvar( pPlayer, var_punchangle, vecPunchAngle );

    set_member( pItem, m_Weapon_flNextPrimaryAttack, WEAPON_FIRE_RATE );
    set_member( pItem, m_Weapon_flTimeWeaponIdle, WEAPON_FIRE_RATE + 0.5 );
    SetWeaponClip( pItem, iClip-- );
}
надо было "SetWeaponClip( pItem, iClip-- )" написать по выше, перед set_member
28 Май 2023
да и поменять не много само SetWeaponClip на "SetWeaponClip( pItem, --iClip )"
28 Май 2023
за это время я уже успел и ак паладин на риапи сделать, правда не знаю зачем, но пусть будет)
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу