Server Crash

Сообщения
18
Реакции
0
Помог
1 раз(а)
Ошибка
----------------------------------------------
CRASH: Fri Aug 23 18:45:31 CEST 2024
Start Line: ./hlds_linux -game cstrike +ip 51.195.97.176 -port 27018 +maxplayers 32 +map ze_jurassicpark4 +mapchangecfgfile server.cfg +fps_max 333 +sys_ticrate 333 +heapsize 512000 -zone 2048 -num_edicts 2048 -nobreakpad -master -debug -pidfile hlds.18410.pid
End of crash report
----------------------------------------------
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5294 (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: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.13.0.819-dev
Build date: 15:18:27 Mar 18 2024 (3628)
Build from: https://github.com/dreamstalker/rehlds/commit/ec47e4d
ReGamedll
ReGameDLL version: 5.22.0.593-dev
Build date: 03:10:30 Jul 11 2023
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/e1d1c11
Версия Metamod
Metamod-r v1.3.0.149, API (5:13)
Metamod-r build: 18:21:12 Jan 15 2024
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/603a257
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so-92c v0.1.92d ini Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5294 ini Start ANY
[ 3] Print Center Fix RUN - printcenterfix_mm_i386.so v2.0.1 ini ANY ANY
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.4.3 ini Chlvl ANY
[ 5] Revoice RUN - revoice_plus_mm.so v1.0.3 ini ANY Never
[ 6] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 7] ReAPI RUN - reapi_amxx_i386.so v5.22.0.254-dev pl2 ANY Never
[ 8] IPHub Client RUN - iphubclient_amxx_i386.so v1.0.1 pl2 ANY Never
[ 9] gRIP RUN - grip_amxx_i386.so v0.1.5 Beta pl2 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[11] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[12] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[13] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[14] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[15] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[16] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
[17] CSX RUN - csx_amxx_i386.so v1.9.0.5294 pl2 ANY ANY
17 plugins, 17 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Bypass Guard 1.0.9 mx?! bypass_guard.am running
[ 2] [BG] Provider: IPHub-C 1.3 mx?! bg_provider_iph running
[ 3] UcanBAN + UzaBAN 1.4 Persians Special idchan debug
[ 4] Ultimate Bans 1.9 Souvik UltimateBans.am running
[ 5] Aliases checker 1.0.3 kanagava alias_detector. running
[ 6] Gag System 1.1 TheRedShoko @ AM gag_system.amxx running
[ 7] Multi FastDL 1.2 JoRoPiTo multifast.amxx running
[ 8] Fix fast download to r 0.0.3 PomanoB \ Bos93 FIxFastDL.amxx running
[ 9] Admin Base 1.9.0.5294 AMXX Dev Team admin.amxx running
[ 10] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 11] Admin Help 1.9.0.5294 AMXX Dev Team adminhelp.amxx running
[ 12] Slots Reservation 1.9.0.5294 AMXX Dev Team adminslots.amxx running
[ 13] Multi-Lingual System 1.9.0.5294 AMXX Dev Team multilingual.am running
[ 14] Menus Front-End 1.9.0.5271 AMXX Dev Team menufront.amxx running
[ 15] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 16] Players Menu 1.9.0.5271 AMXX Dev Team plmenu.amxx running
[ 17] Discord Reports 0.2 paffgame telemenu.amxx running
[ 18] Maps Menu 1.9.0.5294 AMXX Dev Team mapsmenu.amxx running
[ 19] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 20] Admin Chat 2.0 Hell Phoenix/EJL adminchat.amxx running
[ 21] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 22] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 23] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 24] Admin Votes 1.8.2 AMXX Dev Team adminvote.amxx running
[ 25] NextMap 1.9.0.5271 AMXX Dev Team nextmap.amxx running
[ 26] TimeLeft 1.9.0.5271 AMXX Dev Team timeleft.amxx running
[ 27] Pause Plugins 1.9.0.5294 AMXX Dev Team pausecfg.amxx running
[ 28] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 29] [AMXX] - FPS MAX 1.0 Nill_ fpsmax.amxx running
[ 30] NadeModes 11.2 Nomexous & OT nademodes.amxx running
[ 31] Auto Demo Record 1.0 Remo amx_demorecorde running
[ 32] KGB Bots 2.1 OvidiuS & Desika kgbbots.amxx running
[ 33] Menu per shum servera 1.0 c0d3 lista-serverave running
[ 34] SteamID Bans 1.0 Eivor ze_steamidbans. running
[ 35] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 36] Don't say IPs 0.1 JGHG no_ip_spam.amxx running
[ 37] No Radio Flood 1.1 Starsailor no_radio_flood. running
[ 38] Advanced Spam Nick Cha 1.0 Fullserver tgs_spam_nick.a running
[ 39] New-Era_UnlimitedAmmo 1.0.1 New-Era Scriptin unlimited_ammoc running
[ 40] WalkGuard 1.3.2 mogel walkguard.amxx running
[ 41] Precache X 1.0 Dias Leon & DeXT PrecacheX.amxx running
[ 42] Chat Logger 2.1a Jim chat_logger.amx running
[ 43] GO SPEC 1.0 Remo admin_spec.amxx running
[ 44] AutoJoin 2.0b SideWinder TGS_autoJoin.am running
[ 45] KH_HEALTH 1.0 Kulogram ze_show_damage. running
[ 46] Show IP 1.0 $uicid3 amx_showip.amxx running
[ 47] No Block 1.0 Remo block_entity.am running
[ 48] Block Sprays 1.0 29th ID block_spray.amx running
[ 49] Break & Button Info 1.0 Remo ButtonInfo.amxx running
[ 50] Matematik Quiz 1.0 EliVvo. Quiz.amxx running
[ 51] Slay Team 1.0 hleV slay_team.amxx running
[ 52] FPS CHECKER 1.1 EliVvo. fps_checker.amx running
[ 53] Camera View Menu v1.0 AUTHOR ze_cam.amxx running
[ 54] Target Info 1.0 Raheem ze_showinfo.amx running
[ 55] Show keys 1.0.0 OpenHNS showkeys.amxx running
[ 56] TGS Grab-Menu 1.0 Remo ze_tgs_grab.amx running
[ 57] Admin activity 1.0 Askhanar Admin_activity. running
[ 58] Nades Remover 0.0.1 ConnorMcLeod grenades_maprem running
[ 59] Sys Tick 1.1 ->UrOS<- systick.amxx paused
[ 60] [ZE] Core/Engine 1.6 ZE Dev Team ze_core.amxx running
[ 61] [AMXX] External Settin 0.1 WiLS amx_settings_ap running
[ 62] [CS] Weapon Models API 1.1 WiLS cs_weap_models_ running
[ 63] [ZE] Blocked Messages 1.6 ZE Dev Team ze_block_events running
[ 64] [ZE] Nightvision/Light 1.6 ZE Dev Team ze_nightvision_ running
[ 65] [ZE] Frags Awards/Deat 1.6 ZE Dev Team ze_effects_frag running
[ 66] [ZE] Weather Effects 1.6 ZE Dev Team ze_effects_weat running
[ 67] [ZE] Escape Coins Syst 1.6 ZE Dev Team ze_coins_system running
[ 68] [ZE] Items Manager 1.6 ZE Dev Team ze_items_manage running
[ 69] [ZE] Items Manager: Es 1.6 ZE Dev Team ze_items_escape running
[ 70] [ZE] Items Manager: Li 1.6 ZE Dev Team ze_items_limit. running
[ 71] [ZE] Fire Nade 1.6 ZE Dev Team ze_fire.amxx running
[ 72] [ZE] Frost Nade 1.6 ZE Dev Team ze_frost.amxx running
[ 73] [ZE] Models & Sounds 1.6 ZE Dev Team ze_resources.am running
[ 74] [ZE] Sound Countdown 1.6 ZE Dev Team ze_countdown.am running
[ 75] [ZE] Zombie Sounds 1.6 ZE Dev Team ze_zombie_sound running
[ 76] [ZE] Items Manager: VI 1.6 ZE Dev Team ze_items_vip.am running
[ 77] [ZE] Multi-Jump 1.1 Raheem ze_multijump.am running
[ 78] [ZE] Tank-Gun Control 1.1 Raheem ze_block_tank_g running
[ 79] Custom Flashlight 0.5.4 ConnorMcLeod ze_CustomFlashL running
[ 80] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 81] Weapon Model + Sound R 1.3 GHW_Chronic GHW_Weapon_Repl running
[ 82] [ZE] Escapes Count 1.1 ZE-DEV-TEAM + sP ze_achievements running
[ 83] Admin Prefixes 4.0 m0skVi4a ;] ze_admin_chat.a running
[ 84] Auto Config 1.0 TGS ze_auto_config. running
[ 85] [ZE] LEVEL SYSTEM 1.8 Remo ze_level_system running
[ 86] [ZE] Zombie Escape VIP 1.3 ZE Dev Team ze_vip_system.a running
[ 87] [ZE] First Round Resta 1.0 EliVvo. ze_first_round_ running
[ 88] [ZE] Manual Unstuck 1.0 Raheem ze_manual_unstu running
[ 89] [ZE] Bad Spawn Fix 1.0 Raheem ze_spawn_auto_u running
[ 90] [ZE] Map-Damage Contro 1.0 Raheem ze_damage_contr running
[ 91] Custom Radio Commands 0.6 KaLoSZyFeR ze_custom_radio running
[ 92] [ZE] Addon: Escape But 1.2 Raheem|z0h1r-LK ze_rescue_butto running
[ 93] [ZE] Addon: Rescue But 1.0 z0h1r-LK ze_rescue_butto running
[ 94] FPS Menu 1.0 TGS TEAM amxx_fps_settin running
[ 95] [ZE] Effects: Tracers 1.0 z0h1r-LK ze_effects_trac running
[ 96] [ZE] AFK KILL 1.0 Remo ze_afk_killer.a running
[ 97] [ZE] Buy G-VIP 1.0 Raheem ze_buy_vip.amxx running
[ 98] [ZE] SupplyBox 1.1 Dias ze_supply_box.a running
[ 99] [ZE] Main Menu 1.6 ZE Dev Team ze_main_menu.am running
[100] administration Menu 1.1 EliVvo. admin_main_menu running
[101] [ZE] Special Models 1.2 Jack GamePlay ze_models.amxx debug
[102] Settings Menu 1.1 EliVvo. ze_settings_men running
[103] Glow Menu v1.2 Remo ze_glow_menu.am running
[104] [ZE] Addon: Knife Menu 1.2 Jack GamePlay ze_knife_menu.a running
[105] Astra 1.0 Jenessee Astra.amxx debug
[106] [ZE] Hats Menu 1.0 EliVvo. ze_hats_menu.am running
[107] [ZE] Addons: Admin szM 1.0 Jack GamePlay ze_make_zm_hm.a running
[108] akcaliberkk 1.0 Revive Menu ze_revmenu.amxx running
[109] [JBE] Addons: Trail 1.2 OverGame & Hellm ze_trail.amxx running
[110] ZE VIP Menu 1.1 EliVvo. ze_vip_main_men running
[111] Sound Menu 1.0 Raheem sound_menu.amxx running
[112] [ZE] Levels Weapons Me 1.1 Raheem ze_weapon_menu. running
[113] Golden M3 1.1 Wisam187 ze_golden_m3.am running
[114] Golden MP5 1.1 Wisam187 : JaCk ze_golden_mp5.a running
[115] Golden M4A1 1.1 JaCk ze_golden_m4a1. running
[116] Golden AK-47 1.1 Wisam187 : JaCk ze_golden_ak47. running
[117] [CSO] M4A1 Dark Knight 1.0 Dias Pendragon ze_m4a1_darkkni running
[118] [ZP] Extra: Ethereal 1.0 Zombie-Panic ze_ethereal.amx running
[119] [CSO] AK47 Paladin 1.0 Dias Pendragon AK47_Paladin.am running
[120] [ZE] Rail Cannon 1.0 m4m3ts ze_extra_railca running
[121] [ZE] Star Chaser AR 1.0 Bim Bim Cay + Le ze_starchasear. running
[122] Weapon: Plasma Gun 1.0 S3xTy ze_plasma_gun.a running
[123] VIP Features 1.3 EliVvo. ze_vip_features running
[124] [ZE] Items: Fire Nade 1.6 ZE Dev Team ze_extra_fire_n running
[125] [ZE] Items: Fire Nade 1.6 ZE Dev Team ze_extra_frost_ running
[126] [ZE] Items: SF Tornado 1.0 Batcon/t3rkecore ze_extra_tornad running
[127] [CSO] Coilgun 1.0 Dias + ZE DEV TE ze_extra_coilgu running
[128] [ZE] Extra: Blaster [S 1.0 Crock / =) (Popr ze_extra_sfgun. running
[129] Cyclone 1.0 m4m3ts ze_extra_cyclon running
[130] unknown unknown unknown ze_extra_scar_b running
[131] [ZE] CSO Laser Minigun 1.1 Asep Khairul Ana ze_extra_laser_ running
[132] [ZE] Extra Item: Ancie v1.0 JANUS-7 Base: xU ze_ancient_keep running
[133] [ZP] Extra Item: Jump 1.0 Opo4uMapy ze_extra_bombju running
[134] [ZE] Extra Item: Blind 1.1 Catastrophe+ZE D ze_blind_bomb.a running
134 plugins, 133 running
hello everyone
so my server is working fine till i put these 2 extra items plugins and server start crashing and there's nothing on sys_error!! I couldn't find the problem.

1-ut3 link gun

CSS:
#include <zombie_escape>
#include <fakemeta_util>
#include <hamsandwich>

#define is_user_valid(%0) (0 < %0 <= 32)
#define CustomItem(%0) (pev(%0, pev_impulse) == WEAPON_SPECIAL_CODE)

#define Get_WeaponState(%0) (get_pdata_int(%0, m_iWeaponState, linux_diff_weapon))
#define Set_WeaponState(%0,%1) (set_pdata_int(%0, m_iWeaponState, %1, linux_diff_weapon))

enum_:eShootStates
{
    STATE_START = 0,
    STATE_LOOP
};

#define PDATA_SAFE 2

#define WEAPON_ANIM_IDLE 0
#define WEAPON_ANIM_SHOOT 3
#define WEAPON_ANIM_RELOAD 1
#define WEAPON_ANIM_DRAW 2
#define WEAPON_ANIM_SEC_START 4
#define WEAPON_ANIM_SEC_LOOP 5
#define WEAPON_ANIM_SEC_END 6

// From model: Frames/FPS
#define WEAPON_ANIM_IDLE_TIME 80/15.0
#define WEAPON_ANIM_SHOOT_TIME 5/15.0
#define WEAPON_ANIM_RELOAD_TIME 1.53
#define WEAPON_ANIM_DRAW_TIME 11/20.0
#define WEAPON_ANIM_SEC_TIME 12/30.0

//#define WEAPON_LIST_ENABLED // Weapon List enabled [ Comment this if u not needed use Weapon List ]
#define WEAPON_MUZZLEFLASH_ENABLED // MuzzleFlash enabled [ Comment this if u not needed use MuzzleFlash ]
#define WEAPON_SPECIAL_CODE 532534
#define WEAPON_REFERENCE "weapon_m249"
#define WEAPON_NEW_NAME "weapon_m249" // Name of Weapon List

#define WEAPON_ITEM_NAME "UT3 Link Gun"
#define WEAPON_ITEM_COST 0

#define WEAPON_MODEL_VIEW "models/zombie_escape/v_linkgun.mdl"
#define WEAPON_MODEL_PLAYER "models/zombie_escape/p_linkgun.mdl"
#define WEAPON_MODEL_WORLD "models/zombie_escape/w_linkgun.mdl"
#define WEAPON_BODY 0

#define WEAPON_SOUND_SHOOT "weapons/linkgun_shoot.wav"

new const WEAPON_SOUND_SEC_SOUNDS[][] =
{
    "weapons/linkgun_lightstart.wav", // 0 - Shoot start
    "weapons/linkgun_lightshoot.wav", // 1 - Shoot loop (shooting)
    "weapons/linkgun_lightend.wav" // 2 - Shoot end
};

#define WEAPON_MAX_CLIP 100 // Max clip
#define WEAPON_DEFAULT_AMMO 200 // Default ammo
#define WEAPON_RATE 0.12 // Shoot speed (prim mode)
#define WEAPON_SEC_RATE 0.09 // Shoot speed (sec mode)
#define WEAPON_SEC_ACCURACY 0.0 // Accuracy (sec mode) 0.0 - 0.9
#define WEAPON_SEC_PUNCHANGLE 0.1 // Recoil (sec mode)
#define WEAPON_SEC_DAMAGE 1.64 // Damage (sec mode)
#define WEAPON_SEC_HIT_SPRITE "sprites/linkgun_bomb.spr" // Hit sprite (all modes)

#define ENTITY_PLASMA_CLASSNAME "ent_linkgun_ball"
#define ENTITY_PLASMA_SPRITE "sprites/linkgun_ball.spr"
#define ENTITY_PLASMA_SOUND "weapons/linkgun_shothit.wav"
#define ENTITY_PLASMA_SPEED 1500.0
#define ENTITY_PLASMA_DAMAGE random_float(10.0, 40.0)
#define ENTITY_PLASMA_RADIUS 60.0
#define ENTITY_PLASMA_DMGTYPE DMG_NEVERGIB|DMG_CLUB // Damage type of Entity

#define ENTITY_MUZZLE_CLASSNAME "ent_linkgun_mf"
#define ENTITY_MUZZLE_SPRITE "sprites/linkgun_light.spr"
#define ENTITY_MUZZLE_INTOLERANCE 100

#if defined WEAPON_LIST_ENABLED
    new const iWeaponList[] =
    {
        3, 200,-1, -1, 0, 4, 20, 0 // weapon_m249
    };
#endif

// Linux extra offsets
#define linux_diff_weapon 4
#define linux_diff_player 5

// CWeaponBox
#define m_rgpPlayerItems_CWeaponBox 34

// CSprite
#define m_maxFrame 35

// CBaseAnimating
#define m_flLastEventCheck 38

// CBasePlayerItem
#define m_pPlayer 41
#define m_pNext 42
#define m_iId 43

//CBasePlayerWeapon
#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_flAccuracy 62
#define m_iWeaponState 74
#define m_flNextReload 75

//CBaseMonster
#define m_LastHitGroup 75
#define m_flNextAttack 83

//CBasePlayer
#define m_rpgPlayerItems 367
#define m_pActiveItem 373
#define m_rgAmmo 376

new g_iszAllocString_Entity,
    g_iszAllocString_ModelView,
    g_iszAllocString_ModelPlayer,

    g_iszAllocString_InfoTarget,
    g_iszAllocString_PlasmaClass,

    HamHook: g_HamHook_TraceAttack[4],

    g_iszModelIndex_Laserbeam,
    g_iszModelIndex_Lightning,
    g_iszModelIndex_Explosion

#if defined WEAPON_LIST_ENABLED
    new g_iMsgID_Weaponlist;
#endif

#if defined WEAPON_MUZZLEFLASH_ENABLED
    #define CustomMuzzle(%0) (pev(%0, pev_impulse) == g_iszAllocString_MuzzleFlash)
    new g_iszAllocString_MuzzleFlash;
#endif

public plugin_init()
{
    register_plugin("[ZE] UT3 Link Gun", "1.0", "xUnicorn (t3rkecorejz) / Batcoh: Code base");

    register_forward(FM_UpdateClientData, "FM_Hook_UpdateClientData_Post", true);
    register_forward(FM_SetModel, "FM_Hook_SetModel_Pre", false);

    RegisterHam(Ham_Item_Holster, WEAPON_REFERENCE, "CWeapon__Holster_Post", true);
    RegisterHam(Ham_Item_Deploy, WEAPON_REFERENCE, "CWeapon__Deploy_Post", true);
    RegisterHam(Ham_Item_PostFrame, WEAPON_REFERENCE, "CWeapon__PostFrame_Pre", false);
    #if defined WEAPON_LIST_ENABLED
        RegisterHam(Ham_Item_AddToPlayer, WEAPON_REFERENCE, "CWeapon__AddToPlayer_Post", true);
        g_iMsgID_Weaponlist = get_user_msgid("WeaponList");
    #endif
    RegisterHam(Ham_Weapon_Reload, WEAPON_REFERENCE, "CWeapon__Reload_Pre", false);
    RegisterHam(Ham_Weapon_WeaponIdle, WEAPON_REFERENCE, "CWeapon__WeaponIdle_Pre", false);
    RegisterHam(Ham_Weapon_PrimaryAttack, WEAPON_REFERENCE, "CWeapon__PrimaryAttack_Pre", false);
    RegisterHam(Ham_Weapon_SecondaryAttack, WEAPON_REFERENCE, "CWeapon__SecondaryAttack_Pre", false);
   
    g_HamHook_TraceAttack[0] = RegisterHam(Ham_TraceAttack, "func_breakable", "CEntity__TraceAttack_Pre", false);
    g_HamHook_TraceAttack[1] = RegisterHam(Ham_TraceAttack, "info_target", "CEntity__TraceAttack_Pre", false);
    g_HamHook_TraceAttack[2] = RegisterHam(Ham_TraceAttack, "player", "CEntity__TraceAttack_Pre", false);
    g_HamHook_TraceAttack[3] = RegisterHam(Ham_TraceAttack, "hostage_entity", "CEntity__TraceAttack_Pre", false);

    RegisterHam(Ham_Touch, "info_target", "CEntity__Touch_Pre", false);
    #if defined WEAPON_MUZZLEFLASH_ENABLED
        RegisterHam(Ham_Think, "env_sprite", "CMuzzleFlash__Think_Pre", false);
    #endif
   
    fm_ham_hook(false);
}

public plugin_precache()
{
    // Hook weapon
    register_clcmd(WEAPON_NEW_NAME, "Command_HookWeapon");

    // Precache models
    engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_VIEW);
    engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_PLAYER);
    engfunc(EngFunc_PrecacheModel, WEAPON_MODEL_WORLD);
    engfunc(EngFunc_PrecacheModel, ENTITY_PLASMA_SPRITE);

    #if defined WEAPON_LIST_ENABLED
        // Precache generic
        UTIL_PrecacheSpritesFromTxt(WEAPON_NEW_NAME);
    #endif

    // Precache sounds
    engfunc(EngFunc_PrecacheSound, WEAPON_SOUND_SHOOT);
    engfunc(EngFunc_PrecacheSound, ENTITY_PLASMA_SOUND);
    engfunc(EngFunc_PrecacheSound, "common/null.wav");

    for(new i = 0; i < sizeof WEAPON_SOUND_SEC_SOUNDS; i++)
        engfunc(EngFunc_PrecacheSound, WEAPON_SOUND_SEC_SOUNDS[i]);

    UTIL_PrecacheSoundsFromModel(WEAPON_MODEL_VIEW);

    #if defined WEAPON_MUZZLEFLASH_ENABLED
        // Muzzle Flash
        engfunc(EngFunc_PrecacheModel, ENTITY_MUZZLE_SPRITE);

        g_iszAllocString_MuzzleFlash = engfunc(EngFunc_AllocString, ENTITY_MUZZLE_CLASSNAME);
    #endif

    //Other
    g_iszAllocString_Entity = engfunc(EngFunc_AllocString, WEAPON_REFERENCE);
    g_iszAllocString_ModelView = engfunc(EngFunc_AllocString, WEAPON_MODEL_VIEW);
    g_iszAllocString_ModelPlayer = engfunc(EngFunc_AllocString, WEAPON_MODEL_PLAYER);

    g_iszAllocString_InfoTarget = engfunc(EngFunc_AllocString, "info_target");
    g_iszAllocString_PlasmaClass = engfunc(EngFunc_AllocString, ENTITY_PLASMA_CLASSNAME);

    // Model Index
    g_iszModelIndex_Laserbeam = engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr");
    g_iszModelIndex_Lightning = engfunc(EngFunc_PrecacheModel, "sprites/lgtning.spr");
    g_iszModelIndex_Explosion = engfunc(EngFunc_PrecacheModel, WEAPON_SEC_HIT_SPRITE);
}


