Помогите с плагином Skull-2.

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
1
Реакции
0
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Ошибка
После подборки орудие ноль патронов
ОС
Linux
Amx Mod X
1.8.3
Билд
2384
ReGamedll
Нету
Версия Metamod
1.21p37
Список метамодулей
[ 1] Reunion          RUN   -    reunion.so        v0.1.0.1  ini   Start Never
[ 2] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 3] AMX Mod X RUN - amxmodx.so v1.8.3-d ini Start ANY
[ 4] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 5] Ultimate Unprec RUN - antilimit.so v0.3 Alp ini ANY
[ 6] SafeNameAndChat RUN - safenameandchat. v1.1 ini ANY
[ 7] Revoice RUN - revoice.so v0.1.0.3 ini Start Never
[ 8] MySQL RUN - mysql_amxx_i386. v1.8.3-d pl3 ANY
[ 9] FakeMeta RUN - fakemeta_amxx_i3 v1.8.3-d pl3 ANY
[10] Engine RUN - engine_amxx_i386 v1.8.3-d pl3 ANY ANY
[11] Ham Sandwich RUN - hamsandwich_amxx v1.8.3-d pl3 ANY ANY
[12] CStrike RUN - cstrike_amxx_i38 v1.8.3-d pl3 ANY ANY
[13] Fun RUN - fun_amxx_i386.so v1.8.3-d pl3 ANY ANY
Список плагинов
[  1] AMXBans: Core           Gm 1.6      Larte Team        amxbans_core.am  running  
[ 2] FreshBan 1.3 kanagava fresh_bans.amxx running
[ 3] Players Menu 1.8.3-dev+ AMXX Dev Team plmenu.amxx running
[ 4] Admin Commands 1.8.3-dev+ AMXX Dev Team admincmd.amxx running
[ 5] AdminMenu 1.0 CrAsH AdminMenu.amxx running
[ 6] Maps Menu 1.8.3-dev+ AMXX Dev Team mapsmenu.amxx running
[ 7] Weapon Remover 1.00 Marky_UK weaponremover.a running
[ 8] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 9] Custom Lang Menu 0.0.1 Exolent custom_lang_men running
[ 10] Fire in the hole REMOV 1.03 ........ block_radio_gre running
[ 11] [ZP]NadeModes 1.0 BaJIeHoK zp_nademodes.am running
[ 12] Freeze Sound 1.0 neygomon fs.amxx running
[ 13] Ping Control 1.31 neygomon Ping_Control.am running
[ 14] Reklama 1.0 CrAsH reklama.amxx running
[ 15] Prefix 1.0 CrAsH zp_prefix.amxx running
[ 16] Auto Demo Recorder 2.2.1 F@nt0M addon_demorecor running
[ 17] UFPS Map Manager 3.0.3(z) UFPS.Team umm.amxx running
[ 18] admin_jump 1.1 AUTHOR multijump.amxx running
[ 19] WalkGuard 1.3.2 mogel walkguard.amxx running
[ 20] SF Easy SQL 31337 Windranger1337 zp_save_MySQL.a running
[ 21] Zombie Plague MeRcyLeZZ zombie_plague40 debug
[ 22] [ZP] Buy System 0.2.6 Sho0ter \ Edited zp_buymenu.amxx running
[ 23] [ZP: Buy System] Donat 0.0.1 bos93 \ heka zp_buymenu_dona running
[ 24] unknown unknown unknown zp_buymenu_leve running
[ 25] unknown unknown unknown zombie_class_fa running
[ 26] unknown unknown unknown zombie_class_st running
[ 27] [ZP]Classes[Healer] 1.0 CrAsH zombie_class_he running
[ 28] [ZP]Classes[Heavy] 1.0 CrAsH zombie_class_he running
[ 29] [ZP]Classes[HUNTER] 1.0 CrAsH zombie_class_hu running
[ 30] unknown unknown unknown zombie_class_si running
[ 31] [ZP] Class: Tesla 1.0 Slengosi zombie_class_te running
[ 32] [ZP]Classes[DEIMOS] 1.0 sf BaJIeHoK zombie_class_de running
[ 33] [ZP: System] Knifes 1.0 heka zp_knifes.amxx running
[ 34] ZP Extra: Respawn Menu 1.0.0 unnamed zp_respawn_menu running
[ 35] Frag Reward 0.1.0 PomanoB zp_frag_rewards running
[ 36] [ZP]: Custom respawn 1.0 Weltgericht zp_addon_respaw running
[ 37] [ZP]Card 1.0 CrAsH zp_card.amxx running
[ 38] [ZP: System] Vip 0.0.1 heka 1test_vip.amxx running
[ 39] ZP Zombie Regen V2 1.0.2 yokomo zp_addon_regen. running
[ 40] [ZP] Addon: Grenade St 1.2 rapara13 zp_addon_grenad running
[ 41] [ZP] Round Draw Blast 1.0 MeRcyLeZZ zp_blast.amxx running
[ 42] Auto Game Restart with 1.0 AbeX zp_auto_restart running
[ 43] Biohazard Icon 1.0 Zombie Lurker zp_biohazardico running
[ 44] [ZP]MoneyLevel 1.0 CrAsH zp_ml.amxx running
[ 45] [ZP] Radar 1.0 QooQa zp_radar.amxx running
[ 46] Axyennblu megaplug 1.0 Alexander.3 zp_drop_bonus.a running
[ 47] [ZP] DHUD Informer 0.0.0.1 Andrei zp_score.amxx running
[ 48] unknown unknown unknown zp_voteboss.amx running
[ 49] [ZP]WeaponLVL 1.0 CrAsH zp_weaponlvl.am running
[ 50] [ZP]Present 1.0 CrAsH zp_present_v1.a running
[ 51] unknown unknown unknown zp_knockback.am running
[ 52] ZP: C4 satchel charge 1.0 CrAsH zp_c4.amxx running
[ 53] [ZP] Extra Item: Chain 0.7 meTaLiCroSS zp_extra_chains running
[ 54] unknown unknown unknown zp_extra_health running
[ 55] [ZP] Extra Item: Knife 1.2 pharse zp_extra_knife_ running
[ 56] [ZP]DropGrenade 1.0 CrAsH zp_dropgrenade. running
[ 57] unknown unknown unknown precache_weapon running
[ 58] unknown unknown unknown CSO_Weapon_AT4E running
[ 59] unknown unknown unknown CSO_Weapon_Sala running
[ 60] [ZP] Extra Item: M79 S 1.0 BlackCat CSO_Weapon_M79. running
[ 61] SVDEX-NEW 0.6 KOBRA CSO_Weapon_Svde running
[ 62] unknown unknown unknown CSO_Weapon_Auto running
[ 63] [ZP] Extra: CSO Weapon 1.0 KORD_12.7 CSO_Weapon_Sapi running
[ 64] unknown unknown unknown CSO_Weapon_Inf. running
[ 65] [ZP] Extra: CSO Weapon 1.0 KORD_12.7 CSO_Weapon_Skul running
[ 66] M1887 1.0 Batcon CSO_Weapon_KSG1 running
[ 67] unknown unknown unknown CSO_Weapon_Qbar running
[ 68] M1887 1.0 Batcon CSO_Weapon_M188 running
[ 69] [Z]Weapon:Franchi SPAS 1.0 Batcon CSO_Weapon_SPAS running
[ 70] unknown unknown unknown CSO_Weapon_Skul running
[ 71] unknown unknown unknown CSO_Weapon_HK41 running
[ 72] unknown unknown unknown CSO_Weapon_F200 running
[ 73] unknown unknown unknown CSO_Weapon_Dual running
[ 74] [ZP] Extra: XM8 1.1 KORD_12.7 CSO_Weapon_XM8. running
[ 75] unknown unknown unknown CSO_Weapon_Akkn running
[ 76] unknown unknown unknown CSO_Weapon_Aklo running
[ 77] unknown unknown unknown CSO_Weapon_Dual running
[ 78] unknown unknown unknown CSO_Weapon_Wate running
[ 79] unknown unknown unknown CSO_Weapon_Balr running
[ 80] OICW 0.6 KOBRA CSO_Weapon_OICW running
[ 81] unknown unknown unknown CSO_Weapon_TRG4 running
[ 82] unknown unknown unknown CSO_Weapon_WA20 running
[ 83] unknown unknown unknown CSO_Weapon_AS50 running
[ 84] unknown unknown unknown CSO_Weapon_VSK9 running
[ 85] unknown unknown unknown CSO_Weapon_M400 running
[ 86] unknown unknown unknown CSO_Weapon_Cros running
[ 87] unknown unknown unknown CSO_Weapon_M249 running
[ 88] unknown unknown unknown CSO_Weapon_HK23 running
[ 89] unknown unknown unknown CSO_Weapon_MG3. running
[ 90] [ZP] Extra Item: M134 1.0 BlackCat CSO_Weapon_M134 running
[ 91] [ZP] Extra items: Thun 0.1 serfreeman1337 zp_ThunderNade. running
[ 92] Custom Ammo Buy 0.1 KOBRA zp_custom_ammob running
[ 93] unknown unknown unknown zp_fix.amxx running
93 plugins, 93 running
Автор плагина
KORD_12.7
Версия плагина
1.0
Исходный код
#include <amxmodx>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>

