SVD Custom bug zp_remove_money

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
345
Реакции
77
Помог
14 раз(а)
Ошибка
-
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (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: Jun 19 2019 13:32:02
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34e
Build ID: 5249:6cecb34e
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.6.3.7/Stdio (cstrike)
ReHLDS version: 3.12.0.782-dev
Build date: 12:19:10 Dec 07 2022 (3161)
Build from: https://github.com/dreamstalker/rehlds/commit/5e8b0ba
ReGamedll
ReGameDLL version: 5.21.0.575-dev
Build date: 21:32:24 Dec 17 2022
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/889edc8
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 15:47:38 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] AMX Mod X RUN - amxmodx_mm.dll v1.9.0.5249 ini Start ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.92 ini Start Never
[ 3] Revoice RUN - revoice_mm.dll v0.1.0.32 ini Start Never
[ 4] Ultimate Unprecacher RUN - ultimate_unprecacher_mm.dll v0.3 Alpha ini ANY ANY
[ 5] mmtimer RUN - mmtimer.dll v1.6 ini ANY Never
[ 6] ReAPI RUN - reapi_amxx.dll v5.22.0.254-dev pl1 ANY Never
[ 7] CStrike RUN - cstrike_amxx.dll v1.9.0.5294 pl1 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx.dll v1.9.0.5249 pl1 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx.dll v1.9.0.5249 pl1 ANY ANY
[10] CSX RUN - csx_amxx.dll v1.9.0.5294 pl1 ANY ANY
[11] Engine RUN - engine_amxx.dll v1.9.0.5249 pl1 ANY ANY
[12] Fun RUN - fun_amxx.dll v1.9.0.5249 pl1 ANY ANY
12 plugins, 12 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5249 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5249 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5249 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5249 AMXX Dev Team multilingual.am running
[ 6] Commands Menu 1.9.0.5249 AMXX Dev Team cmdmenu.amxx running
[ 7] Players Menu 1.9.0.5249 AMXX Dev Team plmenu.amxx running
[ 8] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 9] Plugin Menu 1.9.0.5249 AMXX Dev Team pluginmenu.amxx running
[ 10] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 11] Anti Flood 1.9.0.5249 AMXX Dev Team antiflood.amxx running
[ 12] Scrolling Message 1.9.0.5249 AMXX Dev Team scrollmsg.amxx running
[ 13] Info. Messages 1.9.0.5249 AMXX Dev Team imessage.amxx running
[ 14] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 15] NextMap 1.9.0.5249 AMXX Dev Team nextmap.amxx running
[ 16] Nextmap Chooser 1.9.0.5249 AMXX Dev Team mapchooser.amxx running
[ 17] TimeLeft 1.9.0.5249 AMXX Dev Team timeleft.amxx running
[ 18] Pause Plugins 1.9.0.5249 AMXX Dev Team pausecfg.amxx running
[ 19] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 20] no Money 0.1 REVO block_money.amx running
[ 21] [Customizable] AmxModM 0.0.5 Albertio amxmodmenu.amxx running
[ 22] Zombie Plague 4.3 Fix6a MeRcyLeZZ zombie_plague40 debug
[ 23] [ZP]Level System 6.0 Dambas zp_level_system running
[ 24] [API] Addon: Smoke Wal 1.1.1 Yoshioka Haruki zp_addon_smoke_ running
[ 25] [API] Addon: MuzzleFla 1.6 Yoshioka Haruki zp_addon_muzzle running
[ 26] unknown unknown unknown zp43_buymenu.am debug
[ 27] [ZP] Grenade: Antidote 1.0 | 2023 R1CHICOREJZ zp_item_shop_an running
[ 28] mkod_steam_pack 1.0 MKOD zp_item_shop_ar running
[ 29] [ZP] Extra Item: No Re 0.1.0 fezh zp_item_shop_no running
[ 30] UTS-15 1.0 protatype zp_item_shop_ut running
[ 31] Scar Oz-B 1.0 PeTRoX zp_item_shop_sc running
[ 32] [ZP] Extra: K1A Specia 1.0 Crock / =) (Popr zp_item_shop_k1 running
[ 33] [ZP] Extra: Blaster [S 1.0 Crock / =) (Popr zp_item_shop_sf running
[ 34] [CSO] Ethereal 0.0.1 Shurik07 zp_item_shop_et running
[ 35] [ZP] Extra: CSO Weapon 1.1 KORD_12.7 zp_item_shop_ch running
[ 36] [ZP] Weapon: SG552 Cer 1.0 Yoshioka Haruki zp_item_shop_bu running
[ 37] [ZP] Extra: Chey-Tac M 1.0 Crock / =) (Popr zp_item_shop_m2 running
[ 38] [CSO] Weapon: Crossbow 1.0 Base: Batcon & x zp_item_shop_cr running
[ 39] [ZP] ZClass: Hunter 1.0 Undead zp_zombie_class running
[ 40] [ZP] ZClass: Tank 1.0 Undead zp_zombie_class running
[ 41] [ZP] ZClass: Shaman 1.0 Undead zp_zombie_class running
[ 42] [ZP] ZClass: Light 1.0 Undead zp_zombie_class running
[ 43] [ZP] ZClass: Smoker 1.0 Undead zp_zombie_class running
[ 44] [ZP] ZClass: Healer 1.0 Undead zp_zombie_class running
[ 45] [ZP] Vip Menu 1.0.2 Nordic Warrior zp_vipmenu_new. running
[ 46] [ZMO] Weapon: Deagle C 1.0 Chrescoe1 , Plan zp_item_vip_dea running
[ 47] [ZP] Weapon: AK47 Beas 1.0 | 2018 xUnicorn (t3rkec zp_item_vip_ak4 running
[ 48] [ZP] Premium Menu 1.0.2 Nordic Warrior zp_premiummenu_ running
[ 49] [ZP] Extra: CSO Weapon 1.0 Base: Batcon; Re zp_item_premium running
[ 50] [ZP] Weapon: JANUS-5 1.0 xUnicorn (t3rkec zp_item_premium running
[ 51] [ZP] Overlord Menu 1.0.2 Nordic Warrior zp_overlordmenu running
[ 52] [X-CSO] Weapon: Mangum 1.1 xUnicorn (t3rkec zp_item_overlor running
[ 53] [ZMO] Weapon: SF Laser 1.0 Base: Batcon; Re zp_item_overlor running
[ 54] [ZP] Sponsor Menu 1.0.2 Nordic Warrior zp_sponsormenu_ running
[ 55] [ZP] Weapon: Hunter Ki 1.0 Yoshioka Haruki zp_item_sponsor debug
[ 56] [ZP] Weapon: M95 White 1.1 xUnicorn (t3rkec zp_item_sponsor running
[ 57] [ZP] Weapon: Shining H 1.2 xUnicorn (t3rkec zp_item_sponsor running
[ 58] [ZP] Knife: Dragon Swo 1.0 xUnicorn (t3rkec zp_item_knife_d running
[ 59] [CSO] Knife: Dual Swor 0.2 Phenix / Finish: zp_item_knife_d running
[ 60] [ZP] Knife: Dread Nova 1.0 | 2019 xUnicorn (t3rkec zp_item_knife_d running
[ 61] [ZP] Addon: Knife Mod 1.0 xUnicorn zp_addon_knifes running
[ 62] mkod_show_bullet_damag 1.0 MKOD zp_damager.amxx running
[ 63] Respawn 1.0 suNx\tERoR zp_join_spawn.a running
[ 64] Camera View 0.0.1 ConnorMcLeod talrasha_camera running
[ 65] Speedometer 1.3 AciD & Fintok! aspeedometer.am running
[ 66] Bots Control 1.0 NEO bn_bots_control running
66 plugins, 66 running
Автор плагина
inf (nimroK)
Версия плагина
1.1
Исходный код
#pragma compress 1

#include <amxmodx>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>

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

/* ~ [ Offsets ] ~ */
// Linux extra offsets
const linux_diff_weapon = 4;
const linux_diff_player = 5;

// CWeaponBox
const m_rgpPlayerItems_CWeaponBox = 34;

// CBasePlayerItem
const m_pPlayer = 41;
const m_pNext = 42;
const m_iId = 43;

// CBasePlayerWeapon
const m_flNextPrimaryAttack = 46;
const m_flNextSecondaryAttack = 47;
const m_flTimeWeaponIdle = 48;
const m_iPrimaryAmmoType = 49;
const m_iClip = 51;
const m_fInReload = 54;
const m_iGlock18ShotsFired = 70;
const m_iFamasShotsFired = 72;
const m_iWeaponState = 74;
const m_flNextReload = 75;

// CBaseMonster
const m_LastHitGroup = 75;
const m_flNextAttack = 83;

// CBasePlayer
const m_flPainShock = 108;
const m_iFOV = 363;
const m_rpgPlayerItems = 367;
const m_pActiveItem = 373;
const m_rgAmmo = 376;

/* ~ [ Animation Settings ] ~ */
enum {
iAnimIdle = 0,
iAnimShoot,
iAnimReload,
iAnimDraw,
iAnimIdleGrenade,
iAnimShootGrenade,
iAnimShootEmptyGrenade,
iAnimDrawGrenade,
iAnimMoveGrenade,
iAnimMoveCarbine,
};

const Float: flAnimIdle = 0.125;
const Float: flAnimShoot = 1.033333333333333;
const Float: flAnimReload = 3.833333333333333;
const Float: flAnimDraw = 1.033333333333333;
const Float: flAnimShootGrenade = 2.833333333333333;
const Float: flAnimShootEmptyGrenade = 1.2;
const Float: flAnimMove = 1.533333333333333;

/* ~ [ Weapon Settings ] ~ */
new const szWeaponReference[] = "weapon_m4a1";
new const szWeaponList[] = "svd_shop/weapon_svdex";
new const iWeaponList[] = { 4, 90, -1, -1, 0, 6, 22, 0 }; // weapon_m4a1

new const szWeaponModelView[] = "models/svd_shop/v_svdex.mdl";
new const szWeaponModelPlayer[] = "models/svd_shop/p_svdex.mdl";
new const szWeaponModelWorld[] = "models/svd_shop/w_svdex.mdl";
new const szWeaponSounds[][] = { "svd_shop/svdex-1.wav", "svd_shop/svdex-launcher.wav" };

const iWeaponSpecialCode = 212212129;
const iWeaponSlot = 1;
const iWeaponBody = 0;

const iWeaponDamage = 70;
const Float: flWeaponRecoil = 1.058;
const Float: flWeaponRate = 0.342;
const iWeaponClip = 20;
const iWeaponAmmo = 180;

/* ~ [ Grenade Settings ] ~ */
new const szGrenadeClassname[] = "weapon_svdex";
new const szGrenadeModel[] = "models/svd_shop/shell_svdex.mdl"

const iGrenadeAmmo = 10;
const iGrenadeDamage = 510;
const iGrenadeRadius = 120;
const iGrenadeSpeed = 750;

/* ~ [ Params ] ~ */
new gl_iszAllocString_Entity,
gl_iszAllocString_ModelView,
gl_iszAllocString_ModelPlayer,
gl_iszAllocString_InfoTarget,
gl_iszAllocString_Grenade,

gl_iszModelIndex_Trail,
gl_iszModelIndex_Explosion,
gl_iszModelIndex_Smoke,
gl_iszModelIndex_BloodSpray,
gl_iszModelIndex_Blood,
gl_iszModelIndex_SmokePuff,

gl_iszDecalIndex_Scorch,

HamHook: gl_HamHook_TraceAttack[4],

gl_iItemID;

/* ~ [ Amx Mod X ] ~ */
public plugin_init() {
// https://cso.fandom.com/wiki/SVD_Custom
register_plugin("[CSO Like] Weapon: SVD Custom", "1.1 / 03.01.22", "inf (nimroK) / Batcoh: Code base");

// Register on Extra-Items
gl_iItemID = zp_register_extra_item("SVD Custom", 0, ZP_TEAM_HUMAN);

// Hook Weapon
register_clcmd(szWeaponList, "Command_HookWeapon");

// Forwards
register_forward(FM_UpdateClientData, "FM_Hook_UpdateClientData", true);
register_forward(FM_SetModel, "FM_Hook_SetModel", false);

// Weapon
RegisterHam(Ham_Item_Deploy, szWeaponReference, "CWeapon__Deploy", true);
RegisterHam(Ham_Item_Holster, szWeaponReference, "CWeapon__Holster", true);
RegisterHam(Ham_Item_PostFrame, szWeaponReference, "CWeapon__PostFrame", false);
RegisterHam(Ham_Item_AddToPlayer, szWeaponReference, "CWeapon__AddToPlayer", true);
RegisterHam(Ham_Weapon_Reload, szWeaponReference, "CWeapon__Reload", false);
RegisterHam(Ham_Weapon_WeaponIdle, szWeaponReference, "CWeapon__WeaponIdle", false);
RegisterHam(Ham_Weapon_PrimaryAttack, szWeaponReference, "CWeapon__PrimaryAttack", false);
RegisterHam(Ham_Weapon_SecondaryAttack, szWeaponReference, "CWeapon__SecondaryAttack", false);

// Entity
RegisterHam(Ham_Touch, "info_target", "CEntity__Touch", false);

// Trace Attack
gl_HamHook_TraceAttack[0] = RegisterHam(Ham_TraceAttack, "func_breakable", "CEntity__TraceAttack", false);
gl_HamHook_TraceAttack[1] = RegisterHam(Ham_TraceAttack, "info_target", "CEntity__TraceAttack", false);
gl_HamHook_TraceAttack[2] = RegisterHam(Ham_TraceAttack, "player", "CEntity__TraceAttack", false);
gl_HamHook_TraceAttack[3] = RegisterHam(Ham_TraceAttack, "hostage_entity", "CEntity__TraceAttack", false);

fm_ham_hook(false);
}

public plugin_precache() {
// Precache models
engfunc(EngFunc_PrecacheModel, szWeaponModelView);
engfunc(EngFunc_PrecacheModel, szWeaponModelPlayer);
engfunc(EngFunc_PrecacheModel, szWeaponModelWorld);
engfunc(EngFunc_PrecacheModel, szGrenadeModel);

// Precache sounds
for(new i = 0; i < sizeof(szWeaponSounds); i++) engfunc(EngFunc_PrecacheSound, szWeaponSounds[i]);
UTIL_PrecacheSoundsFromModel(szWeaponModelView);

// Precache generic
UTIL_PrecacheSpritesFromTxt(szWeaponList);

// Alloc String
gl_iszAllocString_Entity = engfunc(EngFunc_AllocString, szWeaponReference);
gl_iszAllocString_ModelView = engfunc(EngFunc_AllocString, szWeaponModelView);
gl_iszAllocString_ModelPlayer = engfunc(EngFunc_AllocString, szWeaponModelPlayer);
gl_iszAllocString_InfoTarget = engfunc(EngFunc_AllocString, "info_target");
gl_iszAllocString_Grenade = engfunc(EngFunc_AllocString, szGrenadeClassname);

// Model Index
gl_iszModelIndex_Trail = engfunc(EngFunc_PrecacheModel, "sprites/shellchrome.spr");
gl_iszModelIndex_Explosion = engfunc(EngFunc_PrecacheModel, "sprites/zerogxplode.spr");
gl_iszModelIndex_Smoke = engfunc(EngFunc_PrecacheModel, "sprites/steam1.spr");
gl_iszModelIndex_BloodSpray = engfunc(EngFunc_PrecacheModel, "sprites/bloodspray.spr");
gl_iszModelIndex_Blood = engfunc(EngFunc_PrecacheModel, "sprites/blood.spr");
gl_iszModelIndex_SmokePuff = engfunc(EngFunc_PrecacheModel, "sprites/fast_wallpuff1.spr");

// Decal Index
gl_iszDecalIndex_Scorch = engfunc(EngFunc_DecalIndex, "{scorch1");
}

public Command_HookWeapon(iPlayer) {
engclient_cmd(iPlayer, szWeaponReference);

return PLUGIN_HANDLED;
}

public zp_user_infected_post(iPlayer) UTIL_HideCrosshair(iPlayer, false);

public zp_extra_item_selected(iPlayer, iItem) if(iItem == gl_iItemID) Command_GiveWeapon(iPlayer);
public Command_GiveWeapon(iPlayer) {
static iEntity; iEntity = engfunc(EngFunc_CreateNamedEntity, gl_iszAllocString_Entity);

if(!pev_valid(iEntity)) return PLUGIN_CONTINUE;

set_pev(iEntity, pev_impulse, iWeaponSpecialCode);
ExecuteHam(Ham_Spawn, iEntity);
UTIL_DropWeapon(iPlayer, iWeaponSlot);

if(!ExecuteHamB(Ham_AddPlayerItem, iPlayer, iEntity)) {
set_pev(iEntity, pev_flags, FL_KILLME);

return PLUGIN_CONTINUE;
}

ExecuteHamB(Ham_Item_AttachToPlayer, iEntity, iPlayer);

new iAmmoType = m_rgAmmo + get_pdata_int(iEntity, m_iPrimaryAmmoType, linux_diff_weapon);

if(get_pdata_int(iPlayer, m_rgAmmo, linux_diff_player) < iWeaponAmmo)
set_pdata_int(iPlayer, iAmmoType, iWeaponAmmo, linux_diff_player);

set_pdata_int(iEntity, m_iClip, iWeaponClip, linux_diff_weapon);
set_pdata_int(iEntity, m_iGlock18ShotsFired, iWeaponClip, linux_diff_weapon);
set_pdata_int(iEntity, m_iFamasShotsFired, iGrenadeAmmo, linux_diff_weapon);
set_pdata_int(iEntity, m_iWeaponState, 0, linux_diff_weapon);
set_pdata_float(iEntity, m_flNextReload, 0.0, linux_diff_weapon);

emit_sound(iPlayer, CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

return PLUGIN_HANDLED;
}

public FM_Hook_UpdateClientData(iPlayer, SendWeapons, CD_Handle) {
if(!is_user_alive(iPlayer)) return;

static iItem; iItem = get_pdata_cbase(iPlayer, m_pActiveItem, linux_diff_player);

if(pev_valid(iItem) != 2 || !IsCustomItem(iItem)) return;

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

public FM_Hook_SetModel(iEntity) {
static i, szClassName[32], iItem; pev(iEntity, pev_classname, szClassName, charsmax(szClassName));

if(!equal(szClassName, "weaponbox")) return FMRES_IGNORED;

for(i = 0; i < 6; i++) {
iItem = get_pdata_cbase(iEntity, m_rgpPlayerItems_CWeaponBox + i, linux_diff_weapon);

if(iItem > 0 && IsCustomItem(iItem)) {
engfunc(EngFunc_SetModel, iEntity, szWeaponModelWorld);
set_pev(iEntity, pev_body, iWeaponBody);

return FMRES_SUPERCEDE;
}
}

return FMRES_IGNORED;
}

public CWeapon__Deploy(iItem) {
if(!IsCustomItem(iItem)) return;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

set_pev_string(iPlayer, pev_viewmodel2, gl_iszAllocString_ModelView);
set_pev_string(iPlayer, pev_weaponmodel2, gl_iszAllocString_ModelPlayer);

UTIL_SendWeaponAnim(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? iAnimDrawGrenade : iAnimDraw);
UTIL_HideCrosshair(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? true : false);
UTIL_AmmoUpdate(iPlayer, iItem);

set_pdata_int(iPlayer, m_iFOV, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? 89 : 0, linux_diff_player);
set_pdata_float(iPlayer, m_flNextAttack, flAnimDraw, linux_diff_player);
set_pdata_float(iItem, m_flNextPrimaryAttack, flAnimDraw, linux_diff_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, flAnimDraw, linux_diff_weapon);
set_pdata_float(iItem, m_flTimeWeaponIdle, flAnimDraw, linux_diff_weapon);
}

public CWeapon__Holster(iItem) {
if(!IsCustomItem(iItem)) return;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

UTIL_HideCrosshair(iPlayer, false);
}

public CWeapon__PostFrame(iItem) {
if(!IsCustomItem(iItem)) return HAM_IGNORED;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);
static iClip; iClip = get_pdata_int(iItem, m_iClip, linux_diff_weapon);

if(!get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon)) UTIL_ResetCrosshair(iPlayer, iItem, iClip);

if(get_pdata_int(iItem, m_fInReload, linux_diff_weapon) == 1) {
static iAmmoType; iAmmoType = m_rgAmmo + get_pdata_int(iItem, m_iPrimaryAmmoType, linux_diff_weapon);
static iAmmo; iAmmo = get_pdata_int(iPlayer, iAmmoType, linux_diff_player);
static j; j = min(iWeaponClip - iClip, iAmmo);

set_pdata_int(iItem, m_iClip, iClip + j, linux_diff_weapon);
set_pdata_int(iPlayer, iAmmoType, iAmmo - j, linux_diff_player);
set_pdata_int(iItem, m_fInReload, 0, linux_diff_weapon);
}

return HAM_IGNORED;
}

public CWeapon__AddToPlayer(iItem, iPlayer) {
if(IsCustomItem(iItem)) UTIL_WeaponList(iPlayer, true);
else if(pev(iItem, pev_impulse) == 0) UTIL_WeaponList(iPlayer, false);
}

public CWeapon__Reload(iItem) {
if(!IsCustomItem(iItem)) return HAM_IGNORED;

static iClip; iClip = get_pdata_int(iItem, m_iClip, linux_diff_weapon);

if(iClip >= iWeaponClip || get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon)) return HAM_SUPERCEDE;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);
static iAmmoType; iAmmoType = m_rgAmmo + get_pdata_int(iItem, m_iPrimaryAmmoType, linux_diff_weapon);

if(get_pdata_int(iPlayer, iAmmoType, linux_diff_player) <= 0) return HAM_SUPERCEDE;

set_pdata_int(iItem, m_iClip, 0, linux_diff_weapon);
ExecuteHam(Ham_Weapon_Reload, iItem);
set_pdata_int(iItem, m_iClip, iClip, linux_diff_weapon);
set_pdata_int(iItem, m_fInReload, 1, linux_diff_weapon);

UTIL_SendWeaponAnim(iPlayer, iAnimReload);
set_pdata_float(iPlayer, m_flNextAttack, flAnimReload, linux_diff_player);
set_pdata_float(iItem, m_flNextPrimaryAttack, flAnimReload, linux_diff_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, flAnimReload, linux_diff_weapon);
set_pdata_float(iItem, m_flTimeWeaponIdle, flAnimReload, linux_diff_weapon);

return HAM_SUPERCEDE;
}

public CWeapon__WeaponIdle(iItem) {
if(!IsCustomItem(iItem) || get_pdata_float(iItem, m_flTimeWeaponIdle, linux_diff_weapon) > 0.0) return HAM_IGNORED;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

UTIL_SendWeaponAnim(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? iAnimIdleGrenade : iAnimIdle);
set_pdata_float(iItem, m_flTimeWeaponIdle, flAnimIdle, linux_diff_weapon);

return HAM_SUPERCEDE;
}

public CWeapon__PrimaryAttack(iItem) {
if(!IsCustomItem(iItem)) return HAM_IGNORED;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);
static iGrenade; iGrenade = get_pdata_int(iItem, m_iFamasShotsFired, linux_diff_weapon);

if(get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon)) {
if(iGrenade <= 0) {
ExecuteHam(Ham_Weapon_PlayEmptySound, iItem);
set_pdata_float(iItem, m_flNextPrimaryAttack, 0.2, linux_diff_weapon);

return HAM_SUPERCEDE;
}

if(get_pdata_float(iItem, m_flNextReload, linux_diff_weapon) > get_gametime()) return HAM_SUPERCEDE;

static Float: vecOrigin[3]; pev(iPlayer, pev_origin, vecOrigin);
static Float: vecViewOfs[3]; pev(iPlayer, pev_view_ofs, vecViewOfs);
static Float: vecAngles[3]; pev(iPlayer, pev_v_angle, vecAngles);
static Float: vecForward[3]; angle_vector(vecAngles, ANGLEVECTOR_FORWARD, vecForward);

vecOrigin[0] += vecViewOfs[0] + vecForward[0] * 32.0;
vecOrigin[1] += vecViewOfs[1] + vecForward[1] * 32.0;
vecOrigin[2] += vecViewOfs[2] + vecForward[2] * 32.0;

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_EXPLOSION);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2]);
write_short(gl_iszModelIndex_SmokePuff); // Id Sprite
write_byte(8); // Sprite size
write_byte(60); // Sprite framerate
write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES); // Sprite flags
message_end();

set_pdata_int(iItem, m_iFamasShotsFired, iGrenade - 1, linux_diff_weapon);
set_pdata_float(iItem, m_flNextReload, iGrenade == 1 ? get_gametime() + flAnimShootEmptyGrenade : get_gametime() + flAnimShootGrenade, linux_diff_weapon);

CGrenade__CreateGrenade(iPlayer);
UTIL_AmmoUpdate(iPlayer, iItem);
UTIL_PlayerAnimation(iPlayer, pev(iPlayer, pev_flags) & FL_DUCKING ? "crouch_shoot_rifle" : "ref_shoot_rifle");
}
else {
if(get_pdata_int(iItem, m_iClip, linux_diff_weapon) <= 0) {
ExecuteHam(Ham_Weapon_PlayEmptySound, iItem);
set_pdata_float(iItem, m_flNextPrimaryAttack, 0.2, linux_diff_weapon);

return HAM_SUPERCEDE;
}

static fw_TraceLine; fw_TraceLine = register_forward(FM_TraceLine, "FM_Hook_TraceLine", true);
static fw_PlayBackEvent; fw_PlayBackEvent = register_forward(FM_PlaybackEvent, "FM_Hook_PlayBackEvent", false);
fm_ham_hook(true);

ExecuteHam(Ham_Weapon_PrimaryAttack, iItem);

unregister_forward(FM_TraceLine, fw_TraceLine, true);
unregister_forward(FM_PlaybackEvent, fw_PlayBackEvent);
fm_ham_hook(false);

UTIL_Recoil(iPlayer, flWeaponRecoil);
UTIL_IncreaseCrosshair(iPlayer, iItem, get_pdata_int(iItem, m_iClip, linux_diff_weapon));
}

UTIL_SendWeaponAnim(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? (iGrenade == 1 ? iAnimShootEmptyGrenade : iAnimShootGrenade) : iAnimShoot);
emit_sound(iPlayer, CHAN_WEAPON, szWeaponSounds[get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? 1 : 0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

set_pdata_float(iItem, m_flNextPrimaryAttack, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? (iGrenade == 1 ? flAnimShootEmptyGrenade : flAnimShootGrenade) : flWeaponRate, linux_diff_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? (iGrenade == 1 ? flAnimShootEmptyGrenade : flAnimShootGrenade) : flAnimShoot, linux_diff_weapon);
set_pdata_float(iItem, m_flTimeWeaponIdle, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? (iGrenade == 1 ? flAnimShootEmptyGrenade : flAnimShootGrenade) : flAnimShoot, linux_diff_weapon);

return HAM_SUPERCEDE;
}

public CWeapon__SecondaryAttack(iItem) {
if(!IsCustomItem(iItem)) return HAM_IGNORED;

static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

if(!get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon)) set_pdata_int(iItem, m_iGlock18ShotsFired, get_pdata_int(iItem, m_iClip, linux_diff_weapon), linux_diff_weapon);

set_pdata_int(iItem, m_iWeaponState, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? 0 : 1, linux_diff_weapon);
set_pdata_int(iItem, m_iClip, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? -1 : get_pdata_int(iItem, m_iGlock18ShotsFired, linux_diff_weapon));
set_pdata_int(iPlayer, m_iFOV, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? 89 : 0, linux_diff_player);
set_pdata_float(iPlayer, m_flNextAttack, flAnimMove, linux_diff_player);
set_pdata_float(iItem, m_flNextPrimaryAttack, flAnimMove, linux_diff_weapon);
set_pdata_float(iItem, m_flNextSecondaryAttack, flAnimMove, linux_diff_weapon);
set_pdata_float(iItem, m_flTimeWeaponIdle, flAnimMove, linux_diff_weapon);

UTIL_SendWeaponAnim(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? iAnimMoveGrenade : iAnimMoveCarbine);
UTIL_HideCrosshair(iPlayer, get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? true : false);
UTIL_AmmoUpdate(iPlayer, iItem);

return HAM_SUPERCEDE;
}

public CGrenade__CreateGrenade(iPlayer) {
new iEntity = engfunc(EngFunc_CreateNamedEntity, gl_iszAllocString_InfoTarget);

static Float: vecOrigin[3]; pev(iPlayer, pev_origin, vecOrigin);
static Float: vecViewOfs[3]; pev(iPlayer, pev_view_ofs, vecViewOfs);
static Float: vecAngles[3]; pev(iPlayer, pev_angles, vecAngles);
static Float: vecVelocity[3]; velocity_by_aim(iPlayer, iGrenadeSpeed, vecVelocity);

vecOrigin[0] += vecViewOfs[0];
vecOrigin[1] += vecViewOfs[1];
vecOrigin[2] += vecViewOfs[2];

set_pev_string(iEntity, pev_classname, gl_iszAllocString_Grenade);
set_pev(iEntity, pev_owner, iPlayer);
set_pev(iEntity, pev_solid, SOLID_TRIGGER);
set_pev(iEntity, pev_movetype, MOVETYPE_TOSS);
set_pev(iEntity, pev_velocity, vecVelocity);
engfunc(EngFunc_VecToAngles, vecVelocity, vecAngles);
set_pev(iEntity, pev_angles, vecAngles);
set_pev(iEntity, pev_gravity, 0.5);
set_pev(iPlayer, pev_punchangle, Float: { -2.5, 0.0, 0.0 });

engfunc(EngFunc_SetModel, iEntity, szGrenadeModel);
engfunc(EngFunc_SetOrigin, iEntity, vecOrigin);

message_begin(MSG_ALL, SVC_TEMPENTITY);
write_byte(TE_BEAMFOLLOW); // TE
write_short(iEntity); // Target
write_short(gl_iszModelIndex_Trail); // Model Index
write_byte(3); // Life
write_byte(2); // Width
write_byte(255); // Red
write_byte(255); // Green
write_byte(255); // Blue
write_byte(255); // Alpha
message_end();
}

public CEntity__Touch(iEntity, iTouch) {
if(pev_valid(iEntity) != 2) return HAM_IGNORED;

if(pev(iEntity, pev_classname) == gl_iszAllocString_Grenade) {
new iOwner = pev(iEntity, pev_owner);
new Float: vecOrigin[3]; pev(iEntity, pev_origin, vecOrigin);

if(!is_user_connected(iOwner) || engfunc(EngFunc_PointContents, vecOrigin) == CONTENTS_SKY) {
set_pev(iEntity, pev_flags, FL_KILLME);

return HAM_IGNORED;
}

if(iTouch == iOwner) return HAM_SUPERCEDE;

iTouch = FM_NULLENT;

while((iTouch = engfunc(EngFunc_FindEntityInSphere, iTouch, vecOrigin, float(iGrenadeRadius))) != 0) {
if(pev(iTouch, pev_takedamage) == DAMAGE_NO) continue;
if(is_user_alive(iTouch)) if(!zp_get_user_zombie(iTouch) || !is_wall_between_points(iEntity, iTouch)) continue;
else if(pev(iTouch, pev_solid) == SOLID_BSP) if(pev(iTouch, pev_spawnflags) & SF_BREAK_TRIGGER_ONLY) continue;

UTIL_FakeTakeDamage(iTouch, iEntity, iOwner, float(iGrenadeDamage), DMG_GRENADE, 1.0);
}

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_EXPLOSION);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2] + 50.0);
write_short(gl_iszModelIndex_Explosion); // Id Sprite
write_byte(30); // Sprite size
write_byte(15); // Sprite framerate
write_byte(TE_EXPLFLAG_NONE); // Sprite flags
message_end();

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_SMOKE);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2] + 50.0);
write_short(gl_iszModelIndex_Smoke); // ModelIndex
write_byte(30); // Scale
write_byte(10); // FPS
message_end();

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_WORLDDECAL);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2]);
write_byte(gl_iszDecalIndex_Scorch); // ModelIndex
message_end();