public Command_HookWeapon(iPlayer)
{
    engclient_cmd(iPlayer, WEAPON_REFERENCE);
    return PLUGIN_HANDLED;
}

public plugin_natives()
{
    register_native("give_ut3", "native_give_ut3", 1)
}

public native_give_ut3(iPlayer)
{
    static iEntity; iEntity = engfunc(EngFunc_CreateNamedEntity, g_iszAllocString_Entity);
    if(iEntity <= 0) return 0;

    set_pev(iEntity, pev_impulse, WEAPON_SPECIAL_CODE);
    ExecuteHam(Ham_Spawn, iEntity);
    UTIL_DropWeapon(iPlayer, 1);

    if(!ExecuteHamB(Ham_AddPlayerItem, iPlayer, iEntity))
    {
        set_pev(iEntity, pev_flags, pev(iEntity, pev_flags) | FL_KILLME);
        return 0;
    }

    ExecuteHamB(Ham_Item_AttachToPlayer, iEntity, iPlayer);
    set_pdata_int(iEntity, m_iClip, WEAPON_MAX_CLIP, linux_diff_weapon);

    new iAmmoType = m_rgAmmo + get_pdata_int(iEntity, m_iPrimaryAmmoType, linux_diff_weapon);
    if(get_pdata_int(iPlayer, m_rgAmmo, linux_diff_player) < WEAPON_DEFAULT_AMMO)
        set_pdata_int(iPlayer, iAmmoType, WEAPON_DEFAULT_AMMO, linux_diff_player);

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

// [ Fakemeta ]
public FM_Hook_UpdateClientData_Post(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) != PDATA_SAFE || !CustomItem(iItem)) return;

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

