rg_fire_bullets3

Сообщения
29
Реакции
4
Помог
1 раз(а)
Ошибка
None.
ОС
Linux
Amx Mod X
AMX Mod X 1.8.3-dev+5154 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Mar 11 2018 07:25:29
Built from: https://github.com/alliedmodders/amxmodx/commit/2559fcf0
Build ID: 5154:2559fcf0
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
Exe build: 09:10:05 Jul 7 2017 (7561)
ReGamedll
ReGameDLL version: 5.7.0.312-dev
Build date: 07:53:34 May 31 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/26db32e
Версия Metamod
Metamod v1.21-am  2013-03-15 (5:13)
by Will Day <[email protected]>
http://www.metamod.org/
compiled: Mar 15 2013, 15:20:21 (msc optimized)
Список метамодулей
[ 1] AMX Mod X        RUN   -    amxmodx_mm_i386.  v1.8.3-d  ini   Start ANY  
[ 2] Ham Sandwich RUN - hamsandwich_amxx v1.8.3-d pl1 ANY ANY
[ 3] CSX RUN - csx_amxx_i386.so v1.8.3-d pl1 ANY ANY
[ 4] Engine RUN - engine_amxx_i386 v1.8.3-d pl1 ANY ANY
[ 5] FakeMeta RUN - fakemeta_amxx_i3 v1.8.3-d pl1 ANY ANY
[ 6] ReAPI RUN - reapi_amxx_i386. v5.6.0.1 pl1 ANY Never
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.8.3-dev+ AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.8.3-dev+ AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.8.3-dev+ AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.8.3-dev+ AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.8.3-dev+ AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.8.3-dev+ AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.8.3-dev+ AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.8.3-dev+ AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.8.3-dev+ AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.8.3-dev+ AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.8.3-dev+ AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.8.3-dev+ AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.8.3-dev+ AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.8.3-dev+ AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.8.3-dev+ AMXX Dev Team adminvote.amxx running
[ 16] NextMap 1.8.3-dev+ AMXX Dev Team nextmap.amxx running
[ 17] Nextmap Chooser 1.8.3-dev+ AMXX Dev Team mapchooser.amxx running
[ 18] TimeLeft 1.8.3-dev+ AMXX Dev Team timeleft.amxx running
[ 19] Pause Plugins 1.8.3-dev+ AMXX Dev Team pausecfg.amxx running
[ 20] Stats Configuration 1.8.3-dev+ AMXX Dev Team statscfg.amxx running
[ 21] StatsX 1.8.3-dev+ AMXX Dev Team statsx.amxx running
[ 22] [AMXX] Settings API 1.0 MeRcyLeZZ amx_settings_ap running
[ 23] Aliens vs Predator Mod v1.0.2 Crazy aliens_vs_preda debug
[ 24] [AvP] Weapons v1.0.2 Crazy avp_weapons.amx debug
[ 25] [AvP] Abilities v1.0.2 Crazy avp_abilities.a debug
[ 26] [AvP] M-4A4 Pistol v1.0.2 Crazy avp_m4a4_pistol debug
[ 27] [AvP] Default Weapons v1.0.2 Crazy avp_default_wea debug
[ 28] [AvP] Ability: Motion v1.0.2 Crazy avp_ability_mot debug
[ 29] [AvP] Alien Species v1.0.2 Crazy avp_alien_speci debug
[ 30] [AvP] Marine Species v1.0.2 Crazy avp_marine_spec debug
[ 31] [AvP] Marine Class 1.0 Crazy avp_marine_clas debug
[ 32] [AvP] Gameplay Fixes v1.0.2 Crazy avp_gameplay_fi debug
Автор плагина
Crazy
Версия плагина
v1.0.2
Исходный код
#include <amxmodx>
#include <reapi>
#include <fakemeta>
#include <hamsandwich>
#include <avp_marine_species>

const M4A4_WEAPONBOX_KEY = 1000;

#define isM4a4Pistol(%1) (get_entvar(%1, var_impulse) == M4A4_WEAPONBOX_KEY)

enum _:eWeaponModel
{
WEAPON_V_MODEL = 0,
WEAPON_P_MODEL,
WEAPON_W_MODEL,
};

enum _:eWeaponAnim
{
WEAPON_IDLE = 0,
WEAPON_SHOOT1,
WEAPON_SHOOT2,
WEAPON_SHOOT3,
WEAPON_SHOOTLAST,
WEAPON_RELOAD,
WEAPON_DRAW,
};