set_pev(iEntity, pev_flags, FL_KILLME);
}

return HAM_IGNORED;
}

public CEntity__TraceAttack(iVictim, iAttacker, Float: flDamage) {
if(!is_user_connected(iAttacker)) return;

static iItem; iItem = get_pdata_cbase(iAttacker, m_pActiveItem, linux_diff_player);

if(iItem <= 0 || !IsCustomItem(iItem)) return;

SetHamParamFloat(3, float(iWeaponDamage));
}

public fm_ham_hook(bool: bEnabled) {
if(bEnabled) {
EnableHamForward(gl_HamHook_TraceAttack[0]);
EnableHamForward(gl_HamHook_TraceAttack[1]);
EnableHamForward(gl_HamHook_TraceAttack[2]);
EnableHamForward(gl_HamHook_TraceAttack[3]);
}
else {
DisableHamForward(gl_HamHook_TraceAttack[0]);
DisableHamForward(gl_HamHook_TraceAttack[1]);
DisableHamForward(gl_HamHook_TraceAttack[2]);
DisableHamForward(gl_HamHook_TraceAttack[3]);
}
}

public FM_Hook_TraceLine(Float: vecStart[3], Float: vecEnd[3], iIgnore, iPlayer, iTrace) {
if(iIgnore & IGNORE_MONSTERS) return FMRES_IGNORED;

static iHit; iHit = get_tr2(iTrace, TR_pHit);
static Float: vecEndPos[3]; get_tr2(iTrace, TR_vecEndPos, vecEndPos);

if(iHit > 0) if(pev(iHit, pev_solid) != SOLID_BSP) return FMRES_IGNORED;

engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEndPos, 0);
write_byte(TE_GUNSHOTDECAL);
engfunc(EngFunc_WriteCoord, vecEndPos[0]);
engfunc(EngFunc_WriteCoord, vecEndPos[1]);
engfunc(EngFunc_WriteCoord, vecEndPos[2]);
write_short(iHit > 0 ? iHit : 0);
write_byte(random_num(41, 45));
message_end();

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0);
write_byte(TE_EXPLOSION);
engfunc(EngFunc_WriteCoord, vecEndPos[0]);
engfunc(EngFunc_WriteCoord, vecEndPos[1]);
engfunc(EngFunc_WriteCoord, vecEndPos[2] - 13.0);
write_short(gl_iszModelIndex_SmokePuff); // Id Sprite
write_byte(random_num(2, 3)); // Sprite size
write_byte(60); // Sprite framerate
write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES); // Sprite flags
message_end();