public FM_Hook_SetModel_Pre(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 && CustomItem(iItem))
        {
            engfunc(EngFunc_SetModel, iEntity, WEAPON_MODEL_WORLD);
            set_pev(iEntity, pev_body, WEAPON_BODY);
           
            return FMRES_SUPERCEDE;
        }
    }

    return FMRES_IGNORED;
}

public FM_Hook_PlaybackEvent_Pre() return FMRES_SUPERCEDE;

public FM_Hook_TraceLine_Post(Float: flOrigin1[3], Float: flOrigin2[3], iFrag, iAttacker, iTrace)
{
    if(iFrag & IGNORE_MONSTERS) return FMRES_IGNORED;

    static pHit; pHit = get_tr2(iTrace, TR_pHit);
    static Float: flvecEndPos[3]; get_tr2(iTrace, TR_vecEndPos, flvecEndPos);

    if(is_user_valid(pHit))
    {
        engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, flvecEndPos, 0);
        write_byte(TE_EXPLOSION);
        engfunc(EngFunc_WriteCoord, flvecEndPos[0]);
        engfunc(EngFunc_WriteCoord, flvecEndPos[1]);
        engfunc(EngFunc_WriteCoord, flvecEndPos[2] - 10.0);
        write_short(g_iszModelIndex_Explosion);
        write_byte(2); // Scale
        write_byte(60); // Framerate
        write_byte(TE_EXPLFLAG_NODLIGHTS|TE_EXPLFLAG_NOSOUND|TE_EXPLFLAG_NOPARTICLES); // Flags
        message_end();
    }
   
    return FMRES_IGNORED;
}

