Поиск M4A1 auto silencer

Сообщения
134
Реакции
23
Помог
2 раз(а)
Search plugin that remember silencer for dm server so player after respawn and pick again m4a1 silencer should be already on until he remove it . If possible to be on reapi
 
Сообщения
24
Реакции
0
Код:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define weapon_entity(%0) (get_pdata_int(%0, 43, 4))

public plugin_init()
{
RegisterHam(Ham_AddPlayerItem, "player", "add_player_item", 1);
}
public add_player_item(id, ent)
{
    if (!pev_valid(ent) || !is_user_connected(id) || is_user_bot(id) || is_user_hltv(id)) return HAM_IGNORED;

    new owner = pev(ent, pev_iuser1);

    if (!is_user_connected(owner))
    {
        new weapon = weapon_entity(ent);

        set_pev(ent, pev_iuser1, id);        

        if (weapon == CSW_M4A1)
        {
            cs_set_weapon_silen(ent, 1, 0);
        }
    }

    return HAM_IGNORED;
}
it should work.
 
Сообщения
134
Реакции
23
Помог
2 раз(а)
faken Thanks but it put auto silencer after choose m4a1, it should remember user choose to put silencer or not after player respawn and pick m4a1 again.... i found the plugin i search for but am not using hamsandwich module, can this plugin be reworked into reapi ?

Код:
#include < amxmodx >
#include < hamsandwich >
#include < cstrike >

const m_pPlayer = 41
const XO_WEAPON = 4
new szm4a1[ 33 ]

public plugin_init( ) {
    register_plugin("Silencer", "1.0", "");

    RegisterHam( Ham_Item_Deploy, "weapon_m4a1", "OnM4A1_Deploy", 1 );
    RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_m4a1", "OnM4A1_SecondaryAttack", 1 );
}
public OnM4A1_Deploy( m4a1 ) {
    new id = get_pdata_cbase( m4a1, m_pPlayer, XO_WEAPON );

    if( szm4a1[ id ] )
        cs_set_weapon_silen( m4a1, 1, 0 );
}
public OnM4A1_SecondaryAttack( m4a1 ) {
    new id = get_pdata_cbase( m4a1, m_pPlayer, XO_WEAPON );
   
    if( szm4a1[ id ] )
        szm4a1[ id ] = false;
    else
        szm4a1[ id ] = true;
}
 

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

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