forward zp_buy_ammo_2(index)

#define PLUGIN "[ZP] Extra: CSO Weapon Skull 2"
#define VERSION "1.0"
#define AUTHOR "KORD_12.7"

//**********************************************
//* Weapon Settings. *
//**********************************************

#define WEAPONLIST

#define WEAPON_REFERANCE "weapon_usp"
#define WEAPON_NAME "cs_adekvat/weapon_skull2_adekvat"

#define WEAPON_MAX_CLIP 7
#define WEAPON_DEFAULT_AMMO 35

#define WEAPON_MULTIPLIER_DAMAGE 1.121

#define WEAPON_TIME_NEXT_IDLE 5.0
#define WEAPON_TIME_NEXT_ATTACK 0.15
#define WEAPON_TIME_DELAY_DEPLOY 1.5
#define WEAPON_TIME_DELAY_RELOAD_A 2.5
#define WEAPON_TIME_DELAY_RELOAD 3.5

#define ZP_ITEM_NAME "Skull-2"
#define ZP_ITEM_COST 0

#define MODEL_WORLD_SUB 14
#define MODEL_VIEW "models/cs_adekvat/weapons/v_skull2.mdl"
#define MODEL_PLAYER "models/cs_adekvat/weapons/p_skull2.mdl"
#define MODEL_PLAYER_B "models/cs_adekvat/weapons/p_skull2_mode.mdl"
#define MODEL_WORLD "models//cs_adekvat/weapons/w_cso_weapons.mdl"

// Sounds
#define SOUND_FIRE "weapons/skull2-1.wav"