return FMRES_IGNORED;
}

public FM_Hook_PlayBackEvent() return FMRES_SUPERCEDE;

/* ~ [ Stocks ] ~ */
stock UTIL_PlayerAnimation(iPlayer, szAnim[]) {
new iAnimDesired, Float: flFrameRate, Float: flGroundSpeed, bool: bLoops;

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

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

set_pdata_int(iPlayer, 40, bLoops, linux_diff_weapon);
set_pdata_int(iPlayer, 39, 0, linux_diff_weapon);

set_pdata_float(iPlayer, 36, flFrameRate, linux_diff_weapon);
set_pdata_float(iPlayer, 37, flGroundSpeed, linux_diff_weapon);
set_pdata_float(iPlayer, 38, get_gametime(), linux_diff_weapon);

set_pdata_int(iPlayer, 73, 28, linux_diff_player);
set_pdata_int(iPlayer, 74, 28, linux_diff_player);
set_pdata_float(iPlayer, 220, get_gametime(), linux_diff_player);
}

stock is_wall_between_points(iPlayer, iEntity) {
if(!is_user_alive(iEntity)) return PLUGIN_CONTINUE;

new iTrace = create_tr2();
new Float: flStart[3], Float: flEnd[3], Float: flEndPos[3];

pev(iPlayer, pev_origin, flStart);
pev(iEntity, pev_origin, flEnd);

engfunc(EngFunc_TraceLine, flStart, flEnd, IGNORE_MONSTERS, iPlayer, iTrace);
get_tr2(iTrace, TR_vecEndPos, flEndPos);

free_tr2(iTrace);

return xs_vec_equal(flEnd, flEndPos);
}