new const g_szM4a4Models[eWeaponModel][] =
{
"models/avp/v_m4a4_pistol.mdl",
"models/avp/p_m4a4_pistol.mdl",
"models/avp/w_m4a4_pistol.mdl"
};

new const g_szP228Ent[] = "weapon_p228";

new g_iM4a4Id;
new pCvarM4a4MaxRounds, pCvarM4a4ClipSize;

public plugin_init()
{
pCvarM4a4ClipSize = register_cvar("avp_m4a4_pistol_ammo", "12");
pCvarM4a4MaxRounds = register_cvar("avp_m4a4_pistol_bpammo", "84");

RegisterHam(Ham_Item_Deploy, g_szP228Ent, "CP228_Deploy_Post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, g_szP228Ent, "CP228_PrimaryAttack");
RegisterHam(Ham_Weapon_PrimaryAttack, g_szP228Ent, "CP228_PrimaryAttack_Post", 1);
RegisterHam(Ham_Weapon_Reload, g_szP228Ent, "CP228_Reload");
RegisterHam(Ham_Weapon_Reload, g_szP228Ent, "CP228_Reload_Post", 1);

RegisterHookChain(RG_CWeaponBox_SetModel, "CWeaponBox_SetModel");
RegisterHookChain(RG_CSGameRules_CanHavePlayerItem, "CBasePlayer_CanHaveItem");

register_forward(FM_UpdateClientData, "CBasePlayer_UpdateData_Post", 1);
}

public plugin_precache()
{
register_plugin("[AvP] M-4A4 Pistol", AVP_VERSION_STR, "Crazy");

g_iM4a4Id = avp_weapon_add("M-4A4 Pistol", AVP_TEAM_MARINE);

for (new i = WEAPON_V_MODEL; i <= WEAPON_W_MODEL; i++)
precache_model(g_szM4a4Models[i]);
}

public avp_fw_give_weapon(this, iWeaponId)
{
if (iWeaponId != g_iM4a4Id)
return;

rg_remove_item(this, g_szP228Ent, true);

new pevWeapon = rg_give_item(this, g_szP228Ent);
new iMaxRounds = get_pcvar_num(pCvarM4a4MaxRounds);
new iClipSize = get_pcvar_num(pCvarM4a4ClipSize);

set_entvar(pevWeapon, var_impulse, M4A4_WEAPONBOX_KEY);
rg_set_iteminfo(pevWeapon, ItemInfo_iMaxClip, iClipSize);
rg_set_iteminfo(pevWeapon, ItemInfo_iMaxAmmo1, iMaxRounds);
rg_set_user_bpammo(this, WEAPON_P228, iMaxRounds);
rg_set_user_ammo(this, WEAPON_P228, iClipSize);

rg_switch_weapon(this, pevWeapon);
}

public avp_fw_can_have_weapon(this, iWeaponId)
{
if (iWeaponId != g_iM4a4Id)
return AVP_CONTINUE;

new iClassId = avp_marine_class_get(this);

if (!(avp_marine_class_get_weapons(iClassId) & (1<<iWeaponId)))
return AVP_SUPERCEDE;

return AVP_CONTINUE;
}

public CP228_Deploy_Post(this)
{
if (!isM4a4Pistol(this))
return;

new pevOwner = get_member(this, m_pPlayer);

set_entvar(pevOwner, var_viewmodel, g_szM4a4Models[WEAPON_V_MODEL]);
set_entvar(pevOwner, var_weaponmodel, g_szM4a4Models[WEAPON_P_MODEL]);
setWeaponTimeBase(this, 0.75);

ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, WEAPON_DRAW, false);
}

public CP228_PrimaryAttack(this)
{
if (!isM4a4Pistol(this))
return HAM_IGNORED;

if (get_member(this, m_Weapon_iShotsFired) > 0)
return HAM_SUPERCEDE;

if (get_member(this, m_Weapon_iClip) == 0)
return HAM_SUPERCEDE;

return HAM_IGNORED;
}

public CP228_PrimaryAttack_Post(this)
{
if (!isM4a4Pistol(this))
return;

if (GetHamReturnStatus() == HAM_SUPERCEDE)
return;

new pevOwner = get_member(this, m_pPlayer);
new iWeaponAnim = get_member(this, m_Weapon_iClip) == 0 ? WEAPON_SHOOTLAST : random_num(WEAPON_SHOOT1, WEAPON_SHOOT2);

setWeaponTimeBase(this, 0.25);

fireBullets3(this, pevOwner);

ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, iWeaponAnim, false);
}