// Sprites
#define WEAPON_HUD_TXT "sprites/cs_adekvat/weapon_skull2_adekvat.txt"
#define WEAPON_HUD_SPR_1 "sprites/cs_adekvat/640hud136.spr"
#define WEAPON_HUD_SPR_2 "sprites/cs_adekvat/640hudaskull.spr"

// Animation
#define ANIM_EXTENSION "dualpistol"
#define ANIM_EXTENSION2 "onehanded"

// Animation sequences
enum
{
ANIM_IDLE_A,
ANIM_RELOAD_A,

ANIM_SHOOT_LEFT_DUO,
ANIM_SHOOT_LEFT_DUO2,
ANIM_SHOOT_LEFT_DUO_LAST,

ANIM_SHOOT_RIGHT_DUO,
ANIM_SHOOT_RIGHT_DUO2,
ANIM_SHOOT_RIGHT_DUO_LAST,

ANIM_DRAW_A,
ANIM_SHOOT_A,
ANIM_SHOOT_A_EM,

ANIM_IDLE_DUO,
ANIM_IDLE_LEFT_DUO,

ANIM_RELOAD_DUO,
ANIM_DRAW_DUO,

ANIM_CHANGE_DUO,
ANIM_CHANGE_A
};

//**********************************************
//* Some macroses. *
//**********************************************

#define GET_STATE(%0) get_pdata_int(%0, m_fWeaponState, extra_offset_weapon)
#define SET_STATE(%0,%1) set_pdata_int(%0, m_fWeaponState, %1, extra_offset_weapon)

#define GET_SHOOTS2(%0) get_pdata_int(%0, m_fInSuperBullets, extra_offset_weapon)
#define SET_SHOOTS2(%0,%1) set_pdata_int(%0, m_fInSuperBullets, %1, extra_offset_weapon)

#define MDLL_Spawn(%0) dllfunc(DLLFunc_Spawn, %0)
#define MDLL_Touch(%0,%1) dllfunc(DLLFunc_Touch, %0, %1)

#define SET_MODEL(%0,%1) engfunc(EngFunc_SetModel, %0, %1)
#define SET_ORIGIN(%0,%1) engfunc(EngFunc_SetOrigin, %0, %1)

#define PRECACHE_MODEL(%0) engfunc(EngFunc_PrecacheModel, %0)
#define PRECACHE_SOUND(%0) engfunc(EngFunc_PrecacheSound, %0)
#define PRECACHE_GENERIC(%0) engfunc(EngFunc_PrecacheGeneric, %0)

#define PRECACHE_MODEL2(%0) PrecacheSoundsFromModel(%0)

#define MESSAGE_BEGIN(%0,%1,%2,%3) engfunc(EngFunc_MessageBegin, %0, %1, %2, %3)
#define MESSAGE_END() message_end()

#define WRITE_ANGLE(%0) engfunc(EngFunc_WriteAngle, %0)
#define WRITE_BYTE(%0) write_byte(%0)
#define WRITE_COORD(%0) engfunc(EngFunc_WriteCoord, %0)
#define WRITE_STRING(%0) write_string(%0)
#define WRITE_SHORT(%0) write_short(%0)

#define BitSet(%0,%1) (%0 |= (1 << (%1 - 1)))
#define BitClear(%0,%1) (%0 &= ~(1 << (%1 - 1)))
#define BitCheck(%0,%1) (%0 & (1 << (%1 - 1)))

//**********************************************
//* PvData Offsets. *
//**********************************************

// Linux extra offsets
#define extra_offset_weapon 4
#define extra_offset_player 5

new g_bitIsConnected;

#define m_rgpPlayerItems_CWeaponBox 34

// CBasePlayerItem
#define m_pPlayer 41
#define m_pNext 42

// CBasePlayerWeapon
#define m_fInSuperBullets 30
#define m_fFireOnEmpty 45
#define m_flNextPrimaryAttack 46
#define m_flNextSecondaryAttack 47
#define m_flTimeWeaponIdle 48
#define m_iPrimaryAmmoType 49
#define m_iClip 51
#define m_fInReload 54
#define m_iDirection 60
#define m_flAccuracy 62
#define m_iShotsFired 64
#define m_fWeaponState 74
#define m_flNextAttack 83
#define m_iLastZoom 109
#define m_fResumeZoom 110

// CBasePlayer
#define m_iFOV 363
#define m_rgpPlayerItems_CBasePlayer 367
#define m_pActiveItem 373
#define m_rgAmmo_CBasePlayer 376
#define m_szAnimExtention 492

#define IsValidPev(%0) (pev_valid(%0) == 2)

//**********************************************
//* Let's code our weapon. *
//**********************************************

Weapon_OnPrecache()
{
PRECACHE_MODEL(MODEL_VIEW);
PRECACHE_MODEL2(MODEL_VIEW);

PRECACHE_MODEL(MODEL_PLAYER);
PRECACHE_MODEL(MODEL_PLAYER_B);
PRECACHE_MODEL(MODEL_WORLD);

PRECACHE_SOUND(SOUND_FIRE);

#if defined WEAPONLIST
PRECACHE_GENERIC(WEAPON_HUD_TXT);
PRECACHE_GENERIC(WEAPON_HUD_SPR_1);
PRECACHE_GENERIC(WEAPON_HUD_SPR_2);
#endif
}

Weapon_OnSpawn(const iItem)
{
// Setting world model.
SET_MODEL(iItem, MODEL_WORLD);
}