stock UTIL_IncreaseCrosshair(iPlayer, iItem, iClip) {
set_msg_block(get_user_msgid("CurWeapon"), BLOCK_ONCE);

message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, iPlayer);
write_string(szWeaponList);
write_byte(iWeaponList[0]);
write_byte(iWeaponAmmo);
write_byte(iWeaponList[2]);
write_byte(iWeaponList[3]);
write_byte(iWeaponList[4]);
write_byte(13);
write_byte(7);
write_byte(iWeaponList[7]);
message_end();

message_begin(MSG_ONE, get_user_msgid("CurWeapon"), _, iPlayer);
write_byte(true);
write_byte(7);
write_byte(iClip);
message_end();

set_pdata_float(iItem, m_flNextReload, get_gametime() + 0.04, linux_diff_weapon);
}

stock UTIL_ResetCrosshair(iPlayer, iItem, iClip) {
if(get_pdata_float(iItem, m_flNextReload, linux_diff_weapon) && get_pdata_float(iItem, m_flNextReload, linux_diff_weapon) <= get_gametime()) {
message_begin(MSG_ONE, get_user_msgid("CurWeapon"), _, iPlayer);
write_byte(true);
write_byte(iWeaponList[6]);
write_byte(iClip);
message_end();

set_pdata_float(iItem, m_flNextReload, 0.0, linux_diff_weapon);
}
}