public CP228_Reload(this)
{
if (!isM4a4Pistol(this))
return HAM_IGNORED;

new pevOwner = get_member(this, m_pPlayer);
new iAmmo = min(get_pcvar_num(pCvarM4a4ClipSize) - get_member(this, m_Weapon_iClip), get_member(pevOwner, m_rgAmmo, get_member(this, m_Weapon_iPrimaryAmmoType)))

if (iAmmo == 0)
return HAM_SUPERCEDE;

return HAM_IGNORED;
}

public CP228_Reload_Post(this)
{
if (!isM4a4Pistol(this))
return;

if (GetHamReturnStatus() == HAM_SUPERCEDE)
return;

new pevOwner = get_member(this, m_pPlayer);

set_member(pevOwner, m_flTimeWeaponIdle, 1.85);
set_member(pevOwner, m_flNextAttack, 1.85);

set_entvar(pevOwner, var_button, get_entvar(pevOwner, var_button) & ~IN_ATTACK);

ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, WEAPON_RELOAD, false);
}

public CWeaponBox_SetModel(this, const szModel[])
{
new pevWeapon;

for (new i = 0; i < MAX_ITEM_TYPES; i++)
{
pevWeapon = get_member(this, m_WeaponBox_rgpPlayerItems, i);

if (!is_entity(pevWeapon))
continue;

if (!isM4a4Pistol(pevWeapon))
continue;

SetHookChainArg(2, ATYPE_STRING, g_szM4a4Models[WEAPON_W_MODEL]);
break;
}

return HC_CONTINUE;
}

public CBasePlayer_CanHaveItem(this, pevWeapon)
{
if (!is_user_alive(this))
return HC_CONTINUE;

new szModel[64];

get_entvar(pevWeapon, var_model, szModel, charsmax(szModel));

if (!isM4a4Pistol(pevWeapon))
return HC_CONTINUE;

if (avp_can_have_weapon(this, g_iM4a4Id))
return HC_CONTINUE;

SetHookChainReturn(ATYPE_INTEGER, false);
return HC_SUPERCEDE;
}

public CBasePlayer_UpdateData_Post(this, iSendWeapons, hClientData)
{
if (!is_user_alive(this))
return;

static pevWeapon;

pevWeapon = get_member(this, m_pActiveItem);

if (!is_entity(pevWeapon))
return;

if (!isM4a4Pistol(pevWeapon))
return;

set_cd(hClientData, CD_flNextAttack, 2.0);
}

setWeaponTimeBase(this, Float:flTime)
{
set_member(this, m_Weapon_flNextPrimaryAttack, flTime);
set_member(this, m_Weapon_flNextReload, flTime);
set_member(this, m_Weapon_flTimeWeaponIdle, flTime);
}

fireBullets3(this, pevOwner)
{
new Float:vecSrc[3], Float:vecDir[3];

ExecuteHamB(Ham_Player_GetGunPosition, pevOwner, vecSrc);
global_get(glb_v_forward, vecDir);

new Float:flBurstSpread = get_member(this, m_Weapon_fBurstSpread);
new iRandomSeed = get_member(pevOwner, random_seed);

rg_fire_bullets3(this, pevOwner, vecSrc, vecDir, flBurstSpread, 4096.0, 1, BULLET_PLAYER_357SIG, 32, 8.0, true, iRandomSeed);
}
Hello, I'm trying to emulate rg_fire_bullets3 to create Decal effect, but isn't working. I'm not sure if the problem is with FM_UpdateClientData or with the way I'm doing to fire the bullets.
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
block pre attack and do all in there.
 
Сообщения
432
Реакции
410
Помог
14 раз(а)
You shouldn't set CD_flNextAttack, or firebullets will not work.
 
Сообщения
29
Реакции
4
Помог
1 раз(а)
Oh, so rg_fire_bullets3 emulate Decal in client side. I need to block default weapon events because I will set custom "fire" sounds.
 
Сообщения
432
Реакции
410
Помог
14 раз(а)
as fl0wer said, you need to block attack pre and reimplement CP228::PrimaryAttack() in your plugin, but with HOSTONLY flag on playback event
 