Weapon_OnDeploy(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
#pragma unused iClip, iAmmoPrimary

/*static iszViewModel;
if (iszViewModel || (iszViewModel = engfunc(EngFunc_AllocString, MODEL_VIEW)))
{
set_pev_string(iPlayer, pev_viewmodel2, iszViewModel);
}*/

set_pev( iPlayer, pev_viewmodel2, MODEL_VIEW );

static iszPlayerModel;
if (iszPlayerModel || (iszPlayerModel = engfunc(EngFunc_AllocString, MODEL_PLAYER)))
{
set_pev_string(iPlayer, pev_weaponmodel2, iszPlayerModel);
}

set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_TIME_DELAY_DEPLOY, extra_offset_weapon);
set_pdata_float(iPlayer, m_flNextAttack, WEAPON_TIME_DELAY_DEPLOY, extra_offset_player);
set_pdata_string(iPlayer, m_szAnimExtention * 4, ANIM_EXTENSION, -1, extra_offset_player * 4);
}

Weapon_OnHolster(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
#pragma unused iPlayer, iClip, iAmmoPrimary

set_pdata_int(iItem, m_fInReload, 0, extra_offset_weapon);
}

Weapon_OnIdle(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
#pragma unused iClip, iAmmoPrimary

ExecuteHamB(Ham_Weapon_ResetEmptySound, iItem);

if (get_pdata_float(iItem, m_flTimeWeaponIdle, extra_offset_weapon) > 0.0)
{
return;
}

Weapon_SendAnim(iPlayer, GET_STATE(iItem) ? ANIM_IDLE_A:ANIM_IDLE_DUO);

set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_TIME_NEXT_IDLE, extra_offset_weapon);
}

Weapon_OnReload(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
if (min(GET_STATE(iItem) ? 7 - iClip:WEAPON_MAX_CLIP - iClip, iAmmoPrimary) <= 0)
{
return;
}

set_pdata_int(iItem, m_iClip, 0, extra_offset_weapon);

ExecuteHam(Ham_Weapon_Reload, iItem);

set_pdata_int(iItem, m_iClip, iClip, extra_offset_weapon);

static szAnimation[64];formatex(szAnimation, charsmax(szAnimation), "ref_shoot_%s", GET_STATE(iItem) ? ANIM_EXTENSION2:ANIM_EXTENSION);
Player_SetAnimation(iPlayer, szAnimation);

set_pdata_float(iPlayer, m_flNextAttack, GET_STATE(iItem) ? WEAPON_TIME_DELAY_RELOAD_A:WEAPON_TIME_DELAY_RELOAD, extra_offset_player);
set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_TIME_DELAY_RELOAD + 1.0, extra_offset_weapon);

Weapon_SendAnim(iPlayer, GET_STATE(iItem) ? ANIM_RELOAD_A:ANIM_RELOAD_DUO);
}

Weapon_OnPrimaryAttack(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
#pragma unused iAmmoPrimary

if (iClip <= 0 || get_pdata_int(iItem, m_iShotsFired, extra_offset_weapon))
{
if (get_pdata_int(iItem, m_fFireOnEmpty, extra_offset_player))
{
ExecuteHamB(Ham_Weapon_PlayEmptySound, iItem);
set_pdata_float(iItem, m_flNextPrimaryAttack, 0.2, extra_offset_weapon);
}
return;
}

new iAnim;

if (GET_STATE(iItem))
{
iAnim=ANIM_SHOOT_A;
}
else
{
switch (GET_SHOOTS2(iItem))
{
case 0:iAnim=ANIM_SHOOT_RIGHT_DUO,SET_SHOOTS2(iItem, 1);
case 1:iAnim=ANIM_SHOOT_LEFT_DUO,SET_SHOOTS2(iItem, 0);
}
}

Weapon_OnFire(iPlayer, iItem, WEAPON_TIME_NEXT_ATTACK, iAnim);
}

Weapon_OnSecondaryAttack(const iItem, const iPlayer, const iClip, const iAmmoPrimary)
{
#pragma unused iAmmoPrimary, iClip

Weapon_SendAnim(iPlayer, GET_STATE(iItem) ? ANIM_CHANGE_DUO:ANIM_CHANGE_A);

set_pdata_int(iItem, m_iClip, GET_STATE(iItem) ? 14:7, extra_offset_weapon);

set_pdata_float(iItem, m_flTimeWeaponIdle, 3.0, extra_offset_weapon);
set_pdata_float(iItem, m_flNextPrimaryAttack, 3.0, extra_offset_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, 3.0, extra_offset_weapon);

SET_STATE(iItem, GET_STATE(iItem) == 0 ? 1:0);
}

Weapon_OnFire(const iPlayer, const iItem, const Float:iTime, const iAnim)
{
static szAnimation[64];
CallOrigFireBullets3(iItem);

formatex(szAnimation, charsmax(szAnimation), "ref_shoot_%s", GET_STATE(iItem) ? ANIM_EXTENSION2:ANIM_EXTENSION);
Player_SetAnimation(iPlayer, szAnimation);

set_pdata_float(iItem, m_flAccuracy, 0.8, extra_offset_weapon);
set_pdata_float(iItem, m_flTimeWeaponIdle, iTime + 1.1, extra_offset_weapon);
set_pdata_float(iItem, m_flNextPrimaryAttack, iTime, extra_offset_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, iTime, extra_offset_weapon);

Weapon_SendAnim(iPlayer, iAnim);

Punchangle(iPlayer, .iVecx = random_float(-1.0, -1.5), .iVecy = random_float(0.3, -0.3), .iVecz = 0.0);

emit_sound(iPlayer, CHAN_WEAPON, SOUND_FIRE, 0.9, ATTN_NORM, 0, PITCH_NORM);
}