// [ HamSandwich ]
public CWeapon__Holster_Post(iItem)
{
    if(!CustomItem(iItem)) return;
    static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

    emit_sound(iPlayer, CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
   
    set_pdata_float(iItem, m_flNextPrimaryAttack, 0.0, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextSecondaryAttack, 0.0, linux_diff_weapon);
    set_pdata_float(iItem, m_flTimeWeaponIdle, 0.0, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextReload, 0.0, linux_diff_weapon);
    set_pdata_float(iPlayer, m_flNextAttack, 0.0, linux_diff_player);
}

public CWeapon__Deploy_Post(iItem)
{
    if(!CustomItem(iItem)) return;
   
    static iPlayer; iPlayer = get_pdata_cbase(iItem, m_pPlayer, linux_diff_weapon);

    set_pev_string(iPlayer, pev_viewmodel2, g_iszAllocString_ModelView);
    set_pev_string(iPlayer, pev_weaponmodel2, g_iszAllocString_ModelPlayer);

    UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_DRAW);

    Set_WeaponState(iItem, STATE_START);
    set_pdata_float(iPlayer, m_flNextAttack, WEAPON_ANIM_DRAW_TIME, linux_diff_player);
    set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_DRAW_TIME, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextReload, 0.0, linux_diff_weapon);
}