Сообщения
29
Реакции
4
Помог
1 раз(а)
Thanks, now it's working, but I'm still implementing CP228::PrimaryAttack().

Код:
#include <amxmodx>
#include <reapi>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <avp_marine_species>

const M4A4_WEAPONBOX_KEY = 1000;

#define isM4a4Pistol(%1) (get_entvar(%1, var_impulse) == M4A4_WEAPONBOX_KEY)

enum _:eWeaponModel
{
    WEAPON_V_MODEL = 0,
    WEAPON_P_MODEL,
    WEAPON_W_MODEL,
};

enum _:eWeaponAnim
{
    WEAPON_IDLE = 0,
    WEAPON_SHOOT1,
    WEAPON_SHOOT2,
    WEAPON_SHOOT3,
    WEAPON_SHOOTLAST,
    WEAPON_RELOAD,
    WEAPON_DRAW,
};

new const g_szM4a4Models[eWeaponModel][] =
{
    "models/avp/v_m4a4_pistol.mdl",
    "models/avp/p_m4a4_pistol.mdl",
    "models/avp/w_m4a4_pistol.mdl"
};

new const g_szSoundM4a4Fire[] = "avp/M4A4_fire.wav";
new const g_szP228Ent[] = "weapon_p228";

new g_iM4a4Id, g_iP228Event, g_iMsgWeaponList;
new g_hFMPrecachEvent;
new pCvarM4a4MaxRounds, pCvarM4a4ClipSize;

public plugin_init()
{
    pCvarM4a4ClipSize = register_cvar("avp_m4a4_pistol_ammo", "12");
    pCvarM4a4MaxRounds = register_cvar("avp_m4a4_pistol_bpammo", "84");
    g_iMsgWeaponList = get_user_msgid("WeaponList");

    register_clcmd("weapon_m4a4_pistol", "cmdM4a4Pistol");

    RegisterHam(Ham_Item_Deploy, g_szP228Ent, "CP228_Deploy_Post", 1);
    RegisterHam(Ham_Weapon_PrimaryAttack, g_szP228Ent, "CP228_PrimaryAttack");
    RegisterHam(Ham_Weapon_Reload, g_szP228Ent, "CP228_Reload");
    RegisterHam(Ham_Weapon_Reload, g_szP228Ent, "CP228_Reload_Post", 1);
    RegisterHam(Ham_Item_AddToPlayer, g_szP228Ent, "CP228_AddToPlayer_Post", 1);

    RegisterHookChain(RG_CWeaponBox_SetModel, "CWeaponBox_SetModel");
    RegisterHookChain(RG_CSGameRules_CanHavePlayerItem, "CBasePlayer_CanHaveItem");

    unregister_forward(FM_PrecacheEvent, g_hFMPrecachEvent, 1);
    register_forward(FM_UpdateClientData, "CBasePlayer_UpdateData_Post", 1);
}

public plugin_precache()
{
    register_plugin("[AvP] M-4A4 Pistol", AVP_VERSION_STR, "Crazy");

    g_iM4a4Id = avp_weapon_add("M-4A4 Pistol", AVP_TEAM_MARINE);

    g_hFMPrecachEvent = register_forward(FM_PrecacheEvent, "pfnPrecacheEvent_Post", 1);

    for (new i = WEAPON_V_MODEL; i <= WEAPON_W_MODEL; i++)
        precache_model(g_szM4a4Models[i]);

    precache_generic("sprites/avp/640hud1.spr");
    precache_generic("sprites/weapon_m4a4_pistol.txt");

    precache_sound(g_szSoundM4a4Fire);
}

public avp_fw_give_weapon(this, iWeaponId)
{
    if (iWeaponId != g_iM4a4Id)
        return;

    rg_remove_item(this, g_szP228Ent, true);

    new pevWeapon = rg_give_item(this, g_szP228Ent);
    new iMaxRounds = get_pcvar_num(pCvarM4a4MaxRounds);
    new iClipSize = get_pcvar_num(pCvarM4a4ClipSize);

    set_entvar(pevWeapon, var_impulse, M4A4_WEAPONBOX_KEY);
    rg_set_iteminfo(pevWeapon, ItemInfo_iMaxClip, iClipSize);
    rg_set_iteminfo(pevWeapon, ItemInfo_iMaxAmmo1, iMaxRounds);
    rg_set_user_bpammo(this, WEAPON_P228, iMaxRounds);
    rg_set_user_ammo(this, WEAPON_P228, iClipSize);
    
    ExecuteHamB(Ham_Item_AddToPlayer, pevWeapon, this);
    rg_switch_weapon(this, pevWeapon);
}