//*********************************************************************
//* Don't modify the code below this line unless *
//* you know _exactly_ what you are doing!!! *
//*********************************************************************

#define MSGID_WEAPONLIST 78

new g_iszWeaponKey;
new g_iItemID;

#define IsCustomItem(%0) (pev(%0, pev_impulse) == g_iszWeaponKey)

public plugin_precache()
{
Weapon_OnPrecache();

g_iszWeaponKey = engfunc(EngFunc_AllocString, WEAPON_NAME);

register_clcmd(WEAPON_NAME, "Cmd_WeaponSelect");
register_message(MSGID_WEAPONLIST, "MsgHook_WeaponList");
register_message(get_user_msgid("DeathMsg"), "MsgHook_Death");
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

register_forward(FM_SetModel, "FakeMeta_SetModel", false);
register_forward(FM_PlaybackEvent, "FakeMeta_PlaybackEvent", false);
register_forward(FM_UpdateClientData, "FakeMeta_UpdateClientData_Post", true);

RegisterHam(Ham_Spawn, "weaponbox", "HamHook_Weaponbox_Spawn_Post", true);

RegisterHam(Ham_TraceAttack, "func_breakable", "HamHook_Entity_TraceAttack", false);
RegisterHam(Ham_TraceAttack, "info_target", "HamHook_Entity_TraceAttack", false);
RegisterHam(Ham_TraceAttack, "player", "HamHook_Entity_TraceAttack", false);

RegisterHam(Ham_Item_Deploy, WEAPON_REFERANCE, "HamHook_Item_Deploy_Post", true);
RegisterHam(Ham_Item_Holster, WEAPON_REFERANCE, "HamHook_Item_Holster", false);
RegisterHam(Ham_Item_AddToPlayer, WEAPON_REFERANCE, "HamHook_Item_AddToPlayer", false);
RegisterHam(Ham_Item_PostFrame, WEAPON_REFERANCE, "HamHook_Item_PostFrame", false);

RegisterHam(Ham_Weapon_Reload, WEAPON_REFERANCE, "HamHook_Item_Reload", false);
RegisterHam(Ham_Weapon_WeaponIdle, WEAPON_REFERANCE, "HamHook_Item_WeaponIdle", false);
RegisterHam(Ham_Weapon_PrimaryAttack, WEAPON_REFERANCE, "HamHook_Item_PrimaryAttack", false);
RegisterHam(Ham_Weapon_SecondaryAttack, WEAPON_REFERANCE, "HamHook_Item_SecondaryAttack", false);

g_iItemID = zp_register_extra_item(ZP_ITEM_NAME, ZP_ITEM_COST, ZP_TEAM_HUMAN);
}

public zp_extra_item_selected(id, itemid)
{
if (itemid == g_iItemID)
{
Weapon_Give(id);
}
}

//**********************************************
//* Block client weapon. *
//**********************************************

public FakeMeta_UpdateClientData_Post(const iPlayer, const iSendWeapons, const CD_Handle)
{
static iActiveItem;iActiveItem = get_pdata_cbase(iPlayer, m_pActiveItem, extra_offset_player);

if (!IsValidPev(iActiveItem) || !IsCustomItem(iActiveItem))
{
return FMRES_IGNORED;
}

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

//**********************************************
//* Item (weapon) hooks. *
//**********************************************

#define _call.%0(%1,%2) \
\
Weapon_On%0 \
( \
%1, \
%2, \
\
get_pdata_int(%1, m_iClip, extra_offset_weapon), \
GetAmmoInventory(%2, PrimaryAmmoIndex(%1)) \
)

public HamHook_Item_Deploy_Post(const iItem)
{
new iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

_call.Deploy(iItem, iPlayer);
return HAM_IGNORED;
}

public HamHook_Item_Holster(const iItem)
{
new iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

set_pev(iPlayer, pev_viewmodel, 0);
set_pev(iPlayer, pev_weaponmodel, 0);

_call.Holster(iItem, iPlayer);
return HAM_SUPERCEDE;
}

public HamHook_Item_WeaponIdle(const iItem)
{
static iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

_call.Idle(iItem, iPlayer);
return HAM_SUPERCEDE;
}

public HamHook_Item_Reload(const iItem)
{
static iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

_call.Reload(iItem, iPlayer);
return HAM_SUPERCEDE;
}

public HamHook_Item_PrimaryAttack(const iItem)
{
static iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

_call.PrimaryAttack(iItem, iPlayer);
return HAM_SUPERCEDE;
}

public HamHook_Item_SecondaryAttack(const iItem)
{
static iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}

_call.SecondaryAttack(iItem, iPlayer);
return HAM_SUPERCEDE;
}

public HamHook_Item_PostFrame(const iItem)
{
static iPlayer;

if (!CheckItem(iItem, iPlayer))
{
return HAM_IGNORED;
}
if (get_pdata_int(iItem, m_fInReload, extra_offset_weapon))
{
new iClip = get_pdata_int(iItem, m_iClip, extra_offset_weapon);
new iPrimaryAmmoIndex = PrimaryAmmoIndex(iItem);
new iAmmoPrimary = GetAmmoInventory(iPlayer, iPrimaryAmmoIndex);
new iAmount = min(GET_STATE(iItem) ? 7-iClip:WEAPON_MAX_CLIP - iClip, iAmmoPrimary);

set_pdata_int(iItem, m_iClip, iClip + iAmount, extra_offset_weapon);
set_pdata_int(iItem, m_fInReload, false, extra_offset_weapon);

SetAmmoInventory(iPlayer, iPrimaryAmmoIndex, iAmmoPrimary - iAmount);
}

return HAM_IGNORED;
}