public CWeapon__PostFrame_Pre(iItem)
{
    if(!CustomItem(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);
    static iButton; iButton = pev(iPlayer, pev_button);

    // reload
    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(WEAPON_MAX_CLIP - 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);

        UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_DRAW);

        set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_ANIM_DRAW_TIME, linux_diff_weapon);
        set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_ANIM_DRAW_TIME, linux_diff_weapon);
        set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_DRAW_TIME, linux_diff_weapon);
        set_pdata_float(iPlayer, m_flNextAttack, WEAPON_ANIM_DRAW_TIME, linux_diff_player);
    }

    // reset secondary attack
    if(Get_WeaponState(iItem) == STATE_LOOP)
    {
        if(!iClip || !(iButton & IN_ATTACK2))
        {
            Set_WeaponState(iItem, STATE_START);

            UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_SEC_END);
            emit_sound(iPlayer, CHAN_WEAPON, WEAPON_SOUND_SEC_SOUNDS[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

            set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_ANIM_SEC_TIME, linux_diff_weapon);
            set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_ANIM_SEC_TIME, linux_diff_weapon);
            set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_SEC_TIME, linux_diff_weapon);
        }
    }

    // secondary attack
    if(iButton & IN_ATTACK2 && get_pdata_float(iItem, m_flNextSecondaryAttack, linux_diff_weapon) < 0.0)
    {
        ExecuteHamB(Ham_Weapon_SecondaryAttack, iItem);

        iButton &= ~IN_ATTACK2;
        set_pev(iPlayer, pev_button, iButton);
    }

    return HAM_IGNORED;
}

#if defined WEAPON_LIST_ENABLED
    public CWeapon__AddToPlayer_Post(iItem, iPlayer)
    {
        switch(pev(iItem, pev_impulse))
        {
            case WEAPON_SPECIAL_CODE: UTIL_WeaponList(iPlayer, true);
            case 0: UTIL_WeaponList(iPlayer, false);
        }
    }
#endif

public CWeapon__Reload_Pre(iItem)
{
    if(!CustomItem(iItem)) return HAM_IGNORED;

    static iClip; iClip = get_pdata_int(iItem, m_iClip, linux_diff_weapon);
    if(iClip >= WEAPON_MAX_CLIP) 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, WEAPON_ANIM_RELOAD);

    set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_ANIM_RELOAD_TIME, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_ANIM_RELOAD_TIME, linux_diff_weapon);
    set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_RELOAD_TIME, linux_diff_weapon);
    set_pdata_float(iPlayer, m_flNextAttack, WEAPON_ANIM_RELOAD_TIME, linux_diff_player);

    return HAM_SUPERCEDE;
}

public CWeapon__WeaponIdle_Pre(iItem)
{
    if(!CustomItem(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, WEAPON_ANIM_IDLE);
    set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_IDLE_TIME, linux_diff_weapon);

    return HAM_SUPERCEDE;
}

public CWeapon__PrimaryAttack_Pre(iItem)
{
    if(!CustomItem(iItem)) return HAM_IGNORED;

    static iClip; iClip = get_pdata_int(iItem, m_iClip, linux_diff_weapon);
    if(iClip == 0)
    {
        ExecuteHam(Ham_Weapon_PlayEmptySound, iItem);
        set_pdata_float(iItem, m_flNextPrimaryAttack, 0.2, linux_diff_weapon);

        return HAM_SUPERCEDE;
    }

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

    new Float: flPunchangle[3];
    flPunchangle[0] = random_float(-1.5, -1.0);
    flPunchangle[1] = 0.0;
    flPunchangle[2] = 0.0;
    set_pev(iPlayer, pev_punchangle, flPunchangle);

    Create_PlasmaBall(iPlayer);
    UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_SHOOT);
    emit_sound(iPlayer, CHAN_WEAPON, WEAPON_SOUND_SHOOT, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

    #if defined WEAPON_MUZZLEFLASH_ENABLED
        Weapon_MuzzleFlash(iPlayer, ENTITY_MUZZLE_SPRITE, 0.15, 200.0, 1, 0.19);
    #endif

    set_pdata_int(iItem, m_iClip, iClip - 1, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_RATE, linux_diff_weapon);
    set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_RATE, linux_diff_weapon);
    set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_SHOOT_TIME, linux_diff_weapon);

    return HAM_SUPERCEDE;
}