stock UTIL_AmmoUpdate(iPlayer, iItem) {
message_begin(MSG_ONE, get_user_msgid("AmmoX"), _, iPlayer);
write_byte(iWeaponList[0]); // AmmoID
write_byte(get_pdata_int(iItem, m_iWeaponState, linux_diff_weapon) ? get_pdata_int(iItem, m_iFamasShotsFired, linux_diff_weapon) : get_pdata_int(iPlayer, m_rgAmmo + get_pdata_int(iItem, m_iPrimaryAmmoType, linux_diff_weapon), linux_diff_player)); // Ammount
message_end();
}

stock UTIL_FakeTakeDamage(iVictim, iWeapon, iAttacker, Float: flDamage, iDmgType, Float: flPainShock) {
if(is_user_alive(iVictim)) {
UTIL_BloodDrips(iVictim);

static Float: vecVelocity[3], Float: vecPunchAngle[3];

vecVelocity[0] = random_float(-100.0, 100.0);
vecVelocity[1] = random_float(-100.0, 100.0);
vecVelocity[2] = 200.0;

vecPunchAngle[0] = random_float(-25.0, 25.0);
vecPunchAngle[1] = random_float(-25.0, 25.0);
vecPunchAngle[2] = random_float(-25.0, 25.0);

set_pev(iVictim, pev_velocity, vecVelocity);
set_pev(iVictim, pev_punchangle, vecPunchAngle);

set_pdata_int(iVictim, m_LastHitGroup, HIT_GENERIC, linux_diff_player);
set_pdata_float(iVictim, m_flPainShock, flPainShock, linux_diff_player);
}

ExecuteHamB(Ham_TakeDamage, iVictim, iWeapon, iAttacker, random_float(flDamage - (flDamage * 0.25), flDamage + (flDamage * 0.25)), iDmgType);
}