//**********************************************
//* Fire Bullets. *
//**********************************************

CallOrigFireBullets3(const iItem)
{
static FakeMetaTraceLine;FakeMetaTraceLine=register_forward(FM_TraceLine,"FakeMeta_TraceLine",true)
state FireBullets: Enabled;
ExecuteHam(Ham_Weapon_PrimaryAttack, iItem);
state FireBullets: Disabled;
unregister_forward(FM_TraceLine,FakeMetaTraceLine,true)
}

public FakeMeta_TraceLine(Float:vecStart[3], Float:VecEnd[3], iFlags, Ignore, iTrase)// Chrescoe1
{
if (iFlags & IGNORE_MONSTERS)
{
return FMRES_IGNORED;
}

static iHit;
static Decal;
static glassdecal;
static Float:vecPlaneNormal[3];
static Float:vecEndPos[3];

iHit=get_tr2(iTrase,TR_pHit);

if (!glassdecal)
{
glassdecal=engfunc( EngFunc_DecalIndex, "{bproof1" );
}

if(iHit>0 && pev_valid(iHit))
if(pev(iHit,pev_solid)!=SOLID_BSP)return FMRES_IGNORED;
else if(pev(iHit,pev_rendermode)!=0)Decal=glassdecal;
else Decal=random_num(41,45);
else Decal=random_num(41,45);

get_tr2(iTrase, TR_vecEndPos, vecEndPos);
get_tr2(iTrase, TR_vecPlaneNormal, vecPlaneNormal);

MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, vecEndPos, 0);
WRITE_BYTE(TE_GUNSHOTDECAL);
WRITE_COORD(vecEndPos[0]);
WRITE_COORD(vecEndPos[1]);
WRITE_COORD(vecEndPos[2]);
WRITE_SHORT(iHit > 0 ? iHit : 0);
WRITE_BYTE(Decal);
MESSAGE_END();

MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0);
WRITE_BYTE(TE_STREAK_SPLASH)
WRITE_COORD(vecEndPos[0]);
WRITE_COORD(vecEndPos[1]);
WRITE_COORD(vecEndPos[2]);
WRITE_COORD(vecPlaneNormal[0] * random_float(20.0,30.0));
WRITE_COORD(vecPlaneNormal[1] * random_float(20.0,30.0));
WRITE_COORD(vecPlaneNormal[2] * random_float(20.0,30.0));
WRITE_BYTE(26);
WRITE_SHORT(10);
WRITE_SHORT(3);
WRITE_SHORT(60);
MESSAGE_END();

return FMRES_IGNORED;
}

public MsgHook_Death() <FireBullets: Enabled>
{
static szTruncatedWeaponName[32];

if (szTruncatedWeaponName[0] == EOS)
{
copy(szTruncatedWeaponName, charsmax(szTruncatedWeaponName), WEAPON_NAME);
replace(szTruncatedWeaponName, charsmax(szTruncatedWeaponName), "weapon_", "");
}

set_msg_arg_string(4, szTruncatedWeaponName);
}

public FakeMeta_PlaybackEvent() <FireBullets: Enabled>
{
return FMRES_SUPERCEDE;
}

public HamHook_Entity_TraceAttack(const iEntity, const iAttacker, const Float: flDamage) <FireBullets: Enabled>
{
static Float:vOrigin[3];pev(iEntity, pev_origin, vOrigin);

if (!BitCheck(g_bitIsConnected, iAttacker) || !IsValidPev(iAttacker))
{
return;
}

SetHamParamFloat(3, flDamage * WEAPON_MULTIPLIER_DAMAGE);
}

public MsgHook_Death() </* Empty statement */> { /* Fallback */ }
public MsgHook_Death() <FireBullets: Disabled> { /* Do notning */ }

public FakeMeta_PlaybackEvent() </* Empty statement */> { return FMRES_IGNORED; }
public FakeMeta_PlaybackEvent() <FireBullets: Disabled> { return FMRES_IGNORED; }

public HamHook_Entity_TraceAttack() </* Empty statement */> { /* Fallback */ }
public HamHook_Entity_TraceAttack() <FireBullets: Disabled> { /* Do notning */ }

//**********************************************
//* Create and check our custom weapon. *
//**********************************************
Weapon_Create(const Float: vecOrigin[3] = {0.0, 0.0, 0.0})
{
new iWeapon;

static iszAllocStringCached;
if (iszAllocStringCached || (iszAllocStringCached = engfunc(EngFunc_AllocString, WEAPON_REFERANCE)))
{
iWeapon = engfunc(EngFunc_CreateNamedEntity, iszAllocStringCached);
}

if (!IsValidPev(iWeapon))
{
return FM_NULLENT;
}

MDLL_Spawn(iWeapon);
SET_ORIGIN(iWeapon, vecOrigin);

set_pdata_int(iWeapon, m_iClip, WEAPON_MAX_CLIP, extra_offset_weapon);

set_pev(iWeapon, pev_impulse, g_iszWeaponKey);
set_pev(iWeapon, pev_angles, {0.0, 0.0, 0.0});

Weapon_OnSpawn(iWeapon);

return iWeapon;
}