public CWeapon__SecondaryAttack_Pre(iItem)
{
    if(!CustomItem(iItem)) return HAM_IGNORED;

    static iClip; iClip = get_pdata_int(iItem, m_iClip, linux_diff_weapon);
    if(iClip == 0)
    {
        ExecuteHam(Ham_Weapon_PlayEmptySound, iItem);
        set_pdata_float(iItem, m_flNextSecondaryAttack, 0.2, linux_diff_weapon);

        return HAM_SUPERCEDE;
    }

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

    switch(Get_WeaponState(iItem))
    {
        case STATE_START:
        {
            Set_WeaponState(iItem, STATE_LOOP);

            UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_SEC_START);
            emit_sound(iPlayer, CHAN_WEAPON, WEAPON_SOUND_SEC_SOUNDS[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

            set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_ANIM_SEC_TIME - 0.1, linux_diff_weapon);
            set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_ANIM_SEC_TIME - 0.1, linux_diff_weapon);
            set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_SEC_TIME - 0.1, linux_diff_weapon);
        }
        case STATE_LOOP:
        {
            set_pdata_float(iItem, m_flAccuracy, WEAPON_SEC_ACCURACY, linux_diff_weapon);

            static fw_TraceLine; fw_TraceLine = register_forward(FM_TraceLine, "FM_Hook_TraceLine_Post", true);
            static fw_PlayBackEvent; fw_PlayBackEvent = register_forward(FM_PlaybackEvent, "FM_Hook_PlaybackEvent_Pre", 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);

            static Float:vecPunchangle[3];
            pev(iPlayer, pev_punchangle, vecPunchangle);
            vecPunchangle[0] *= WEAPON_SEC_PUNCHANGLE;
            vecPunchangle[1] *= WEAPON_SEC_PUNCHANGLE;
            vecPunchangle[2] *= WEAPON_SEC_PUNCHANGLE;
            set_pev(iPlayer, pev_punchangle, vecPunchangle);

            static Float: flNextAnim; pev(iItem, pev_fuser4, flNextAnim);
            static Float: flGameTime; flGameTime = get_gametime();

            if(flNextAnim <= flGameTime)
            {
                UTIL_SendWeaponAnim(iPlayer, WEAPON_ANIM_SEC_LOOP);
                set_pev(iItem, pev_fuser4, flGameTime + 7/30.0);
            }

            if(get_pdata_float(iItem, m_flNextReload, linux_diff_weapon) <= flGameTime)
            {
                emit_sound(iPlayer, CHAN_WEAPON, WEAPON_SOUND_SEC_SOUNDS[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
                set_pdata_float(iItem, m_flNextReload, flGameTime + 1.0, linux_diff_weapon);
            }

            #if defined WEAPON_MUZZLEFLASH_ENABLED
                Weapon_MuzzleFlash(iPlayer, ENTITY_MUZZLE_SPRITE, 0.15, 255.0, 1, 0.25);
            #endif

            set_pdata_float(iItem, m_flNextPrimaryAttack, WEAPON_SEC_RATE, linux_diff_weapon);
            set_pdata_float(iItem, m_flNextSecondaryAttack, WEAPON_SEC_RATE, linux_diff_weapon);
            set_pdata_float(iItem, m_flTimeWeaponIdle, WEAPON_ANIM_SEC_TIME, linux_diff_weapon);

            static Float: vecEndPos[3]; fm_get_aim_origin(iPlayer, vecEndPos);

            // index, attachment, endpos, modelindex, width, red, green, blue
            UTIL_CreateBeamEntPoint(iPlayer, 0x1000, vecEndPos, g_iszModelIndex_Lightning, 4, 255, 255, 255);
            UTIL_CreateBeamEntPoint(iPlayer, 0x1000, vecEndPos, g_iszModelIndex_Lightning, 8, 0, 127, 255);
            UTIL_CreateBeamEntPoint(iPlayer, 0x1000, vecEndPos, g_iszModelIndex_Lightning, 12, 255, 255, 255);
            UTIL_CreateBeamEntPoint(iPlayer, 0x1000, vecEndPos, g_iszModelIndex_Lightning, 20, 0, 127, 255);
        }
    }

    return HAM_SUPERCEDE;
}

public CEntity__TraceAttack_Pre(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 || !CustomItem(iItem)) return;

    SetHamParamFloat(3, flDamage * WEAPON_SEC_DAMAGE);
}

public CEntity__Touch_Pre(iEntity, iVictim)
{
    if(pev_valid(iEntity) != PDATA_SAFE) return HAM_IGNORED;
    if(pev(iEntity, pev_classname) == g_iszAllocString_PlasmaClass)
    {
        new iOwner = pev(iEntity, pev_owner);
        new Float: vecOrigin[3]; pev(iEntity, pev_origin, vecOrigin);

        if(engfunc(EngFunc_PointContents, vecOrigin) == CONTENTS_SKY)
        {
            set_pev(iEntity, pev_flags, FL_KILLME);
            return HAM_IGNORED;
        }

        if(iVictim == iOwner) return HAM_SUPERCEDE;

        engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecOrigin, 0);
        write_byte(TE_EXPLOSION);
        engfunc(EngFunc_WriteCoord, vecOrigin[0]);
        engfunc(EngFunc_WriteCoord, vecOrigin[1]);
        engfunc(EngFunc_WriteCoord, vecOrigin[2] - 10.0);
        write_short(g_iszModelIndex_Explosion);
        write_byte(5); // Scale
        write_byte(36); // Framerate
        write_byte(TE_EXPLFLAG_NODLIGHTS|TE_EXPLFLAG_NOSOUND|TE_EXPLFLAG_NOPARTICLES); // Flags
        message_end();

        iVictim = FM_NULLENT;

        while((iVictim = engfunc(EngFunc_FindEntityInSphere, iVictim, vecOrigin, ENTITY_PLASMA_RADIUS)) > 0)
        {
            if(pev_valid(iVictim) != PDATA_SAFE) continue;

            if(pev(iVictim, pev_takedamage) == DAMAGE_NO)
                continue;

            if(is_user_alive(iVictim))
            {
                if(iVictim == iOwner || !ze_is_user_zombie(iVictim) || !is_wall_between_points(iOwner, iVictim))
                    continue;
            }
            else if(pev(iVictim, pev_solid) == SOLID_BSP)
            {
                if(pev(iVictim, pev_spawnflags) & SF_BREAK_TRIGGER_ONLY)
                    continue;
            }

            set_pdata_int(iVictim, m_LastHitGroup, HIT_GENERIC, linux_diff_player);
            ExecuteHamB(Ham_TakeDamage, iVictim, iOwner, iOwner, ENTITY_PLASMA_DAMAGE, ENTITY_PLASMA_DMGTYPE);
        }

        emit_sound(iEntity, CHAN_ITEM, ENTITY_PLASMA_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
        set_pev(iEntity, pev_flags, FL_KILLME);
    }

    return HAM_IGNORED;
}

#if defined WEAPON_MUZZLEFLASH_ENABLED
    public CMuzzleFlash__Think_Pre(iSprite)
    {
        static Float: flFrame;
       
        if(pev_valid(iSprite) != PDATA_SAFE || !CustomMuzzle(iSprite)) return HAM_IGNORED;

        static Float: flNextThink; pev(iSprite, pev_fuser3, flNextThink);
        if(pev(iSprite, pev_frame, flFrame) && ++flFrame - 1.0 < get_pdata_float(iSprite, m_maxFrame, linux_diff_weapon))
        {
            set_pev(iSprite, pev_frame, flFrame);
            set_pev(iSprite, pev_nextthink, get_gametime() + flNextThink);
           
            return HAM_SUPERCEDE;
        }

        set_pev(iSprite, pev_flags, FL_KILLME);
        return HAM_SUPERCEDE;
    }
#endif