stock UTIL_HideCrosshair(iPlayer, bool: bHide) {
message_begin(MSG_ONE, get_user_msgid("HideWeapon"), _, iPlayer);
write_byte(bHide ? 1<<6 : 1>>6); // If bHie = true then hide crosshair else show crosshair
message_end();
}

stock UTIL_BloodDrips(iVictim) {
static Float: vecOrigin[3]; pev(iVictim, pev_origin, vecOrigin);

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOrigin, 0);
write_byte(TE_BLOODSPRITE);
engfunc(EngFunc_WriteCoord, vecOrigin[0]);
engfunc(EngFunc_WriteCoord, vecOrigin[1]);
engfunc(EngFunc_WriteCoord, vecOrigin[2]);
write_short(gl_iszModelIndex_BloodSpray);
write_short(gl_iszModelIndex_Blood);
write_byte(ExecuteHamB(Ham_BloodColor, iVictim));
write_byte(min(max(3, 255 / 10), 16));
message_end();
}

stock UTIL_Recoil(iPlayer, Float: flRecoil) {
static Float: vecPunchAngle[3]; pev(iPlayer, pev_punchangle, vecPunchAngle);

vecPunchAngle[0] *= flRecoil;
vecPunchAngle[1] *= flRecoil;
vecPunchAngle[2] *= flRecoil;

set_pev(iPlayer, pev_punchangle, vecPunchAngle);
}