Weapon_Give(const iPlayer)
{
if (!IsValidPev(iPlayer))
{
return FM_NULLENT;
}

new iWeapon, Float: vecOrigin[3];
pev(iPlayer, pev_origin, vecOrigin);

if ((iWeapon = Weapon_Create(vecOrigin)) != FM_NULLENT)
{
Player_DropWeapons(iPlayer, ExecuteHamB(Ham_Item_ItemSlot, iWeapon));

set_pev(iWeapon, pev_spawnflags, pev(iWeapon, pev_spawnflags) | SF_NORESPAWN);
MDLL_Touch(iWeapon, iPlayer);

SetAmmoInventory(iPlayer, PrimaryAmmoIndex(iWeapon), WEAPON_DEFAULT_AMMO);

return iWeapon;
}

return FM_NULLENT;
}

Player_DropWeapons(const iPlayer, const iSlot)
{
new szWeaponName[32], iItem = get_pdata_cbase(iPlayer, m_rgpPlayerItems_CBasePlayer + iSlot, extra_offset_player);

while (IsValidPev(iItem))
{
pev(iItem, pev_classname, szWeaponName, charsmax(szWeaponName));
engclient_cmd(iPlayer, "drop", szWeaponName);

iItem = get_pdata_cbase(iItem, m_pNext, extra_offset_weapon);
}
}

Weapon_SendAnim(const iPlayer, const iAnim)
{
set_pev(iPlayer, pev_weaponanim, iAnim);

MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0.0, 0.0, 0.0}, iPlayer);
WRITE_BYTE(iAnim);
WRITE_BYTE(0);
MESSAGE_END();
}

stock Punchangle(iPlayer, Float:iVecx = 0.0, Float:iVecy = 0.0, Float:iVecz = 0.0)
{
static Float:iVec[3];pev(iPlayer, pev_punchangle,iVec);
iVec[0] = iVecx;iVec[1] = iVecy;iVec[2] = iVecz
set_pev(iPlayer, pev_punchangle, iVec);
}

stock Player_SetAnimation(const iPlayer, const szAnim[])
{
#define ACT_RANGE_ATTACK1 28

// Linux extra offsets
#define extra_offset_animating 4

// CBaseAnimating
#define m_flFrameRate 36
#define m_flGroundSpeed 37
#define m_flLastEventCheck 38
#define m_fSequenceFinished 39
#define m_fSequenceLoops 40

// CBaseMonster
#define m_Activity 73
#define m_IdealActivity 74

// CBasePlayer
#define m_flLastAttackTime 220

new iAnimDesired, Float: flFrameRate, Float: flGroundSpeed, bool: bLoops;

if ((iAnimDesired = lookup_sequence(iPlayer, szAnim, flFrameRate, bLoops, flGroundSpeed)) == -1)
{
iAnimDesired = 0;
}

new Float: flGametime = get_gametime();

set_pev(iPlayer, pev_frame, 0.0);
set_pev(iPlayer, pev_framerate, 1.0);
set_pev(iPlayer, pev_animtime, flGametime );
set_pev(iPlayer, pev_sequence, iAnimDesired);

set_pdata_int(iPlayer, m_fSequenceLoops, bLoops, extra_offset_animating);
set_pdata_int(iPlayer, m_fSequenceFinished, 0, extra_offset_animating);

set_pdata_float(iPlayer, m_flFrameRate, flFrameRate, extra_offset_animating);
set_pdata_float(iPlayer, m_flGroundSpeed, flGroundSpeed, extra_offset_animating);
set_pdata_float(iPlayer, m_flLastEventCheck, flGametime , extra_offset_animating);

set_pdata_int(iPlayer, m_Activity, ACT_RANGE_ATTACK1, extra_offset_player);
set_pdata_int(iPlayer, m_IdealActivity, ACT_RANGE_ATTACK1, extra_offset_player);
set_pdata_float(iPlayer, m_flLastAttackTime, flGametime , extra_offset_player);
}

public client_putinserver(id)
{
BitSet(g_bitIsConnected, id);
}

public client_disconnect(id)
{
BitClear(g_bitIsConnected, id);
}


bool: CheckItem(const iItem, &iPlayer)
{
if (!IsValidPev(iItem) || !IsCustomItem(iItem))
{
return false;
}

iPlayer = get_pdata_cbase(iItem, m_pPlayer, extra_offset_weapon);

if (!IsValidPev(iPlayer) || !BitCheck(g_bitIsConnected, iPlayer))
{
return false;
}

return true;
}

//**********************************************
//* Weapon list update. *
//**********************************************
#if defined WEAPONLIST
public Cmd_WeaponSelect(const iPlayer)
{
engclient_cmd(iPlayer, WEAPON_REFERANCE);
return PLUGIN_HANDLED;
}

public HamHook_Item_AddToPlayer(const iItem, const iPlayer)
{
if (!IsValidPev(iItem) || !IsValidPev(iPlayer))
{
return HAM_IGNORED;
}

MsgHook_WeaponList(MSGID_WEAPONLIST, iItem, iPlayer);

SetAmmoInventory(iPlayer, PrimaryAmmoIndex(iItem), pev(iItem, pev_iuser2));

return HAM_IGNORED;
}