// [ Other ]
public Create_PlasmaBall(iOwner)
{
    new iEntity = engfunc(EngFunc_CreateNamedEntity, g_iszAllocString_InfoTarget);
    if(!pev_valid(iEntity)) return 0;

    new Float: vecOrigin[3]; pev(iOwner, pev_origin, vecOrigin);
    new Float: vecAngles[3]; pev(iOwner, pev_v_angle, vecAngles);
    new Float: vecVelocity[3]; angle_vector(vecAngles, ANGLEVECTOR_FORWARD, vecVelocity);
    new Float: vecViewOfs[3]; pev(iOwner, pev_view_ofs, vecViewOfs);

    vecOrigin[0] += vecViewOfs[0] + vecVelocity[0] * 20.0;
    vecOrigin[1] += vecViewOfs[1] + vecVelocity[1] * 20.0;
    vecOrigin[2] += vecViewOfs[2] + vecVelocity[2] * 20.0;

    vecVelocity[0] *= ENTITY_PLASMA_SPEED;
    vecVelocity[1] *= ENTITY_PLASMA_SPEED;
    vecVelocity[2] *= ENTITY_PLASMA_SPEED;

    set_pev_string(iEntity, pev_classname, g_iszAllocString_PlasmaClass);
    set_pev(iEntity, pev_solid, SOLID_TRIGGER);
    set_pev(iEntity, pev_movetype, MOVETYPE_FLY);
    set_pev(iEntity, pev_owner, iOwner);

    set_pev(iEntity, pev_velocity, vecVelocity);

    set_pev(iEntity, pev_rendermode, kRenderTransAdd);
    set_pev(iEntity, pev_renderamt, 200.0);
    set_pev(iEntity, pev_renderfx, kRenderFxNone);

    set_pev(iEntity, pev_scale, 0.1);

    engfunc(EngFunc_SetModel, iEntity, ENTITY_PLASMA_SPRITE);
    engfunc(EngFunc_SetSize, iEntity, Float: { -1.0, -1.0, -1.0 }, Float: { 1.0, 1.0, 1.0 });
    engfunc(EngFunc_SetOrigin, iEntity, vecOrigin);

    message_begin(MSG_PVS, SVC_TEMPENTITY);
    write_byte(TE_BEAMFOLLOW);
    write_short(iEntity);
    write_short(g_iszModelIndex_Laserbeam);
    write_byte(1); // Life
    write_byte(3); // Width
    write_byte(0); // Red
    write_byte(255); // Green
    write_byte(255); // Blue
    write_byte(200); // Alpha
    message_end();

    return iEntity;
}

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

// [ Stocks ]
stock is_wall_between_points(iPlayer, iEntity)
{
    // vector
    #define Vector_Equal(%0,%1) ((%1[0] == %0[0]) && (%1[1] == %0[1]) && (%1[2] == % 0[2]))

    if(!is_user_alive(iEntity))
        return 0;

    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 Vector_Equal(flEnd, flEndPos);
}

#if defined WEAPON_MUZZLEFLASH_ENABLED
    stock Sprite_SetTransparency(iSprite, iRendermode, Float: flAmt, iFx = kRenderFxNone)
    {
        set_pev(iSprite, pev_rendermode, iRendermode);
        set_pev(iSprite, pev_renderamt, flAmt);
        set_pev(iSprite, pev_renderfx, iFx);
    }

    stock Weapon_MuzzleFlash(iPlayer, szMuzzleSprite[], Float: flScale, Float: flBrightness, iAttachment, Float: flNextThink)
    {
        if(global_get(glb_maxEntities) - engfunc(EngFunc_NumberOfEntities) < ENTITY_MUZZLE_INTOLERANCE) return FM_NULLENT;
       
        static iSprite, iszAllocStringCached;
        if(iszAllocStringCached || (iszAllocStringCached = engfunc(EngFunc_AllocString, "env_sprite")))
            iSprite = engfunc(EngFunc_CreateNamedEntity, iszAllocStringCached);
       
        if(pev_valid(iSprite) != PDATA_SAFE) return FM_NULLENT;
       
        set_pev(iSprite, pev_model, szMuzzleSprite);
        set_pev(iSprite, pev_spawnflags, SF_SPRITE_ONCE);
       
        set_pev(iSprite, pev_classname, ENTITY_MUZZLE_CLASSNAME);
        set_pev(iSprite, pev_impulse, g_iszAllocString_MuzzleFlash);
        set_pev(iSprite, pev_owner, iPlayer);
        set_pev(iSprite, pev_fuser3, flNextThink);
       
        set_pev(iSprite, pev_aiment, iPlayer);
        set_pev(iSprite, pev_body, iAttachment);
       
        Sprite_SetTransparency(iSprite, kRenderTransAdd, flBrightness);
        set_pev(iSprite, pev_scale, flScale);
       
        dllfunc(DLLFunc_Spawn, iSprite)

        return iSprite;
    }
#endif

stock UTIL_SendWeaponAnim(iPlayer, iAnim)
{
    set_pev(iPlayer, pev_weaponanim, iAnim);

    message_begin(MSG_ONE, SVC_WEAPONANIM, _, iPlayer);
    write_byte(iAnim);
    write_byte(0);
    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_CreateBeamEntPoint(iPlayer, iAttachment, Float: flOrigin[3], iszModelIndex, iWidth, iRed, iGreen, iBlue)
{
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
    write_byte(TE_BEAMENTPOINT);
    write_short(iPlayer | iAttachment);
    engfunc(EngFunc_WriteCoord, flOrigin[0]);
    engfunc(EngFunc_WriteCoord, flOrigin[1]);
    engfunc(EngFunc_WriteCoord, flOrigin[2]);
    write_short(iszModelIndex) // Model index
    write_byte(0); // Framestart
    write_byte(0); // Framerate
    write_byte(1); // Life
    write_byte(iWidth * 4); // Width
    write_byte(5); // Noise
    write_byte(iRed); // Red
    write_byte(iGreen); // Green
    write_byte(iBlue); // Blue
    write_byte(255); // Alpha
    write_byte(100); // Speed
    message_end();
}

stock UTIL_PrecacheSoundsFromModel(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);
}

#if defined WEAPON_LIST_ENABLED
    stock UTIL_PrecacheSpritesFromTxt(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, g_iMsgID_Weaponlist, _, iPlayer);
        write_string(bEnabled ? WEAPON_NEW_NAME : WEAPON_REFERENCE);
        write_byte(iWeaponList[0]);
        write_byte(bEnabled ? WEAPON_DEFAULT_AMMO : 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();
    }
#endif
2- Frost M4A1

CSS:
#include <zombie_escape>
#include <cstrike>
#include <engine>

native remove_golden_m4a1(id)

new const V_M4A1_MODEL[] = "models/zombie_escape/v_frost_m4a1.mdl"
new const P_M4A1_MODEL[] = "models/zombie_escape/p_frost_m4a1.mdl"
new const W_OLD_M4A1_MODEL[] = "models/w_m4a1.mdl"

new g_iSpriteLaser, g_iFreezeDmg
new bool:g_bHasFrostM4A1[33]
new g_iDmg[33], g_MsgSync

new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