public avp_fw_can_have_weapon(this, iWeaponId)
{
    if (iWeaponId != g_iM4a4Id)
        return AVP_CONTINUE;

    new iClassId = avp_marine_class_get(this);

    if (!(avp_marine_class_get_weapons(iClassId) & (1<<iWeaponId)))
        return AVP_SUPERCEDE;

    return AVP_CONTINUE;
}

public cmdM4a4Pistol(this)
{
    engclient_cmd(this, "weapon_p228");
}

public CP228_Deploy_Post(this)
{
    if (!isM4a4Pistol(this))
        return;

    new pevOwner = get_member(this, m_pPlayer);

    set_entvar(pevOwner, var_viewmodel, g_szM4a4Models[WEAPON_V_MODEL]);
    set_entvar(pevOwner, var_weaponmodel, g_szM4a4Models[WEAPON_P_MODEL]);
    setWeaponTimeBase(this, 0.75);

    ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, WEAPON_DRAW, false);
}

public CP228_PrimaryAttack(this)
{
    if (!isM4a4Pistol(this))
        return HAM_IGNORED;

    new iShootsFired = get_member(this, m_Weapon_iShotsFired);
    new iClip = get_member(this, m_Weapon_iClip);

    if (iShootsFired > 0)
        return HAM_SUPERCEDE;

    if (iClip == 0)
        return HAM_SUPERCEDE;

    /*new Float:flBurstSpread, Float:vecVelocity[3];

    new pevOwner = get_member(this, m_pPlayer);
    new bitsFlags = get_entvar(pevOwner, var_flags);

    get_entvar(pevOwner, var_velocity, vecVelocity);

    if (!(bitsFlags & FL_ONGROUND))
        flBurstSpread = 1.5;
    else if (xs_vec_len_2d(vecVelocity) > 0)
        flBurstSpread = 0.255;
    else if (bitsFlags & FL_DUCKING)
        flBurstSpread = 0.075;
    else
        flBurstSpread = 0.15;*/

    new iWeaponAnim = get_member(this, m_Weapon_iClip) == 0 ? WEAPON_SHOOTLAST : random_num(WEAPON_SHOOT1, WEAPON_SHOOT2);

    setWeaponTimeBase(this, 0.25);
    //set_member(this, m_Weapon_fBurstSpread, flBurstSpread * (1.0 - get_member(this, m_Weapon_flAccuracy)));
    set_member(this, m_Weapon_iClip, iClip - 1);
    set_member(this, m_Weapon_iShotsFired, iShootsFired + 1);

    emit_sound(this, CHAN_WEAPON, g_szSoundM4a4Fire, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
    fireBullets3(this);

    ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, iWeaponAnim, false);
    return HAM_SUPERCEDE;
}

public CP228_PrimaryAttack_Post(this)
{
    if (!isM4a4Pistol(this))
        return;

    if (GetHamReturnStatus() == HAM_SUPERCEDE)
        return;

    new iWeaponAnim = get_member(this, m_Weapon_iClip) == 0 ? WEAPON_SHOOTLAST : random_num(WEAPON_SHOOT1, WEAPON_SHOOT2);

    setWeaponTimeBase(this, 0.25);
    
    emit_sound(this, CHAN_WEAPON, g_szSoundM4a4Fire, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
    
    ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, iWeaponAnim, false);
}

public CP228_Reload(this)
{
    if (!isM4a4Pistol(this))
        return HAM_IGNORED;

    new pevOwner = get_member(this, m_pPlayer);
    new iAmmo = min(get_pcvar_num(pCvarM4a4ClipSize) - get_member(this, m_Weapon_iClip), get_member(pevOwner, m_rgAmmo, get_member(this, m_Weapon_iPrimaryAmmoType)))

    if (iAmmo == 0)
        return HAM_SUPERCEDE;

    return HAM_IGNORED;
}

public CP228_Reload_Post(this)
{
    if (!isM4a4Pistol(this))
        return;

    if (GetHamReturnStatus() == HAM_SUPERCEDE)
        return;

    new pevOwner = get_member(this, m_pPlayer);
    
    set_member(pevOwner, m_flTimeWeaponIdle, 1.85);
    set_member(pevOwner, m_flNextAttack, 1.85);

    set_entvar(pevOwner, var_button, get_entvar(pevOwner, var_button) & ~IN_ATTACK);

    ExecuteHamB(Ham_CS_Weapon_SendWeaponAnim, this, WEAPON_RELOAD, false);
}