public MsgHook_WeaponList(const iMsgID, const iMsgDest, const iMsgEntity)
{
static arrWeaponListData[8];

if (!iMsgEntity)
{
new szWeaponName[32];
get_msg_arg_string(1, szWeaponName, charsmax(szWeaponName));

if (!strcmp(szWeaponName, WEAPON_REFERANCE))
{
for (new i, a = sizeof arrWeaponListData; i < a; i++)
{
arrWeaponListData[i] = get_msg_arg_int(i + 2);
}
}
}
else
{
if (!IsCustomItem(iMsgDest) && pev(iMsgDest, pev_impulse))
{
return;
}

MESSAGE_BEGIN(MSG_ONE, iMsgID, {0.0, 0.0, 0.0}, iMsgEntity);
WRITE_STRING(IsCustomItem(iMsgDest) ? WEAPON_NAME : WEAPON_REFERANCE);

for (new i, a = sizeof arrWeaponListData; i < a; i++)
{
WRITE_BYTE(arrWeaponListData[i]);
}

MESSAGE_END();
}
}
#endif

//**********************************************
//* Weaponbox world model. *
//**********************************************

public HamHook_Weaponbox_Spawn_Post(const iWeaponBox)
{
if (IsValidPev(iWeaponBox))
{
state (IsValidPev(pev(iWeaponBox, pev_owner))) stWeaponBox: Enabled;
}

return HAM_IGNORED;
}

public FakeMeta_SetModel(const iEntity) <stWeaponBox: Enabled>
{
state stWeaponBox: Disabled;

if (!IsValidPev(iEntity))
{
return FMRES_IGNORED;
}

#define MAX_ITEM_TYPES 6

for (new i, iItem; i < MAX_ITEM_TYPES; i++)
{
iItem = get_pdata_cbase(iEntity, m_rgpPlayerItems_CWeaponBox + i, extra_offset_weapon);

if (IsValidPev(iItem) && IsCustomItem(iItem))
{
SET_MODEL(iEntity, MODEL_WORLD);
set_pev(iEntity, pev_body, MODEL_WORLD_SUB)
return FMRES_SUPERCEDE;
}
}

return FMRES_IGNORED;
}

public FakeMeta_SetModel() </* Empty statement */> { /* Fallback */ return FMRES_IGNORED; }
public FakeMeta_SetModel() < stWeaponBox: Disabled > { /* Do nothing */ return FMRES_IGNORED; }

//**********************************************
//* Ammo Inventory. *
//**********************************************

PrimaryAmmoIndex(const iItem)
{
return get_pdata_int(iItem, m_iPrimaryAmmoType, extra_offset_weapon);
}

GetAmmoInventory(const iPlayer, const iAmmoIndex)
{
if (iAmmoIndex == -1)
{
return -1;
}

return get_pdata_int(iPlayer, m_rgAmmo_CBasePlayer + iAmmoIndex, extra_offset_player);
}

SetAmmoInventory(const iPlayer, const iAmmoIndex, const iAmount)
{
if (iAmmoIndex == -1)
{
return 0;
}

set_pdata_int(iPlayer, m_rgAmmo_CBasePlayer + iAmmoIndex, iAmount, extra_offset_player);
return 1;
}

public zp_buy_ammo_2(id)
{
new iItem = get_pdata_cbase(id, m_pActiveItem, extra_offset_player);

if (!IsValidPev(iItem) || !IsCustomItem(iItem))
return;

zp_set_ammo_value(id, 7)
zp_set_ammo_cost(id, 250)
zp_set_ammo_max(id, 35)
}

PrecacheSoundsFromModel(const szModelPath[])
{
new iFile;

if ((iFile = fopen(szModelPath, "rt")))
{
new szSoundPath[64];

new iNumSeq, iSeqIndex;
new iEvent, iNumEvents, iEventIndex;

fseek(iFile, 164, SEEK_SET);
fread(iFile, iNumSeq, BLOCK_INT);
fread(iFile, iSeqIndex, BLOCK_INT);

for (new k, i = 0; i < iNumSeq; i++)
{
fseek(iFile, iSeqIndex + 48 + 176 * i, SEEK_SET);
fread(iFile, iNumEvents, BLOCK_INT);
fread(iFile, iEventIndex, BLOCK_INT);
fseek(iFile, iEventIndex + 176 * i, SEEK_SET);

for (k = 0; k < iNumEvents; k++)
{
fseek(iFile, iEventIndex + 4 + 76 * k, SEEK_SET);
fread(iFile, iEvent, BLOCK_INT);
fseek(iFile, 4, SEEK_CUR);

if (iEvent != 5004)
{
continue;
}

fread_blocks(iFile, szSoundPath, 64, BLOCK_CHAR);

if (strlen(szSoundPath))
{
strtolower(szSoundPath);
PRECACHE_SOUND(szSoundPath);
}
}
}
}

fclose(iFile);
}
Всем привет, проблема с пистами со скулл-2 когда покупаешь это орудие, после этого выбрасываешь, когда поднимаешь там ноль патронов, я не знаю как это решить
 
  • Like a Boss
Реакции: DEVV
Сообщения
3,050
Реакции
1,739
Помог
80 раз(а)
Если ваша версия Amx Mod X ниже 1.9.0 , то заполнять анкету смысла нет. На нашем форуме не поддерживаются устаревшие версии.

Заполняя каждое поле, внимательно читайте подсказки под ними. Игнорирование данных действий может повлечь закрытие Вашей темы и тогда Вам придется снова создавать тему согласно требованиям, которые Вы проигнорировали.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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