public plugin_init()
{
    register_plugin("[ZE] Frost M4A1", "1.0", "Raheem")
 
    // Cvars
    g_iFreezeDmg = register_cvar("ze_freezing_m4a1_damage", "2000") // Damage Requried So Zombie got Frozen
 
    // Events
    register_event("WeapPickup", "CheckModel", "b", "1=19")
    register_event("CurrentWeapon", "CurrentWeapon", "be", "1=1")
 
    // Forwards
    register_forward(FM_SetModel, "Fw_SetModel")
 
    // HookChains
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)

    RegisterHam(Ham_TraceAttack, "player", "Fw_TraceAttack_Post")
    RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_breakable", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_wall", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_door", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_door_rotating", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_plat", "Fw_TraceAttack_Post", 1)
    RegisterHam(Ham_TraceAttack, "func_rotating", "Fw_TraceAttack_Post", 1)

    RegisterHam(Ham_Item_AddToPlayer, "weapon_m4a1", "Fw_AddFrostM4A1ToPlayer")

    g_MsgSync = CreateHudSyncObj()
}

public plugin_precache()
{
    // Models
    precache_model(V_M4A1_MODEL)
    precache_model(P_M4A1_MODEL)
 
    // Sprites
    g_iSpriteLaser = precache_model( "sprites/laserbeam.spr")
}

public client_disconnected(id)
{
    g_bHasFrostM4A1[id] = false
}

public plugin_natives()
{
    register_native("give_frost_m4a1", "native_give_frost_m4a1", 1)
    register_native("remove_frost_m4a1", "native_remove_frost_m4a1", 1)
}

public native_remove_frost_m4a1(id)
{
    g_bHasFrostM4A1[id] = false
}
public native_give_frost_m4a1(id)
{
    remove_golden_m4a1(id)
    g_bHasFrostM4A1[id] = true
    rg_remove_item(id, "weapon_m4a1")
    rg_give_item(id, "weapon_m4a1", GT_APPEND)
    rg_set_user_bpammo(id, WeaponIdType:get_weaponid("weapon_m4a1"), 90)
}

public Fw_TraceAttack_Post(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
    if(!is_user_alive(iAttacker) && ze_is_user_zombie(iEnt))
        return
 
    if(get_user_weapon(iAttacker) != CSW_M4A1 || !g_bHasFrostM4A1[iAttacker])
        return
   
    set_hudmessage(0, 120, 255, -1.0, 0.17, 0, 6.0, 1.1, 0.0, 0.0, -1)
    ShowSyncHudMsg(iAttacker, g_MsgSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))

    if(!g_bHasFrostM4A1[iAttacker])
        return

    static Float:end[3]
    get_tr2(ptr, TR_vecEndPos, end)
   
    if(iEnt)
    {
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_DECAL)
        engfunc(EngFunc_WriteCoord, end[0])
        engfunc(EngFunc_WriteCoord, end[1])
        engfunc(EngFunc_WriteCoord, end[2])
        write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
        write_short(iEnt)
        message_end()
    }
    else
    {
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_WORLDDECAL)
        engfunc(EngFunc_WriteCoord, end[0])
        engfunc(EngFunc_WriteCoord, end[1])
        engfunc(EngFunc_WriteCoord, end[2])
        write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
        message_end()
    }

    message_begin(MSG_BROADCAST, SVC_TEMPENTITY )
    write_byte(TE_BEAMENTPOINT)
    write_short(iAttacker | 0x1000)
    engfunc(EngFunc_WriteCoord, end[0])
    engfunc(EngFunc_WriteCoord, end[1])
    engfunc(EngFunc_WriteCoord, end[2])
    write_short(g_iSpriteLaser)
    write_byte(1) // framerate
    write_byte(5) // framerate
    write_byte(2) // life
    write_byte(10) // width
    write_byte(0)// noise
    write_byte(0)
    write_byte(120)
    write_byte(255)
    write_byte(255) // brightness
    write_byte(150) // speed
    message_end()
}

public ze_user_infected(infected)
{
    if (g_bHasFrostM4A1[infected])
    {
        g_bHasFrostM4A1[infected] = false
    }
}

public ze_user_humanized(id)
{
    g_bHasFrostM4A1[id] = false
    g_iDmg[id] = 0
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
    if (!ze_is_user_zombie(iVictim) || !is_user_connected(iAttacker))
        return HC_CONTINUE
 
    if (g_bHasFrostM4A1[iAttacker] && (get_user_weapon(iAttacker) == CSW_M4A1))
    {
        SetHookChainArg(4 , ATYPE_FLOAT, fDamage * 2)
    }
 
    if((get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
    {
        g_iDmg[iAttacker] += (floatround(fDamage) * 2)
    }
 
    if((g_iDmg[iAttacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
    {
        ze_set_frost_grenade(iVictim, true)
        g_iDmg[iAttacker] = 0
    }
    return HC_CONTINUE
}

public CheckModel(id)
{
    if (is_user_alive(id))
    {
        set_pev(id, pev_viewmodel2, V_M4A1_MODEL)
        set_pev(id, pev_weaponmodel2, P_M4A1_MODEL)
    }
    return PLUGIN_CONTINUE
}

public CurrentWeapon(id)
{
    if ((get_user_weapon(id) == CSW_M4A1) && g_bHasFrostM4A1[id] == true)
    {
        CheckModel(id)
    }
    return PLUGIN_CONTINUE
}

public Fw_SetModel(entity, model[])
{
 
    if(!is_valid_ent(entity))
        return FMRES_IGNORED

    if(!equali(model, W_OLD_M4A1_MODEL))
        return FMRES_IGNORED

    new className[33]
    entity_get_string(entity, EV_SZ_classname, className, 32)

    static iOwner, iStoredM4A1ID

    // Frost M4A1 Owner
    iOwner = entity_get_edict(entity, EV_ENT_owner)

    // Get drop weapon index (Frost M4A1) to use in fw_FrostM4A1AddToPlayer forward
    iStoredM4A1ID = find_ent_by_owner(-1, "weapon_m4a1", entity)

    // If Player Has Frost M4A1 and It's weapon_m4a1
    if(g_bHasFrostM4A1[iOwner] && is_valid_ent(iStoredM4A1ID))
    {
        // Setting weapon options
        entity_set_int(iStoredM4A1ID, EV_INT_impulse, 1997)

        // Rest Var
        g_bHasFrostM4A1[iOwner] = false
     
        return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}

public Fw_AddFrostM4A1ToPlayer(FrostM4A1, id)
{
    // Make sure that this is M4A1
    if(is_valid_ent(FrostM4A1) && is_user_connected(id) && entity_get_int(FrostM4A1, EV_INT_impulse) == 1997)
    {
        // Update Var
        g_bHasFrostM4A1[id] = true

        // Reset weapon options
        entity_set_int(FrostM4A1, EV_INT_impulse, 0)
        return HAM_HANDLED
    }
    return HAM_IGNORED
}
 
Последнее редактирование:
Сообщения
403
Реакции
114
Помог
2 раз(а)
Для начала нужно установить отладчик gdb
 

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

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