public CP228_AddToPlayer_Post(this, pevPlayer)
{
    if (!is_entity(this))
        return;

    if (!is_user_alive(pevPlayer))
        return;

    if (!isM4a4Pistol(this))
        return;

    message_begin(MSG_ONE, g_iMsgWeaponList, .player = pevPlayer)
    {
        write_string("weapon_m4a4_pistol");
        write_byte(get_member(this, m_Weapon_iPrimaryAmmoType));
        write_byte(rg_get_iteminfo(this, ItemInfo_iMaxAmmo1));
        write_byte(get_member(this, m_Weapon_iSecondaryAmmoType));
        write_byte(rg_get_iteminfo(this, ItemInfo_iMaxAmmo2));
        write_byte(rg_get_iteminfo(this, ItemInfo_iSlot));
        write_byte(rg_get_iteminfo(this, ItemInfo_iPosition));
        write_byte(CSW_P228);
        write_byte(0);
    }
    message_end();
}

public CWeaponBox_SetModel(this, const szModel[])
{
    new pevWeapon;

    for (new i = 0; i < MAX_ITEM_TYPES; i++)
    {
        pevWeapon = get_member(this, m_WeaponBox_rgpPlayerItems, i);

        if (!is_entity(pevWeapon))
            continue;

        if (!isM4a4Pistol(pevWeapon))
            continue;

        SetHookChainArg(2, ATYPE_STRING, g_szM4a4Models[WEAPON_W_MODEL]);
        break;
    }
    
    return HC_CONTINUE;
}

public CBasePlayer_CanHaveItem(this, pevWeapon)
{
    if (!is_user_alive(this))
        return HC_CONTINUE;

    if (!isM4a4Pistol(pevWeapon))
        return HC_CONTINUE;

    if (avp_can_have_weapon(this, g_iM4a4Id))
        return HC_CONTINUE;

    SetHookChainReturn(ATYPE_INTEGER, false);
    return HC_SUPERCEDE;
}

public pfnPrecacheEvent_Post(iType, const szEvent[])
{
    if (!equal(szEvent, "events/p228.sc"))
        return;

    g_iP228Event = get_orig_retval();
}

public CBasePlayer_UpdateData_Post(this, iSendWeapons, hClientData)
{
    if (!is_user_alive(this))
        return;

    static pevWeapon;

    pevWeapon = get_member(this, m_pActiveItem);
    
    if (!is_entity(pevWeapon))
        return;

    if (!isM4a4Pistol(pevWeapon))
        return;

    set_cd(hClientData, CD_flNextAttack, 2.0);
}

setWeaponTimeBase(this, Float:flTime)
{
    set_member(this, m_Weapon_flNextPrimaryAttack, flTime);
    set_member(this, m_Weapon_flNextReload, flTime);
    set_member(this, m_Weapon_flTimeWeaponIdle, flTime);
}

fireBullets3(this)
{
    new Float:vecSrc[3], Float:vecDir[3], Float:vecPunchAngle[3];

    new pevOwner = get_member(this, m_pPlayer);
    new Float:flBurstSpread = get_member(this, m_Weapon_fBurstSpread);
    new iRandomSeed = get_member(pevOwner, random_seed);

    client_print(0, print_chat, "%.2f", flBurstSpread);

    ExecuteHamB(Ham_Player_GetGunPosition, pevOwner, vecSrc);
    global_get(glb_v_forward, vecDir);
    get_entvar(pevOwner, var_punchangle, vecPunchAngle);
    
    rg_fire_bullets3(this, pevOwner, vecSrc, vecDir, flBurstSpread, 4096.0, 1, BULLET_PLAYER_357SIG, 32, 0.8, true, iRandomSeed);
    engfunc(EngFunc_PlaybackEvent, FEV_HOSTONLY, pevOwner, g_iP228Event, 0.0, NULL_VECTOR, NULL_VECTOR, NULL_VECTOR, NULL_VECTOR, floatround(vecPunchAngle[0] * 100.0), floatround(vecPunchAngle[1] * 100.0), get_member(this, m_Weapon_iClip) == 0, false);
}
 

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

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