stock UTIL_SendWeaponAnim(iPlayer, iAnim, iBody = 0) {
set_pev(iPlayer, pev_weaponanim, iAnim);

message_begin(MSG_ONE, SVC_WEAPONANIM, _, iPlayer);
write_byte(iAnim);
write_byte(iBody);
message_end();
}

stock UTIL_DropWeapon(iPlayer, iSlot) {
static iEntity, iNext, szWeaponName[32]; iEntity = get_pdata_cbase(iPlayer, m_rpgPlayerItems + iSlot, linux_diff_player);

if(iEntity > 0) {
do {
iNext = get_pdata_cbase(iEntity, m_pNext, linux_diff_weapon);

if(get_weaponname(get_pdata_int(iEntity, m_iId, linux_diff_weapon), szWeaponName, charsmax(szWeaponName)))
engclient_cmd(iPlayer, "drop", szWeaponName);
}

while((iEntity = iNext) > 0);
}
}

stock UTIL_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);
engfunc(EngFunc_PrecacheSound, szSoundPath);
}
}
}
}

fclose(iFile);
}

stock UTIL_PrecacheSpritesFromTxt(const szWeaponList[]) {
new szTxtDir[64], szSprDir[64];
new szFileData[128], szSprName[48], temp[1];

format(szTxtDir, charsmax(szTxtDir), "sprites/%s.txt", szWeaponList);
engfunc(EngFunc_PrecacheGeneric, szTxtDir);

new iFile = fopen(szTxtDir, "rb");

while(iFile && !feof(iFile)) {
fgets(iFile, szFileData, charsmax(szFileData));
trim(szFileData);

if(!strlen(szFileData)) continue;

new pos = containi(szFileData, "640");

if(pos == -1) continue;

format(szFileData, charsmax(szFileData), "%s", szFileData[pos+3]);
trim(szFileData);

strtok(szFileData, szSprName, charsmax(szSprName), temp, charsmax(temp), ' ', 1);
trim(szSprName);

format(szSprDir, charsmax(szSprDir), "sprites/%s.spr", szSprName);
engfunc(EngFunc_PrecacheGeneric, szSprDir);
}

if(iFile) fclose(iFile);
}

stock UTIL_WeaponList(iPlayer, bool: bEnabled) {
message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, iPlayer);
write_string(bEnabled ? szWeaponList : szWeaponReference);
write_byte(iWeaponList[0]);
write_byte(bEnabled ? iWeaponAmmo : iWeaponList[1]);
write_byte(iWeaponList[2]);
write_byte(iWeaponList[3]);
write_byte(iWeaponList[4]);
write_byte(iWeaponList[5]);
write_byte(iWeaponList[6]);
write_byte(iWeaponList[7]);
message_end();
}
Приветствую! Подскажите пожалуйста куда копать.

В Zombie Plague 4.3 есть квар zp_remove_money, который отключает деньги в худе. И по какой-то причине когда включен плагин SVD Custom деньги начинают отображаться и что самое интересно только за зомби.


Спасибо!
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
public zp_user_infected_post(iPlayer) UTIL_HideCrosshair(iPlayer, false);
В true выстави
 
Сообщения
345
Реакции
77
Помог
14 раз(а)
BiZaJe, в true не помогло, помогло убрать полностью паблик. Но при инфекции остается прицел в таком случае. Можно ли как-то поправить этот сток

Код:
stock UTIL_HideCrosshair(iPlayer, bool: bHide) {
    message_begin(MSG_ONE, get_user_msgid("HideWeapon"), _, iPlayer);
    write_byte(bHide ? 1<<6 : 1>>6); // If bHie = true then hide crosshair else show crosshair
    message_end();
}
или по другому убирать прицел? Чтобы деньги не застрагивались
 
Сообщения
134
Реакции
463
Помог
2 раз(а)
KOLOKOLb4UK, Ну попробуй костыль небольшой затестить.

Код:
public zp_user_infected_post(iPlayer){
    UTIL_HideCrosshair(iPlayer, false);
    UTIL_HideMoney(iPlayer);
}


stock UTIL_HideMoney(iPlayer) {
    message_begin(MSG_ONE, get_user_msgid("HideWeapon"), _, iPlayer);
    write_byte(1<<5);
    message_end();
}
 
Сообщения
345
Реакции
77
Помог
14 раз(а)
Хотя в таком случае
UTIL_HideCrosshair(iPlayer, false);
либо не юзается, либо UTIL_HideMoney(iPlayer); перекрывает его и соответственно прицел остается.
 
Сообщения
345
Реакции
77
Помог
14 раз(а)
Решение проблемы

Код:
stock UTIL_HideCrosshair(iPlayer, bool: bHide) {
    message_begin(MSG_ONE, get_user_msgid("HideWeapon"), _, iPlayer);
-    write_byte(bHide ? 1<<6 : 1>>6); // If bHie = true then hide crosshair else show crosshair
+    write_byte(bHide ? (1<<5 | 1<<6) : (1<<5 | 1>>6)); // If bHie = true then hide crosshair else show crosshair
    message_end();
}
Спасибо medusa за данный вариант решения проблемы
 
Статус
В этой теме нельзя размещать новые ответы.

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

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