hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 18:47



Jelenlévő felhasználók

Jelenleg 214 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 213 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: GoodMan az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: vip1.9.1 extra items hiba
HozzászólásElküldve: 2017.06.01. 15:47 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.14. 08:21
Hozzászólások: 547
Megköszönt másnak: 95 alkalommal
Megköszönték neki: 71 alkalommal
üdv.
  1. Load fails: Plugin uses an unknown function (name "zv_register_extra_item") - check your modules.ini.


esetleg aki ért is hozzá el magyarázná h mi a hiba.

  1. /*================================================================================
  2.  
  3.     [ZP] Extra Item: Advanced Antidote Gun
  4.     Copyright (C) 2010 by meTaLiCroSS, Vińa del Mar, Chile
  5.    
  6.     This program is free software: you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation, either version 3 of the License, or
  9.     (at your option) any later version.
  10.    
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.    
  19.     In addition, as a special exception, the author gives permission to
  20.     link the code of this program with the Half-Life Game Engine ("HL
  21.     Engine") and Modified Game Libraries ("MODs") developed by Valve,
  22.     L.L.C ("Valve"). You must obey the GNU General Public License in all
  23.     respects for all of the code used other than the HL Engine and MODs
  24.     from Valve. If you modify this file, you may extend this exception
  25.     to your version of the file, but you are not obligated to do so. If
  26.     you do not wish to do so, delete this exception statement from your
  27.     version.
  28.    
  29.     ** Credits:
  30.        
  31.     - ConnorMcLeod: His MaxClip and Reload Speed plugin
  32.     - KCE: His "Blocking weapon fire" tutorial
  33.     - XxAvalanchexX: His "Beampoints from a player's weapon tip" tutorial
  34.  
  35. =================================================================================*/
  36.  
  37. #include <amxmodx>
  38. #include <hamsandwich>
  39. #include <fun>
  40. #include <engine>
  41. #include <cstrike>
  42. #include <fakemeta>
  43. #include <xs>
  44. #include <zombieplague>
  45. #include <zmvip>
  46.  
  47. /*================================================================================
  48.  [Customizations]
  49. =================================================================================*/
  50.  
  51. // Item Cost
  52. const antidotegun_ap_cost = 30
  53.  
  54. // Sprites
  55. new const antidotegun_sprite_beam[] = "sprites/zbeam6.spr"
  56. new const antidotegun_sprite_ring[] = "sprites/shockwave.spr"
  57.  
  58. // Weapon Fire Sound, you can add more than 1
  59. new const antidotegun_firesound[][] = { "weapons/gauss2.wav" }
  60.  
  61. // Hit Sound, you can add more than 1
  62. new const antidotegun_hitsound[][] = { "warcraft3/frostnova.wav" }
  63.  
  64. // Ammo bought Sound, you can add more than 1
  65. new const antidotegun_ammopickupsound[][] = { "items/9mmclip1.wav" }
  66.  
  67. // Weaponbox Glow RGB Colors    R   G   B
  68. new antidotegun_wb_color[] = {  0,  255,    255     }
  69.  
  70. // Uncomment this line if you want to add support to old ZP versions
  71. // Use if it's necessary, from version 4.2 to below
  72. // If you uncomment this line, this item can be buyed only in infection
  73. // rounds, because the main disinfect native in old versions works
  74. // only on infection rounds.
  75. //#define OLD_VERSION_SUPPORT
  76.  
  77. /*================================================================================
  78.  Customization ends here! Yes, that's it. Editing anything beyond
  79.  here is not officially supported. Proceed at your own risk...
  80. =================================================================================*/
  81.  
  82. // Booleans
  83. new bool:g_bHasAntidoteGun[33], bool:g_bIsConnected[33], bool:g_bIsAlive[33]
  84.  
  85. // Cvar pointers
  86. new cvar_enable, cvar_oneround, cvar_firerate, cvar_maxclip, cvar_maxbpammo, cvar_wboxglow,
  87. cvar_buyindelay, cvar_reloadspeed, cvar_hitslowdown
  88.  
  89. // Arrays
  90. new g_iCurrentWeapon[33], Float:g_flLastFireTime[33]
  91.  
  92. // Variables
  93. new g_iItemID, g_iMaxPlayers, g_msgSayText, g_msgDeathMsg, g_msgCurWeapon, g_msgAmmoX,
  94. g_msgAmmoPickup, g_msgScreenFade, g_sprBeam, g_sprRing, HamHook:g_iHhPostFrame_fw
  95.  
  96. // Offsets
  97. const m_pPlayer =       41
  98. const m_fInReload =     54
  99. const m_pActiveItem =       373
  100. const m_flNextAttack =      83
  101. const m_flTimeWeaponIdle =  48
  102. const m_flNextPrimaryAttack =   46
  103. const m_flNextSecondaryAttack = 47
  104.  
  105. // Some constants
  106. const FFADE_IN =        0x0000
  107. const ENG_NULLENT =         -1
  108. const UNIT_SECOND =     (1<<12)
  109. const AMMOID_GALIL =        4
  110. const GALIL_DFT_MAXCLIP =   35
  111. const V_GAUSS_ANIM_FIRE =   6
  112. const V_GAUSS_ANIM_DRAW =   8
  113. const V_GAUSS_ANIM_RELOAD =     2
  114. const EV_INT_WEAPONKEY =    EV_INT_impulse
  115. const ANTIDOTEGUN_WPNKEY =  2816
  116.  
  117. // Buy in delay cvar it's disabled
  118. // for old versions
  119. #if defined OLD_VERSION_SUPPORT
  120.     #pragma unused cvar_buyindelay
  121. #endif
  122.  
  123. // Cached cvars
  124. new bool:g_bCvar_Enabled, bool:g_bCvar_BuyUntilMode, Float:g_flCvar_FireRate,
  125. Float:g_flCvar_ReloadSpeed, Float:g_flCvar_HitSlowdown, g_iCvar_MaxClip, g_iCvar_MaxBPAmmo
  126.  
  127. // Plug info.
  128. #define PLUG_VERSION "0.6"
  129. #define PLUG_AUTH "meTaLiCroSS"
  130.  
  131. // Macros
  132. #define is_user_valid_alive(%1)     (1 <= %1 <= g_iMaxPlayers && g_bIsAlive[%1])
  133. #define is_user_valid_connected(%1)     (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])
  134.  
  135. /*================================================================================
  136.  [Init and Precache]
  137. =================================================================================*/
  138.  
  139. public plugin_init()
  140. {
  141.     // Plugin info
  142.     register_plugin("[ZP] Extra Item: Advanced Antidote Gun", PLUG_VERSION, PLUG_AUTH)
  143.    
  144.     // Events
  145.     register_event("CurWeapon", "event_CurWeapon", "b", "1=1") 
  146.     register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
  147.    
  148.     // Fakemeta Forwards
  149.     register_forward(FM_SetModel, "fw_SetModel")
  150.     register_forward(FM_CmdStart, "fw_CmdStart")
  151.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  152.    
  153.     // Hamsandwich Forwards
  154.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  155.     RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  156.     RegisterHam(Ham_Item_Deploy, "weapon_galil", "fw_Galil_Deploy_Post", 1)
  157.     RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_Galil_AddToPlayer")
  158.     RegisterHam(Ham_Weapon_Reload, "weapon_galil", "fw_Galil_Reload_Post", 1)
  159.     g_iHhPostFrame_fw = RegisterHam(Ham_Item_PostFrame, "weapon_galil", "fw_Galil_PostFrame")
  160.    
  161.     // Cvars
  162.     cvar_enable = register_cvar("zp_antidotegun_enable", "1")
  163.     cvar_oneround = register_cvar("zp_antidotegun_oneround", "0")
  164.     cvar_firerate = register_cvar("zp_antidotegun_fire_rate", "0.6")
  165.     cvar_maxclip = register_cvar("zp_antidotegun_max_clip", "3")
  166.     cvar_maxbpammo = register_cvar("zp_antidotegun_max_bpammo", "25")
  167.     cvar_reloadspeed = register_cvar("zp_antidotegun_reload_speed", "2.5")
  168.     cvar_wboxglow = register_cvar("zp_antidotegun_wbox_glow", "1")
  169.     cvar_buyindelay = register_cvar("zp_antidotegun_buy_before_modestart", "0")
  170.     cvar_hitslowdown = register_cvar("zp_antidotegun_hit_slowdown", "0.4")
  171.    
  172.     static szCvar[30]
  173.     formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
  174.     register_cvar("zp_extra_adv_antidotegun", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
  175.    
  176.     // Variables
  177.     g_iMaxPlayers = get_maxplayers()
  178.     g_msgAmmoX = get_user_msgid("AmmoX")
  179.     g_msgSayText = get_user_msgid("SayText")
  180.     g_msgDeathMsg = get_user_msgid("DeathMsg")
  181.     g_msgCurWeapon = get_user_msgid("CurWeapon")
  182.     g_msgAmmoPickup = get_user_msgid("AmmoPickup")
  183.     g_msgScreenFade = get_user_msgid("ScreenFade")
  184.     g_iItemID = zv_register_extra_item("Antidote Gun", "Desinfecting people", antidotegun_ap_cost, ZV_TEAM_HUMAN)
  185. }
  186.  
  187. public plugin_precache()
  188. {
  189.     // Models
  190.     precache_model("models/v_gauss.mdl")
  191.     precache_model("models/p_gauss.mdl")
  192.     precache_model("models/w_gauss.mdl")
  193.    
  194.     // Sprites
  195.     g_sprBeam = precache_model(antidotegun_sprite_beam)
  196.     g_sprRing = precache_model(antidotegun_sprite_ring)
  197.    
  198.     // Sounds
  199.     static i
  200.     for(i = 0; i < sizeof antidotegun_firesound; i++)
  201.         precache_sound(antidotegun_firesound[i])
  202.     for(i = 0; i < sizeof antidotegun_ammopickupsound; i++)
  203.         precache_sound(antidotegun_ammopickupsound[i])
  204.     for(i = 0; i < sizeof antidotegun_hitsound; i++)
  205.         precache_sound(antidotegun_hitsound[i])
  206.        
  207.        
  208. }
  209.  
  210. public plugin_cfg()
  211. {
  212.     // Cache some cvars after init is called
  213.     cache_cvars()
  214.    
  215.     // Check the max clip cvar
  216.     if(g_iCvar_MaxClip && g_iCvar_MaxClip != GALIL_DFT_MAXCLIP)
  217.     {
  218.         EnableHamForward(g_iHhPostFrame_fw)
  219.     }
  220.     else
  221.     {
  222.         // Should disable it if isn't necesary to check
  223.         DisableHamForward(g_iHhPostFrame_fw)
  224.     }
  225. }
  226.  
  227. /*================================================================================
  228.  [Main Events]
  229. =================================================================================*/
  230.  
  231. public event_CurWeapon(id)
  232. {
  233.     // Not alive...
  234.     if(!g_bIsAlive[id])
  235.         return PLUGIN_CONTINUE
  236.        
  237.     // Updating weapon array
  238.     g_iCurrentWeapon[id] = read_data(2)
  239.    
  240.     // Zombie or Survivor
  241.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  242.         return PLUGIN_CONTINUE
  243.        
  244.     // Doesn't has an Antidote Gun and weapon isn't Galil
  245.     if(!g_bHasAntidoteGun[id] || g_iCurrentWeapon[id] != CSW_GALIL)
  246.         return PLUGIN_CONTINUE
  247.        
  248.     // Change his models
  249.     entity_set_string(id, EV_SZ_viewmodel, "models/v_gauss.mdl")
  250.     entity_set_string(id, EV_SZ_weaponmodel, "models/p_gauss.mdl")
  251.        
  252.     return PLUGIN_CONTINUE
  253. }
  254.  
  255. public event_RoundStart()
  256. {
  257.     // Some cvars cache on round start
  258.     cache_cvars()
  259. }
  260.  
  261. /*================================================================================
  262.  [Zombie Plague Forwards]
  263. =================================================================================*/
  264.  
  265. public zp_user_humanized_pre(id)
  266. {
  267.     // Update bool when was buyed an antidote
  268.     g_bHasAntidoteGun[id] = false
  269. }
  270.  
  271. public zp_user_infected_post(id)
  272. {
  273.     // Update bool when was infected
  274.     g_bHasAntidoteGun[id] = false
  275. }
  276.  
  277. public zv_extra_item_selected(id, itemid)
  278. {
  279.     // It's an antidote gun itemid
  280.     if(itemid == g_iItemID)
  281.     {
  282.         // Should be enabled
  283.         if(g_bCvar_Enabled)
  284.         {
  285.             // Buy until round starts?
  286.             if (!zp_has_round_started() && !g_bCvar_BuyUntilMode)
  287.             {
  288.                 client_printcolor(id, "/g[ZP]/y You must wait until the round starts")
  289.                
  290.                 #if defined OLD_VERSION_SUPPORT
  291.                 zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  292.                 return PLUGIN_CONTINUE
  293.                 #else
  294.                 return ZV_PLUGIN_HANDLED
  295.                 #endif
  296.             }
  297.            
  298.             #if defined OLD_VERSION_SUPPORT
  299.             // Check actual mode id
  300.             if(zp_is_plague_round() || zp_is_swarm_round() || zp_is_nemesis_round() || zp_is_survivor_round())
  301.             {
  302.                 client_printcolor(id, "/g[ZP]/y You can't buy this gun in this round")
  303.                 zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  304.                 return PLUGIN_CONTINUE
  305.             }
  306.             #endif
  307.            
  308.             // Some vars with info
  309.             new iWpnID, iAmmo, iBPAmmo, bool:bAlreadyHasGalil = bool:user_has_weapon(id, CSW_GALIL)
  310.            
  311.             // Already has this gun
  312.             if(g_bHasAntidoteGun[id] && bAlreadyHasGalil)
  313.             {
  314.                 // Update the current backpack ammo
  315.                 iBPAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  316.                
  317.                 // We can't give more ammo
  318.                 if(iBPAmmo >= g_iCvar_MaxBPAmmo)
  319.                 {
  320.                     client_printcolor(id, "/g[ZP]/y Your Antidote Gun backpack ammo it's full")
  321.                    
  322.                     #if defined OLD_VERSION_SUPPORT
  323.                     zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  324.                     return PLUGIN_CONTINUE
  325.                     #else
  326.                     return ZV_PLUGIN_HANDLED
  327.                     #endif
  328.                 }
  329.  
  330.                 // Get the new ammo it are going to be used by the player
  331.                 static iNewAmmo
  332.                 iNewAmmo = g_iCvar_MaxBPAmmo - iBPAmmo
  333.                
  334.                 // Give the new amount of ammo
  335.                 cs_set_user_bpammo(id, CSW_GALIL, iBPAmmo + iNewAmmo)
  336.                
  337.                 // Flash ammo in hud
  338.                 message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  339.                 write_byte(AMMOID_GALIL) // ammo id
  340.                 write_byte(iNewAmmo) // ammo amount
  341.                 message_end()
  342.                
  343.                 // Play clip purchase sound
  344.                 emit_sound(id, CHAN_ITEM, antidotegun_ammopickupsound[random_num(0, sizeof antidotegun_ammopickupsound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  345.             }
  346.             else
  347.             {  
  348.                 // We need to get if has an ordinary galil
  349.                 if(bAlreadyHasGalil)
  350.                     ham_strip_weapon(id, "weapon_galil")
  351.                    
  352.                 // Update player bool
  353.                 g_bHasAntidoteGun[id] = true
  354.                
  355.                 // Give and store the weapon id
  356.                 iWpnID = give_item(id, "weapon_galil")
  357.                
  358.                 // Set the normal weapon ammo
  359.                 if(g_iCvar_MaxClip && g_iCvar_MaxClip != GALIL_DFT_MAXCLIP)
  360.                     cs_set_weapon_ammo(iWpnID, g_iCvar_MaxClip)
  361.                    
  362.                 // Set the max bpammo
  363.                 cs_set_user_bpammo(id, CSW_GALIL, g_iCvar_MaxBPAmmo)
  364.             }
  365.            
  366.             // We should update this var if isn't info into.
  367.             if(!iWpnID) iWpnID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", id)
  368.                
  369.             // Yes or yes we need to update this vars with the current ammo amount
  370.             iAmmo = cs_get_weapon_ammo(iWpnID)
  371.             iBPAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  372.                
  373.             // Force to change his gun
  374.             engclient_cmd(id, "weapon_galil")
  375.            
  376.             // Update the player ammo
  377.             update_ammo_hud(id, iAmmo, iBPAmmo)
  378.         }
  379.         else
  380.         {
  381.             // A message
  382.             client_printcolor(id, "/g[ZP]/y Antidote Gun item has been disabled. /gContact Admin")
  383.            
  384.             #if defined OLD_VERSION_SUPPORT
  385.             zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  386.             return PLUGIN_CONTINUE
  387.             #else
  388.             return ZV_PLUGIN_HANDLED
  389.             #endif
  390.         }
  391.     }
  392.    
  393.     return PLUGIN_CONTINUE
  394. }
  395.  
  396. /*================================================================================
  397.  [Main Forwards]
  398. =================================================================================*/
  399.  
  400. public client_putinserver(id)
  401. {
  402.     // Updating bools
  403.     g_bIsConnected[id] = true
  404.     g_bHasAntidoteGun[id] = false
  405. }
  406.  
  407. public client_disconnect(id)
  408. {
  409.     // Updating bools
  410.     g_bIsAlive[id] = false
  411.     g_bIsConnected[id] = false
  412.     g_bHasAntidoteGun[id] = false
  413. }
  414.  
  415. public fw_PlayerSpawn_Post(id)
  416. {
  417.     // Not alive...
  418.     if(!is_user_alive(id))
  419.         return HAM_IGNORED
  420.        
  421.     // Player is alive
  422.     g_bIsAlive[id] = true
  423.    
  424.     // Remove Weapon
  425.     if(get_pcvar_num(cvar_oneround) || !g_bCvar_Enabled)
  426.     {
  427.         if(g_bHasAntidoteGun[id])
  428.         {
  429.             // Reset player vars
  430.             g_bHasAntidoteGun[id] = false
  431.            
  432.             // Strip his galil
  433.             ham_strip_weapon(id, "weapon_galil")
  434.         }
  435.     }
  436.    
  437.     return HAM_IGNORED
  438. }
  439.  
  440. public fw_PlayerKilled(victim, attacker, shouldgib)
  441. {
  442.     // Player victim
  443.     if(is_user_valid_connected(victim))
  444.     {
  445.         // Victim is not alive
  446.         g_bIsAlive[victim] = false
  447.        
  448.         // Reset player vars
  449.         g_bHasAntidoteGun[victim] = false
  450.        
  451.         return HAM_HANDLED
  452.     }
  453.    
  454.     return HAM_IGNORED
  455. }
  456.  
  457. public fw_CmdStart(id, handle, seed)
  458. {
  459.     // Skip not alive users
  460.     if(!is_user_valid_alive(id))
  461.         return FMRES_IGNORED
  462.        
  463.     // Without an antidote gun
  464.     if(!g_bHasAntidoteGun[id])
  465.         return FMRES_IGNORED
  466.        
  467.     // Not human
  468.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  469.         return FMRES_IGNORED
  470.    
  471.     // Isn't holding a Galil
  472.     if(g_iCurrentWeapon[id] != CSW_GALIL)
  473.         return FMRES_IGNORED
  474.        
  475.     // Get Buttons
  476.     static iButton
  477.     iButton = get_uc(handle, UC_Buttons)
  478.    
  479.     // User pressing +attack Button
  480.     if(iButton & IN_ATTACK)
  481.     {
  482.         // Buttons
  483.         set_uc(handle, UC_Buttons, iButton & ~IN_ATTACK)
  484.        
  485.         // Some vars
  486.         static Float:flCurrentTime
  487.         flCurrentTime = halflife_time()
  488.        
  489.         // Fire rate not over yet
  490.         if (flCurrentTime - g_flLastFireTime[id] < g_flCvar_FireRate)
  491.             return FMRES_IGNORED
  492.            
  493.         // Another vars with info
  494.         static iWpnID, iClip
  495.         iWpnID = get_pdata_cbase(id, m_pActiveItem, 5)
  496.         iClip = cs_get_weapon_ammo(iWpnID)
  497.        
  498.         // Skip if is in reload
  499.         if(get_pdata_int(iWpnID, m_fInReload, 4))
  500.             return FMRES_IGNORED
  501.        
  502.         // To don't reload instantly (bugfix)
  503.         set_pdata_float(iWpnID, m_flNextPrimaryAttack, g_flCvar_FireRate, 4)
  504.         set_pdata_float(iWpnID, m_flNextSecondaryAttack, g_flCvar_FireRate, 4)
  505.         set_pdata_float(iWpnID, m_flTimeWeaponIdle, g_flCvar_FireRate, 4)
  506.        
  507.         // Update last fire time array
  508.         g_flLastFireTime[id] = flCurrentTime
  509.        
  510.         // 0 bullets
  511.         if(iClip <= 0)
  512.         {
  513.             // Play empty clip sound
  514.             ExecuteHamB(Ham_Weapon_PlayEmptySound, iWpnID)
  515.  
  516.             return FMRES_IGNORED
  517.         }
  518.            
  519.         // Process fire
  520.         primary_attack(id)
  521.        
  522.         // Real fire push knockback
  523.         launch_push(id, 40)
  524.        
  525.         // Update Ammo
  526.         cs_set_weapon_ammo(iWpnID, --iClip)
  527.         update_ammo_hud(id, iClip, cs_get_user_bpammo(id, CSW_GALIL))
  528.        
  529.         return FMRES_IGNORED
  530.     }
  531.    
  532.     return FMRES_IGNORED
  533. }
  534.  
  535. public fw_SetModel(entity, model[])
  536. {
  537.     // Entity is not valid
  538.     if(!is_valid_ent(entity))
  539.         return FMRES_IGNORED;
  540.        
  541.     // Entity model is not w_galil
  542.     if(!equal(model, "models/w_galil.mdl"))
  543.         return FMRES_IGNORED;
  544.        
  545.     // Get classname
  546.     static szClassName[33]
  547.     entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  548.        
  549.     // Not a Weapon box
  550.     if(!equal(szClassName, "weaponbox"))
  551.         return FMRES_IGNORED
  552.    
  553.     // Some vars
  554.     static iOwner, iStoredGalilID
  555.    
  556.     // Get owner
  557.     iOwner = entity_get_edict(entity, EV_ENT_owner)
  558.    
  559.     // Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
  560.     iStoredGalilID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", entity)
  561.    
  562.     // Entity classname is weaponbox, and galil has founded
  563.     if(g_bHasAntidoteGun[iOwner] && is_valid_ent(iStoredGalilID))
  564.     {
  565.         // Setting weapon options
  566.         entity_set_int(iStoredGalilID, EV_INT_WEAPONKEY, ANTIDOTEGUN_WPNKEY)
  567.        
  568.         // Reset user vars
  569.         g_bHasAntidoteGun[iOwner] = false
  570.        
  571.         // Set weaponbox new model
  572.         entity_set_model(entity, "models/w_gauss.mdl")
  573.        
  574.         // Glow
  575.         if(get_pcvar_num(cvar_wboxglow))
  576.             set_rendering(entity, kRenderFxGlowShell, antidotegun_wb_color[0], antidotegun_wb_color[1], antidotegun_wb_color[2], kRenderNormal, 25)
  577.        
  578.         return FMRES_SUPERCEDE
  579.     }
  580.    
  581.     return FMRES_IGNORED
  582. }
  583.  
  584. public fw_UpdateClientData_Post(id, sendweapons, handle)
  585. {
  586.     // Skip not alive users
  587.     if(!is_user_valid_alive(id))
  588.         return FMRES_IGNORED
  589.        
  590.     // Without an antidote gun
  591.     if(!g_bHasAntidoteGun[id])
  592.         return FMRES_IGNORED
  593.        
  594.     // Not human
  595.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  596.         return FMRES_IGNORED
  597.    
  598.     // Isn't holding a Galil
  599.     if(g_iCurrentWeapon[id] != CSW_GALIL)
  600.         return FMRES_IGNORED
  601.        
  602.     // Player can't attack with the AG
  603.     set_cd(handle, CD_flNextAttack, halflife_time() + 0.001)
  604.  
  605.     return FMRES_HANDLED
  606. }
  607.  
  608. public fw_Galil_Deploy_Post(galil)
  609. {
  610.     // Get galil owner
  611.     static id
  612.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  613.    
  614.     // The current galil owner has an antidote gun?
  615.     if(is_user_valid_connected(id) && g_bHasAntidoteGun[id])
  616.     {
  617.         // Update the current ammo
  618.         update_ammo_hud(id, cs_get_weapon_ammo(galil), cs_get_user_bpammo(id, CSW_GALIL))
  619.        
  620.         // Send the draw animation
  621.         set_user_weaponanim(id, V_GAUSS_ANIM_DRAW)
  622.     }
  623.    
  624.     return HAM_IGNORED
  625. }
  626.  
  627. public fw_Galil_AddToPlayer(galil, player)
  628. {
  629.     // Is an antidote gun?
  630.     if(is_valid_ent(galil) && is_user_valid_connected(player) && entity_get_int(galil, EV_INT_WEAPONKEY) == ANTIDOTEGUN_WPNKEY)
  631.     {
  632.         // Set vars
  633.         g_bHasAntidoteGun[player] = true
  634.        
  635.         // Reset weapon options
  636.         entity_set_int(galil, EV_INT_WEAPONKEY, 0)
  637.        
  638.         return HAM_HANDLED
  639.     }
  640.    
  641.     return HAM_IGNORED
  642. }
  643.  
  644. public fw_Galil_PostFrame(galil)
  645. {
  646.     // Get galil owner
  647.     static id
  648.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  649.    
  650.     // His owner has an antidote gun?
  651.     if(is_user_valid_alive(id) && g_bHasAntidoteGun[id])
  652.     {
  653.         // Some vars
  654.         static Float:flNextAttack, iBpAmmo, iClip, iInReload
  655.        
  656.         // Weapon is on middle reload
  657.         iInReload = get_pdata_int(galil, m_fInReload, 4)
  658.        
  659.         // Next player attack
  660.         flNextAttack = get_pdata_float(id, m_flNextAttack, 5)
  661.        
  662.         // Player back pack ammo
  663.         iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  664.        
  665.         // Current weapon clip
  666.         iClip = cs_get_weapon_ammo(galil)
  667.        
  668.         // End of reload
  669.         if(iInReload && flNextAttack <= 0.0)
  670.         {
  671.             // Get the minimun amount between maxclip sub. current clip
  672.             // and the player backpack ammo
  673.             new j = min(g_iCvar_MaxClip - iClip, iBpAmmo)
  674.            
  675.             // Set the new weapon clip
  676.             cs_set_weapon_ammo(galil, iClip + j)
  677.    
  678.             // Set the new player backpack ammo
  679.             cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j)
  680.            
  681.             // Update the weapon offset "inreload" to 0 ("false")
  682.             iInReload = 0
  683.             set_pdata_int(galil, m_fInReload, 0, 4)
  684.         }
  685.    
  686.         // Get the current player buttons
  687.         static iButton
  688.         iButton = get_user_button(id)
  689.        
  690.         // The player stills pressing the fire button
  691.         if((iButton & IN_ATTACK2 && get_pdata_float(galil, m_flNextSecondaryAttack, 4) <= 0.0) || (iButton & IN_ATTACK && get_pdata_float(galil, m_flNextPrimaryAttack, 4) <= 0.0))
  692.             return
  693.    
  694.         // Trying to reload pressing the reload button when isn't it
  695.         if(iButton & IN_RELOAD && !iInReload)
  696.         {
  697.             // The current weapon clip exceed the new max clip
  698.             if(iClip >= g_iCvar_MaxClip)
  699.             {
  700.                 // Retrieve player reload button
  701.                 entity_set_int(id, EV_INT_button, iButton & ~IN_RELOAD)
  702.                
  703.                 // Send idle animation
  704.                 set_user_weaponanim(id, 0)
  705.             }
  706.             // The current weapon clip it's the same like the old max weapon clip
  707.             else if(iClip == GALIL_DFT_MAXCLIP)
  708.             {
  709.                 // Has an amount of bpammo?
  710.                 if(iBpAmmo)
  711.                 {
  712.                     // Should make a reload
  713.                     antidotegun_reload(id, galil, 1)
  714.                 }
  715.             }
  716.         }
  717.     }
  718.    
  719.     // Credits and thanks to ConnorMcLeod for his Weapon MaxClip plugin!
  720. }
  721.  
  722. public fw_Galil_Reload_Post(galil)
  723. {
  724.     // Get galil owner
  725.     static id
  726.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  727.    
  728.     // It's in reload and his owner has an antidote gun?
  729.     if(is_user_valid_alive(id) && g_bHasAntidoteGun[id] && get_pdata_int(galil, m_fInReload, 4))
  730.     {  
  731.         // Change normal reload options
  732.         antidotegun_reload(id, galil)
  733.     }
  734. }
  735.  
  736. /*================================================================================
  737.  [Internal Functions]
  738. =================================================================================*/
  739.  
  740. cache_cvars()
  741. {
  742.     // Some cvars
  743.     g_bCvar_Enabled = bool:get_pcvar_num(cvar_enable)
  744.     g_flCvar_FireRate = get_pcvar_float(cvar_firerate)
  745.     g_flCvar_ReloadSpeed = get_pcvar_float(cvar_reloadspeed)
  746.     g_flCvar_HitSlowdown = get_pcvar_float(cvar_hitslowdown)
  747.     g_iCvar_MaxClip = clamp(get_pcvar_num(cvar_maxclip), 0, 120)
  748.     g_iCvar_MaxBPAmmo = clamp(get_pcvar_num(cvar_maxbpammo), 1, 90)
  749.    
  750.     #if defined OLD_VERSION_SUPPORT
  751.     g_bCvar_BuyUntilMode = false
  752.     #else
  753.     g_bCvar_BuyUntilMode = bool:get_pcvar_num(cvar_buyindelay)
  754.     #endif
  755. }
  756.  
  757. primary_attack(id)
  758. {
  759.     // Fire Effect
  760.     set_user_weaponanim(id, V_GAUSS_ANIM_FIRE)
  761.     entity_set_vector(id, EV_VEC_punchangle, Float:{ -1.5, 0.0, 0.0 })
  762.     emit_sound(id, CHAN_WEAPON, antidotegun_firesound[random_num(0, sizeof antidotegun_firesound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  763.    
  764.     // Some vars
  765.     static iTarget, iBody, iEndOrigin[3]
  766.    
  767.     // Get end origin from eyes
  768.     get_user_origin(id, iEndOrigin, 3)
  769.    
  770.     // Make gun beam
  771.     beam_from_gun(id, iEndOrigin)
  772.    
  773.     // Get user aiming
  774.     get_user_aiming(id, iTarget, iBody)
  775.    
  776.     // Do sound by a new entity
  777.     new iEnt = create_entity("info_target")
  778.    
  779.     // Integer vector into a Float vector
  780.     static Float:flOrigin[3]
  781.     IVecFVec(iEndOrigin, flOrigin)
  782.    
  783.     // Set entity origin
  784.     entity_set_origin(iEnt, flOrigin)
  785.    
  786.     // Sound
  787.     emit_sound(iEnt, CHAN_WEAPON, antidotegun_hitsound[random_num(0, sizeof antidotegun_firesound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  788.    
  789.     // Remove entity
  790.     remove_entity(iEnt)
  791.    
  792.     // Aim target it's a player
  793.     if(is_user_valid_alive(iTarget))
  794.     {  
  795.         // Hit slowdown, first should be enabled
  796.         if(g_flCvar_HitSlowdown > 0.0)
  797.         {
  798.             // Get his current velocity vector
  799.             static Float:flVelocity[3]
  800.             get_user_velocity(iTarget, flVelocity)
  801.            
  802.             // Multiply his velocity by a number
  803.             xs_vec_mul_scalar(flVelocity, g_flCvar_HitSlowdown, flVelocity)
  804.            
  805.             // Set his new velocity vector
  806.             set_user_velocity(iTarget, flVelocity) 
  807.         }
  808.        
  809.         // It's allowed to be disinfected
  810.         if(zp_get_user_zombie(iTarget) && !zp_get_user_nemesis(iTarget) && !zp_get_user_last_zombie(iTarget))
  811.         {
  812.             // Disinfect user
  813.             #if defined OLD_VERSION_SUPPORT
  814.             zp_disinfect_user(iTarget)
  815.             #else
  816.             zp_disinfect_user(iTarget, 1)
  817.             #endif
  818.            
  819.             // Death message
  820.             message_begin(MSG_BROADCAST, g_msgDeathMsg)
  821.             write_byte(id) // killer
  822.             write_byte(iTarget) // victim
  823.             write_byte(iBody == HIT_HEAD ? 1 : 0) // headshot flag
  824.             write_string("antidote gun") // killer's weapon
  825.             message_end()
  826.            
  827.             // Screen fade fx
  828.             message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, iTarget)
  829.             write_short(UNIT_SECOND*1) // duration
  830.             write_short(UNIT_SECOND/2) // hold time
  831.             write_short(FFADE_IN) // fade type
  832.             write_byte(0) // r
  833.             write_byte(255) // g
  834.             write_byte(255) // b
  835.             write_byte(227) // alpha
  836.             message_end()
  837.            
  838.             // Beam Cylinder fx
  839.             message_begin(MSG_PVS, SVC_TEMPENTITY, iEndOrigin)
  840.             write_byte(TE_BEAMCYLINDER) // TE id
  841.             write_coord(iEndOrigin[0]) // position.x
  842.             write_coord(iEndOrigin[1]) // position.y
  843.             write_coord(iEndOrigin[2]) // position.z
  844.             write_coord(iEndOrigin[0]) // x axis
  845.             write_coord(iEndOrigin[1]) // y axis
  846.             write_coord(iEndOrigin[2] + 385) // z axis
  847.             write_short(g_sprRing) // sprite
  848.             write_byte(0) // startframe
  849.             write_byte(0) // framerate
  850.             write_byte(4) // life
  851.             write_byte(30) // width
  852.             write_byte(0) // noise
  853.             write_byte(0) // red
  854.             write_byte(255) // green
  855.             write_byte(255) // blue
  856.             write_byte(200) // brightness
  857.             write_byte(0) // speed
  858.             message_end()
  859.         }
  860.         // Can't be disinfected
  861.         else
  862.         {
  863.             // Faster particles
  864.             message_begin(MSG_PVS, SVC_TEMPENTITY, iEndOrigin)
  865.             write_byte(TE_PARTICLEBURST) // TE id
  866.             write_coord(iEndOrigin[0]) // position.x
  867.             write_coord(iEndOrigin[1]) // position.y
  868.             write_coord(iEndOrigin[2]) // position.z
  869.             write_short(45) // radius
  870.             write_byte(208) // particle color
  871.             write_byte(10) // duration * 10 will be randomized a bit
  872.             message_end()
  873.         }
  874.     }
  875.     else
  876.     {
  877.         // Aim target entity it's valid and isn't worldspawn?
  878.         if((iTarget > 0) && is_valid_ent(iTarget))
  879.         {
  880.             // Get aim target classname
  881.             static szClassname[32]
  882.             entity_get_string(iTarget, EV_SZ_classname, szClassname, charsmax(szClassname))
  883.            
  884.             // It's a breakable entity
  885.             if(equal(szClassname, "func_breakable"))
  886.             {
  887.                 // Get destroy this ent
  888.                 force_use(id, iTarget)
  889.             }
  890.         }
  891.     }
  892. }
  893.  
  894. antidotegun_reload(id, galil, force_reload = 0)
  895. {
  896.     // Next player attack time
  897.     set_pdata_float(id, m_flNextAttack, g_flCvar_ReloadSpeed, 5)
  898.  
  899.     // Send to the player the reload animation
  900.     set_user_weaponanim(id, V_GAUSS_ANIM_RELOAD)
  901.    
  902.     // Update the weapon offset "inreload" to 1 ("true")
  903.     if(force_reload)
  904.         set_pdata_int(galil, m_fInReload, 1, 4)
  905.  
  906.     // Next idle weapon time, soonest time ItemPostFrame will call WeaponIdle.
  907.     set_pdata_float(galil, m_flTimeWeaponIdle, g_flCvar_ReloadSpeed + 0.5, 4)
  908.    
  909.     // I'll be honest, i don't know what do this.
  910.     entity_set_float(id, EV_FL_frame, 200.0)
  911. }
  912.  
  913. update_ammo_hud(id, iAmmoAmount, iBPAmmoAmount)
  914. {
  915.     // Display the new antidotegun bullets
  916.     if(iAmmoAmount != -1)
  917.     {
  918.         message_begin(MSG_ONE_UNRELIABLE, g_msgCurWeapon, _, id)
  919.         write_byte(1) // active
  920.         write_byte(CSW_GALIL) // weapon
  921.         write_byte(iAmmoAmount) // clip
  922.         message_end()
  923.     }
  924.    
  925.     // Display the new amount of BPAmmo
  926.     if(iBPAmmoAmount != -1)
  927.     {
  928.         message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoX, _, id)
  929.         write_byte(AMMOID_GALIL) // ammoid
  930.         write_byte(iBPAmmoAmount) // ammo amount
  931.         message_end()
  932.     }
  933. }
  934.  
  935. beam_from_gun(id, iEndOrigin[3])
  936. {
  937.     // Make a cool beam
  938.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  939.     write_byte(TE_BEAMENTPOINT) // TE id
  940.     write_short(id | 0x1000) // start entity
  941.     write_coord(iEndOrigin[0]) // endposition.x
  942.     write_coord(iEndOrigin[1]) // endposition.y
  943.     write_coord(iEndOrigin[2]) // endposition.z
  944.     write_short(g_sprBeam)    // sprite index
  945.     write_byte(1)   // framestart
  946.     write_byte(1)   // framerate
  947.     write_byte(1)   // life in 0.1's
  948.     write_byte(10)  // width
  949.     write_byte(0)   // noise
  950.     write_byte(0)   // r
  951.     write_byte(255) // g
  952.     write_byte(255) // b
  953.     write_byte(200) // brightness
  954.     write_byte(0)   // speed
  955.     message_end()
  956.    
  957.     // Dynamic Light
  958.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  959.     write_byte(TE_DLIGHT) // TE id
  960.     write_coord(iEndOrigin[0]) // position.x
  961.     write_coord(iEndOrigin[1]) // position.y
  962.     write_coord(iEndOrigin[2]) // position.z
  963.     write_byte(30) // radius
  964.     write_byte(0) // red
  965.     write_byte(255) // green
  966.     write_byte(255) // blue
  967.     write_byte(10) // life
  968.     write_byte(45) // decay rate
  969.     message_end()
  970.    
  971.     // Sparks
  972.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  973.     write_byte(TE_SPARKS) // TE id
  974.     write_coord(iEndOrigin[0]) // position.x
  975.     write_coord(iEndOrigin[1]) // position.y
  976.     write_coord(iEndOrigin[2]) // position.z
  977.     message_end()
  978. }
  979.  
  980. /*================================================================================
  981.  [Stocks]
  982. =================================================================================*/
  983.  
  984. stock set_user_weaponanim(id, anim)
  985. {
  986.     entity_set_int(id, EV_INT_weaponanim, anim)
  987.     message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
  988.     write_byte(anim)
  989.     write_byte(entity_get_int(id, EV_INT_body))
  990.     message_end()
  991. }
  992.  
  993. stock launch_push(id, velamount) // from my Nemesis Rocket Launcher plugin.
  994. {
  995.     static Float:flNewVelocity[3], Float:flCurrentVelocity[3]
  996.    
  997.     velocity_by_aim(id, -velamount, flNewVelocity)
  998.    
  999.     get_user_velocity(id, flCurrentVelocity)
  1000.     xs_vec_add(flNewVelocity, flCurrentVelocity, flNewVelocity)
  1001.    
  1002.     set_user_velocity(id, flNewVelocity)   
  1003. }
  1004.  
  1005. stock ham_strip_weapon(id, weapon[])
  1006. {
  1007.     if(!equal(weapon,"weapon_",7))
  1008.         return 0
  1009.    
  1010.     new wId = get_weaponid(weapon)
  1011.    
  1012.     if(!wId) return 0
  1013.    
  1014.     new wEnt
  1015.    
  1016.     while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
  1017.    
  1018.     if(!wEnt) return 0
  1019.    
  1020.     if(get_user_weapon(id) == wId)
  1021.         ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
  1022.    
  1023.     if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
  1024.         return 0
  1025.        
  1026.     ExecuteHamB(Ham_Item_Kill, wEnt)
  1027.    
  1028.     entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))
  1029.  
  1030.     return 1
  1031. }
  1032.  
  1033. stock client_printcolor(id, const input[], any:...)
  1034. {
  1035.     static iPlayersNum[32], iCount; iCount = 1
  1036.     static szMsg[191]
  1037.    
  1038.     vformat(szMsg, charsmax(szMsg), input, 3)
  1039.    
  1040.     replace_all(szMsg, 190, "/g", "^4") // green txt
  1041.     replace_all(szMsg, 190, "/y", "^1") // orange txt
  1042.     replace_all(szMsg, 190, "/ctr", "^3") // team txt
  1043.     replace_all(szMsg, 190, "/w", "^0") // team txt
  1044.    
  1045.     if(id) iPlayersNum[0] = id
  1046.     else get_players(iPlayersNum, iCount, "ch")
  1047.        
  1048.     for (new i = 0; i < iCount; i++)
  1049.     {
  1050.         if (g_bIsConnected[iPlayersNum[i]])
  1051.         {
  1052.             message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayersNum[i])
  1053.             write_byte(iPlayersNum[i])
  1054.             write_string(szMsg)
  1055.             message_end()
  1056.         }
  1057.     }
  1058. }


az odáig tiszta h #include <zmvip> helyett #include <zm_vip>
és a többi?

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: vip1.9.1 extra items hiba
HozzászólásElküldve: 2017.06.02. 14:08 
Offline
Nagyúr

Csatlakozott: 2016.03.03. 17:37
Hozzászólások: 530
Megköszönt másnak: 4 alkalommal
Megköszönték neki: 65 alkalommal
elit írta:
üdv.
  1. Load fails: Plugin uses an unknown function (name "zv_register_extra_item") - check your modules.ini.


esetleg aki ért is hozzá el magyarázná h mi a hiba.

  1. /*================================================================================
  2.  
  3.     [ZP] Extra Item: Advanced Antidote Gun
  4.     Copyright (C) 2010 by meTaLiCroSS, Vińa del Mar, Chile
  5.    
  6.     This program is free software: you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation, either version 3 of the License, or
  9.     (at your option) any later version.
  10.    
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.    
  19.     In addition, as a special exception, the author gives permission to
  20.     link the code of this program with the Half-Life Game Engine ("HL
  21.     Engine") and Modified Game Libraries ("MODs") developed by Valve,
  22.     L.L.C ("Valve"). You must obey the GNU General Public License in all
  23.     respects for all of the code used other than the HL Engine and MODs
  24.     from Valve. If you modify this file, you may extend this exception
  25.     to your version of the file, but you are not obligated to do so. If
  26.     you do not wish to do so, delete this exception statement from your
  27.     version.
  28.    
  29.     ** Credits:
  30.        
  31.     - ConnorMcLeod: His MaxClip and Reload Speed plugin
  32.     - KCE: His "Blocking weapon fire" tutorial
  33.     - XxAvalanchexX: His "Beampoints from a player's weapon tip" tutorial
  34.  
  35. =================================================================================*/
  36.  
  37. #include <amxmodx>
  38. #include <hamsandwich>
  39. #include <fun>
  40. #include <engine>
  41. #include <cstrike>
  42. #include <fakemeta>
  43. #include <xs>
  44. #include <zombieplague>
  45. #include <zmvip>
  46.  
  47. /*================================================================================
  48.  [Customizations]
  49. =================================================================================*/
  50.  
  51. // Item Cost
  52. const antidotegun_ap_cost = 30
  53.  
  54. // Sprites
  55. new const antidotegun_sprite_beam[] = "sprites/zbeam6.spr"
  56. new const antidotegun_sprite_ring[] = "sprites/shockwave.spr"
  57.  
  58. // Weapon Fire Sound, you can add more than 1
  59. new const antidotegun_firesound[][] = { "weapons/gauss2.wav" }
  60.  
  61. // Hit Sound, you can add more than 1
  62. new const antidotegun_hitsound[][] = { "warcraft3/frostnova.wav" }
  63.  
  64. // Ammo bought Sound, you can add more than 1
  65. new const antidotegun_ammopickupsound[][] = { "items/9mmclip1.wav" }
  66.  
  67. // Weaponbox Glow RGB Colors    R   G   B
  68. new antidotegun_wb_color[] = {  0,  255,    255     }
  69.  
  70. // Uncomment this line if you want to add support to old ZP versions
  71. // Use if it's necessary, from version 4.2 to below
  72. // If you uncomment this line, this item can be buyed only in infection
  73. // rounds, because the main disinfect native in old versions works
  74. // only on infection rounds.
  75. //#define OLD_VERSION_SUPPORT
  76.  
  77. /*================================================================================
  78.  Customization ends here! Yes, that's it. Editing anything beyond
  79.  here is not officially supported. Proceed at your own risk...
  80. =================================================================================*/
  81.  
  82. // Booleans
  83. new bool:g_bHasAntidoteGun[33], bool:g_bIsConnected[33], bool:g_bIsAlive[33]
  84.  
  85. // Cvar pointers
  86. new cvar_enable, cvar_oneround, cvar_firerate, cvar_maxclip, cvar_maxbpammo, cvar_wboxglow,
  87. cvar_buyindelay, cvar_reloadspeed, cvar_hitslowdown
  88.  
  89. // Arrays
  90. new g_iCurrentWeapon[33], Float:g_flLastFireTime[33]
  91.  
  92. // Variables
  93. new g_iItemID, g_iMaxPlayers, g_msgSayText, g_msgDeathMsg, g_msgCurWeapon, g_msgAmmoX,
  94. g_msgAmmoPickup, g_msgScreenFade, g_sprBeam, g_sprRing, HamHook:g_iHhPostFrame_fw
  95.  
  96. // Offsets
  97. const m_pPlayer =       41
  98. const m_fInReload =     54
  99. const m_pActiveItem =       373
  100. const m_flNextAttack =      83
  101. const m_flTimeWeaponIdle =  48
  102. const m_flNextPrimaryAttack =   46
  103. const m_flNextSecondaryAttack = 47
  104.  
  105. // Some constants
  106. const FFADE_IN =        0x0000
  107. const ENG_NULLENT =         -1
  108. const UNIT_SECOND =     (1<<12)
  109. const AMMOID_GALIL =        4
  110. const GALIL_DFT_MAXCLIP =   35
  111. const V_GAUSS_ANIM_FIRE =   6
  112. const V_GAUSS_ANIM_DRAW =   8
  113. const V_GAUSS_ANIM_RELOAD =     2
  114. const EV_INT_WEAPONKEY =    EV_INT_impulse
  115. const ANTIDOTEGUN_WPNKEY =  2816
  116.  
  117. // Buy in delay cvar it's disabled
  118. // for old versions
  119. #if defined OLD_VERSION_SUPPORT
  120.     #pragma unused cvar_buyindelay
  121. #endif
  122.  
  123. // Cached cvars
  124. new bool:g_bCvar_Enabled, bool:g_bCvar_BuyUntilMode, Float:g_flCvar_FireRate,
  125. Float:g_flCvar_ReloadSpeed, Float:g_flCvar_HitSlowdown, g_iCvar_MaxClip, g_iCvar_MaxBPAmmo
  126.  
  127. // Plug info.
  128. #define PLUG_VERSION "0.6"
  129. #define PLUG_AUTH "meTaLiCroSS"
  130.  
  131. // Macros
  132. #define is_user_valid_alive(%1)     (1 <= %1 <= g_iMaxPlayers && g_bIsAlive[%1])
  133. #define is_user_valid_connected(%1)     (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])
  134.  
  135. /*================================================================================
  136.  [Init and Precache]
  137. =================================================================================*/
  138.  
  139. public plugin_init()
  140. {
  141.     // Plugin info
  142.     register_plugin("[ZP] Extra Item: Advanced Antidote Gun", PLUG_VERSION, PLUG_AUTH)
  143.    
  144.     // Events
  145.     register_event("CurWeapon", "event_CurWeapon", "b", "1=1") 
  146.     register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
  147.    
  148.     // Fakemeta Forwards
  149.     register_forward(FM_SetModel, "fw_SetModel")
  150.     register_forward(FM_CmdStart, "fw_CmdStart")
  151.     register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
  152.    
  153.     // Hamsandwich Forwards
  154.     RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
  155.     RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  156.     RegisterHam(Ham_Item_Deploy, "weapon_galil", "fw_Galil_Deploy_Post", 1)
  157.     RegisterHam(Ham_Item_AddToPlayer, "weapon_galil", "fw_Galil_AddToPlayer")
  158.     RegisterHam(Ham_Weapon_Reload, "weapon_galil", "fw_Galil_Reload_Post", 1)
  159.     g_iHhPostFrame_fw = RegisterHam(Ham_Item_PostFrame, "weapon_galil", "fw_Galil_PostFrame")
  160.    
  161.     // Cvars
  162.     cvar_enable = register_cvar("zp_antidotegun_enable", "1")
  163.     cvar_oneround = register_cvar("zp_antidotegun_oneround", "0")
  164.     cvar_firerate = register_cvar("zp_antidotegun_fire_rate", "0.6")
  165.     cvar_maxclip = register_cvar("zp_antidotegun_max_clip", "3")
  166.     cvar_maxbpammo = register_cvar("zp_antidotegun_max_bpammo", "25")
  167.     cvar_reloadspeed = register_cvar("zp_antidotegun_reload_speed", "2.5")
  168.     cvar_wboxglow = register_cvar("zp_antidotegun_wbox_glow", "1")
  169.     cvar_buyindelay = register_cvar("zp_antidotegun_buy_before_modestart", "0")
  170.     cvar_hitslowdown = register_cvar("zp_antidotegun_hit_slowdown", "0.4")
  171.    
  172.     static szCvar[30]
  173.     formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
  174.     register_cvar("zp_extra_adv_antidotegun", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
  175.    
  176.     // Variables
  177.     g_iMaxPlayers = get_maxplayers()
  178.     g_msgAmmoX = get_user_msgid("AmmoX")
  179.     g_msgSayText = get_user_msgid("SayText")
  180.     g_msgDeathMsg = get_user_msgid("DeathMsg")
  181.     g_msgCurWeapon = get_user_msgid("CurWeapon")
  182.     g_msgAmmoPickup = get_user_msgid("AmmoPickup")
  183.     g_msgScreenFade = get_user_msgid("ScreenFade")
  184.     g_iItemID = zv_register_extra_item("Antidote Gun", "Desinfecting people", antidotegun_ap_cost, ZV_TEAM_HUMAN)
  185. }
  186.  
  187. public plugin_precache()
  188. {
  189.     // Models
  190.     precache_model("models/v_gauss.mdl")
  191.     precache_model("models/p_gauss.mdl")
  192.     precache_model("models/w_gauss.mdl")
  193.    
  194.     // Sprites
  195.     g_sprBeam = precache_model(antidotegun_sprite_beam)
  196.     g_sprRing = precache_model(antidotegun_sprite_ring)
  197.    
  198.     // Sounds
  199.     static i
  200.     for(i = 0; i < sizeof antidotegun_firesound; i++)
  201.         precache_sound(antidotegun_firesound[i])
  202.     for(i = 0; i < sizeof antidotegun_ammopickupsound; i++)
  203.         precache_sound(antidotegun_ammopickupsound[i])
  204.     for(i = 0; i < sizeof antidotegun_hitsound; i++)
  205.         precache_sound(antidotegun_hitsound[i])
  206.        
  207.        
  208. }
  209.  
  210. public plugin_cfg()
  211. {
  212.     // Cache some cvars after init is called
  213.     cache_cvars()
  214.    
  215.     // Check the max clip cvar
  216.     if(g_iCvar_MaxClip && g_iCvar_MaxClip != GALIL_DFT_MAXCLIP)
  217.     {
  218.         EnableHamForward(g_iHhPostFrame_fw)
  219.     }
  220.     else
  221.     {
  222.         // Should disable it if isn't necesary to check
  223.         DisableHamForward(g_iHhPostFrame_fw)
  224.     }
  225. }
  226.  
  227. /*================================================================================
  228.  [Main Events]
  229. =================================================================================*/
  230.  
  231. public event_CurWeapon(id)
  232. {
  233.     // Not alive...
  234.     if(!g_bIsAlive[id])
  235.         return PLUGIN_CONTINUE
  236.        
  237.     // Updating weapon array
  238.     g_iCurrentWeapon[id] = read_data(2)
  239.    
  240.     // Zombie or Survivor
  241.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  242.         return PLUGIN_CONTINUE
  243.        
  244.     // Doesn't has an Antidote Gun and weapon isn't Galil
  245.     if(!g_bHasAntidoteGun[id] || g_iCurrentWeapon[id] != CSW_GALIL)
  246.         return PLUGIN_CONTINUE
  247.        
  248.     // Change his models
  249.     entity_set_string(id, EV_SZ_viewmodel, "models/v_gauss.mdl")
  250.     entity_set_string(id, EV_SZ_weaponmodel, "models/p_gauss.mdl")
  251.        
  252.     return PLUGIN_CONTINUE
  253. }
  254.  
  255. public event_RoundStart()
  256. {
  257.     // Some cvars cache on round start
  258.     cache_cvars()
  259. }
  260.  
  261. /*================================================================================
  262.  [Zombie Plague Forwards]
  263. =================================================================================*/
  264.  
  265. public zp_user_humanized_pre(id)
  266. {
  267.     // Update bool when was buyed an antidote
  268.     g_bHasAntidoteGun[id] = false
  269. }
  270.  
  271. public zp_user_infected_post(id)
  272. {
  273.     // Update bool when was infected
  274.     g_bHasAntidoteGun[id] = false
  275. }
  276.  
  277. public zv_extra_item_selected(id, itemid)
  278. {
  279.     // It's an antidote gun itemid
  280.     if(itemid == g_iItemID)
  281.     {
  282.         // Should be enabled
  283.         if(g_bCvar_Enabled)
  284.         {
  285.             // Buy until round starts?
  286.             if (!zp_has_round_started() && !g_bCvar_BuyUntilMode)
  287.             {
  288.                 client_printcolor(id, "/g[ZP]/y You must wait until the round starts")
  289.                
  290.                 #if defined OLD_VERSION_SUPPORT
  291.                 zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  292.                 return PLUGIN_CONTINUE
  293.                 #else
  294.                 return ZV_PLUGIN_HANDLED
  295.                 #endif
  296.             }
  297.            
  298.             #if defined OLD_VERSION_SUPPORT
  299.             // Check actual mode id
  300.             if(zp_is_plague_round() || zp_is_swarm_round() || zp_is_nemesis_round() || zp_is_survivor_round())
  301.             {
  302.                 client_printcolor(id, "/g[ZP]/y You can't buy this gun in this round")
  303.                 zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  304.                 return PLUGIN_CONTINUE
  305.             }
  306.             #endif
  307.            
  308.             // Some vars with info
  309.             new iWpnID, iAmmo, iBPAmmo, bool:bAlreadyHasGalil = bool:user_has_weapon(id, CSW_GALIL)
  310.            
  311.             // Already has this gun
  312.             if(g_bHasAntidoteGun[id] && bAlreadyHasGalil)
  313.             {
  314.                 // Update the current backpack ammo
  315.                 iBPAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  316.                
  317.                 // We can't give more ammo
  318.                 if(iBPAmmo >= g_iCvar_MaxBPAmmo)
  319.                 {
  320.                     client_printcolor(id, "/g[ZP]/y Your Antidote Gun backpack ammo it's full")
  321.                    
  322.                     #if defined OLD_VERSION_SUPPORT
  323.                     zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  324.                     return PLUGIN_CONTINUE
  325.                     #else
  326.                     return ZV_PLUGIN_HANDLED
  327.                     #endif
  328.                 }
  329.  
  330.                 // Get the new ammo it are going to be used by the player
  331.                 static iNewAmmo
  332.                 iNewAmmo = g_iCvar_MaxBPAmmo - iBPAmmo
  333.                
  334.                 // Give the new amount of ammo
  335.                 cs_set_user_bpammo(id, CSW_GALIL, iBPAmmo + iNewAmmo)
  336.                
  337.                 // Flash ammo in hud
  338.                 message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoPickup, _, id)
  339.                 write_byte(AMMOID_GALIL) // ammo id
  340.                 write_byte(iNewAmmo) // ammo amount
  341.                 message_end()
  342.                
  343.                 // Play clip purchase sound
  344.                 emit_sound(id, CHAN_ITEM, antidotegun_ammopickupsound[random_num(0, sizeof antidotegun_ammopickupsound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  345.             }
  346.             else
  347.             {  
  348.                 // We need to get if has an ordinary galil
  349.                 if(bAlreadyHasGalil)
  350.                     ham_strip_weapon(id, "weapon_galil")
  351.                    
  352.                 // Update player bool
  353.                 g_bHasAntidoteGun[id] = true
  354.                
  355.                 // Give and store the weapon id
  356.                 iWpnID = give_item(id, "weapon_galil")
  357.                
  358.                 // Set the normal weapon ammo
  359.                 if(g_iCvar_MaxClip && g_iCvar_MaxClip != GALIL_DFT_MAXCLIP)
  360.                     cs_set_weapon_ammo(iWpnID, g_iCvar_MaxClip)
  361.                    
  362.                 // Set the max bpammo
  363.                 cs_set_user_bpammo(id, CSW_GALIL, g_iCvar_MaxBPAmmo)
  364.             }
  365.            
  366.             // We should update this var if isn't info into.
  367.             if(!iWpnID) iWpnID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", id)
  368.                
  369.             // Yes or yes we need to update this vars with the current ammo amount
  370.             iAmmo = cs_get_weapon_ammo(iWpnID)
  371.             iBPAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  372.                
  373.             // Force to change his gun
  374.             engclient_cmd(id, "weapon_galil")
  375.            
  376.             // Update the player ammo
  377.             update_ammo_hud(id, iAmmo, iBPAmmo)
  378.         }
  379.         else
  380.         {
  381.             // A message
  382.             client_printcolor(id, "/g[ZP]/y Antidote Gun item has been disabled. /gContact Admin")
  383.            
  384.             #if defined OLD_VERSION_SUPPORT
  385.             zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + antidotegun_ap_cost)
  386.             return PLUGIN_CONTINUE
  387.             #else
  388.             return ZV_PLUGIN_HANDLED
  389.             #endif
  390.         }
  391.     }
  392.    
  393.     return PLUGIN_CONTINUE
  394. }
  395.  
  396. /*================================================================================
  397.  [Main Forwards]
  398. =================================================================================*/
  399.  
  400. public client_putinserver(id)
  401. {
  402.     // Updating bools
  403.     g_bIsConnected[id] = true
  404.     g_bHasAntidoteGun[id] = false
  405. }
  406.  
  407. public client_disconnect(id)
  408. {
  409.     // Updating bools
  410.     g_bIsAlive[id] = false
  411.     g_bIsConnected[id] = false
  412.     g_bHasAntidoteGun[id] = false
  413. }
  414.  
  415. public fw_PlayerSpawn_Post(id)
  416. {
  417.     // Not alive...
  418.     if(!is_user_alive(id))
  419.         return HAM_IGNORED
  420.        
  421.     // Player is alive
  422.     g_bIsAlive[id] = true
  423.    
  424.     // Remove Weapon
  425.     if(get_pcvar_num(cvar_oneround) || !g_bCvar_Enabled)
  426.     {
  427.         if(g_bHasAntidoteGun[id])
  428.         {
  429.             // Reset player vars
  430.             g_bHasAntidoteGun[id] = false
  431.            
  432.             // Strip his galil
  433.             ham_strip_weapon(id, "weapon_galil")
  434.         }
  435.     }
  436.    
  437.     return HAM_IGNORED
  438. }
  439.  
  440. public fw_PlayerKilled(victim, attacker, shouldgib)
  441. {
  442.     // Player victim
  443.     if(is_user_valid_connected(victim))
  444.     {
  445.         // Victim is not alive
  446.         g_bIsAlive[victim] = false
  447.        
  448.         // Reset player vars
  449.         g_bHasAntidoteGun[victim] = false
  450.        
  451.         return HAM_HANDLED
  452.     }
  453.    
  454.     return HAM_IGNORED
  455. }
  456.  
  457. public fw_CmdStart(id, handle, seed)
  458. {
  459.     // Skip not alive users
  460.     if(!is_user_valid_alive(id))
  461.         return FMRES_IGNORED
  462.        
  463.     // Without an antidote gun
  464.     if(!g_bHasAntidoteGun[id])
  465.         return FMRES_IGNORED
  466.        
  467.     // Not human
  468.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  469.         return FMRES_IGNORED
  470.    
  471.     // Isn't holding a Galil
  472.     if(g_iCurrentWeapon[id] != CSW_GALIL)
  473.         return FMRES_IGNORED
  474.        
  475.     // Get Buttons
  476.     static iButton
  477.     iButton = get_uc(handle, UC_Buttons)
  478.    
  479.     // User pressing +attack Button
  480.     if(iButton & IN_ATTACK)
  481.     {
  482.         // Buttons
  483.         set_uc(handle, UC_Buttons, iButton & ~IN_ATTACK)
  484.        
  485.         // Some vars
  486.         static Float:flCurrentTime
  487.         flCurrentTime = halflife_time()
  488.        
  489.         // Fire rate not over yet
  490.         if (flCurrentTime - g_flLastFireTime[id] < g_flCvar_FireRate)
  491.             return FMRES_IGNORED
  492.            
  493.         // Another vars with info
  494.         static iWpnID, iClip
  495.         iWpnID = get_pdata_cbase(id, m_pActiveItem, 5)
  496.         iClip = cs_get_weapon_ammo(iWpnID)
  497.        
  498.         // Skip if is in reload
  499.         if(get_pdata_int(iWpnID, m_fInReload, 4))
  500.             return FMRES_IGNORED
  501.        
  502.         // To don't reload instantly (bugfix)
  503.         set_pdata_float(iWpnID, m_flNextPrimaryAttack, g_flCvar_FireRate, 4)
  504.         set_pdata_float(iWpnID, m_flNextSecondaryAttack, g_flCvar_FireRate, 4)
  505.         set_pdata_float(iWpnID, m_flTimeWeaponIdle, g_flCvar_FireRate, 4)
  506.        
  507.         // Update last fire time array
  508.         g_flLastFireTime[id] = flCurrentTime
  509.        
  510.         // 0 bullets
  511.         if(iClip <= 0)
  512.         {
  513.             // Play empty clip sound
  514.             ExecuteHamB(Ham_Weapon_PlayEmptySound, iWpnID)
  515.  
  516.             return FMRES_IGNORED
  517.         }
  518.            
  519.         // Process fire
  520.         primary_attack(id)
  521.        
  522.         // Real fire push knockback
  523.         launch_push(id, 40)
  524.        
  525.         // Update Ammo
  526.         cs_set_weapon_ammo(iWpnID, --iClip)
  527.         update_ammo_hud(id, iClip, cs_get_user_bpammo(id, CSW_GALIL))
  528.        
  529.         return FMRES_IGNORED
  530.     }
  531.    
  532.     return FMRES_IGNORED
  533. }
  534.  
  535. public fw_SetModel(entity, model[])
  536. {
  537.     // Entity is not valid
  538.     if(!is_valid_ent(entity))
  539.         return FMRES_IGNORED;
  540.        
  541.     // Entity model is not w_galil
  542.     if(!equal(model, "models/w_galil.mdl"))
  543.         return FMRES_IGNORED;
  544.        
  545.     // Get classname
  546.     static szClassName[33]
  547.     entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
  548.        
  549.     // Not a Weapon box
  550.     if(!equal(szClassName, "weaponbox"))
  551.         return FMRES_IGNORED
  552.    
  553.     // Some vars
  554.     static iOwner, iStoredGalilID
  555.    
  556.     // Get owner
  557.     iOwner = entity_get_edict(entity, EV_ENT_owner)
  558.    
  559.     // Get drop weapon index (galil) to use in fw_Galil_AddToPlayer forward
  560.     iStoredGalilID = find_ent_by_owner(ENG_NULLENT, "weapon_galil", entity)
  561.    
  562.     // Entity classname is weaponbox, and galil has founded
  563.     if(g_bHasAntidoteGun[iOwner] && is_valid_ent(iStoredGalilID))
  564.     {
  565.         // Setting weapon options
  566.         entity_set_int(iStoredGalilID, EV_INT_WEAPONKEY, ANTIDOTEGUN_WPNKEY)
  567.        
  568.         // Reset user vars
  569.         g_bHasAntidoteGun[iOwner] = false
  570.        
  571.         // Set weaponbox new model
  572.         entity_set_model(entity, "models/w_gauss.mdl")
  573.        
  574.         // Glow
  575.         if(get_pcvar_num(cvar_wboxglow))
  576.             set_rendering(entity, kRenderFxGlowShell, antidotegun_wb_color[0], antidotegun_wb_color[1], antidotegun_wb_color[2], kRenderNormal, 25)
  577.        
  578.         return FMRES_SUPERCEDE
  579.     }
  580.    
  581.     return FMRES_IGNORED
  582. }
  583.  
  584. public fw_UpdateClientData_Post(id, sendweapons, handle)
  585. {
  586.     // Skip not alive users
  587.     if(!is_user_valid_alive(id))
  588.         return FMRES_IGNORED
  589.        
  590.     // Without an antidote gun
  591.     if(!g_bHasAntidoteGun[id])
  592.         return FMRES_IGNORED
  593.        
  594.     // Not human
  595.     if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
  596.         return FMRES_IGNORED
  597.    
  598.     // Isn't holding a Galil
  599.     if(g_iCurrentWeapon[id] != CSW_GALIL)
  600.         return FMRES_IGNORED
  601.        
  602.     // Player can't attack with the AG
  603.     set_cd(handle, CD_flNextAttack, halflife_time() + 0.001)
  604.  
  605.     return FMRES_HANDLED
  606. }
  607.  
  608. public fw_Galil_Deploy_Post(galil)
  609. {
  610.     // Get galil owner
  611.     static id
  612.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  613.    
  614.     // The current galil owner has an antidote gun?
  615.     if(is_user_valid_connected(id) && g_bHasAntidoteGun[id])
  616.     {
  617.         // Update the current ammo
  618.         update_ammo_hud(id, cs_get_weapon_ammo(galil), cs_get_user_bpammo(id, CSW_GALIL))
  619.        
  620.         // Send the draw animation
  621.         set_user_weaponanim(id, V_GAUSS_ANIM_DRAW)
  622.     }
  623.    
  624.     return HAM_IGNORED
  625. }
  626.  
  627. public fw_Galil_AddToPlayer(galil, player)
  628. {
  629.     // Is an antidote gun?
  630.     if(is_valid_ent(galil) && is_user_valid_connected(player) && entity_get_int(galil, EV_INT_WEAPONKEY) == ANTIDOTEGUN_WPNKEY)
  631.     {
  632.         // Set vars
  633.         g_bHasAntidoteGun[player] = true
  634.        
  635.         // Reset weapon options
  636.         entity_set_int(galil, EV_INT_WEAPONKEY, 0)
  637.        
  638.         return HAM_HANDLED
  639.     }
  640.    
  641.     return HAM_IGNORED
  642. }
  643.  
  644. public fw_Galil_PostFrame(galil)
  645. {
  646.     // Get galil owner
  647.     static id
  648.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  649.    
  650.     // His owner has an antidote gun?
  651.     if(is_user_valid_alive(id) && g_bHasAntidoteGun[id])
  652.     {
  653.         // Some vars
  654.         static Float:flNextAttack, iBpAmmo, iClip, iInReload
  655.        
  656.         // Weapon is on middle reload
  657.         iInReload = get_pdata_int(galil, m_fInReload, 4)
  658.        
  659.         // Next player attack
  660.         flNextAttack = get_pdata_float(id, m_flNextAttack, 5)
  661.        
  662.         // Player back pack ammo
  663.         iBpAmmo = cs_get_user_bpammo(id, CSW_GALIL)
  664.        
  665.         // Current weapon clip
  666.         iClip = cs_get_weapon_ammo(galil)
  667.        
  668.         // End of reload
  669.         if(iInReload && flNextAttack <= 0.0)
  670.         {
  671.             // Get the minimun amount between maxclip sub. current clip
  672.             // and the player backpack ammo
  673.             new j = min(g_iCvar_MaxClip - iClip, iBpAmmo)
  674.            
  675.             // Set the new weapon clip
  676.             cs_set_weapon_ammo(galil, iClip + j)
  677.    
  678.             // Set the new player backpack ammo
  679.             cs_set_user_bpammo(id, CSW_GALIL, iBpAmmo-j)
  680.            
  681.             // Update the weapon offset "inreload" to 0 ("false")
  682.             iInReload = 0
  683.             set_pdata_int(galil, m_fInReload, 0, 4)
  684.         }
  685.    
  686.         // Get the current player buttons
  687.         static iButton
  688.         iButton = get_user_button(id)
  689.        
  690.         // The player stills pressing the fire button
  691.         if((iButton & IN_ATTACK2 && get_pdata_float(galil, m_flNextSecondaryAttack, 4) <= 0.0) || (iButton & IN_ATTACK && get_pdata_float(galil, m_flNextPrimaryAttack, 4) <= 0.0))
  692.             return
  693.    
  694.         // Trying to reload pressing the reload button when isn't it
  695.         if(iButton & IN_RELOAD && !iInReload)
  696.         {
  697.             // The current weapon clip exceed the new max clip
  698.             if(iClip >= g_iCvar_MaxClip)
  699.             {
  700.                 // Retrieve player reload button
  701.                 entity_set_int(id, EV_INT_button, iButton & ~IN_RELOAD)
  702.                
  703.                 // Send idle animation
  704.                 set_user_weaponanim(id, 0)
  705.             }
  706.             // The current weapon clip it's the same like the old max weapon clip
  707.             else if(iClip == GALIL_DFT_MAXCLIP)
  708.             {
  709.                 // Has an amount of bpammo?
  710.                 if(iBpAmmo)
  711.                 {
  712.                     // Should make a reload
  713.                     antidotegun_reload(id, galil, 1)
  714.                 }
  715.             }
  716.         }
  717.     }
  718.    
  719.     // Credits and thanks to ConnorMcLeod for his Weapon MaxClip plugin!
  720. }
  721.  
  722. public fw_Galil_Reload_Post(galil)
  723. {
  724.     // Get galil owner
  725.     static id
  726.     id = get_pdata_cbase(galil, m_pPlayer, 4)
  727.    
  728.     // It's in reload and his owner has an antidote gun?
  729.     if(is_user_valid_alive(id) && g_bHasAntidoteGun[id] && get_pdata_int(galil, m_fInReload, 4))
  730.     {  
  731.         // Change normal reload options
  732.         antidotegun_reload(id, galil)
  733.     }
  734. }
  735.  
  736. /*================================================================================
  737.  [Internal Functions]
  738. =================================================================================*/
  739.  
  740. cache_cvars()
  741. {
  742.     // Some cvars
  743.     g_bCvar_Enabled = bool:get_pcvar_num(cvar_enable)
  744.     g_flCvar_FireRate = get_pcvar_float(cvar_firerate)
  745.     g_flCvar_ReloadSpeed = get_pcvar_float(cvar_reloadspeed)
  746.     g_flCvar_HitSlowdown = get_pcvar_float(cvar_hitslowdown)
  747.     g_iCvar_MaxClip = clamp(get_pcvar_num(cvar_maxclip), 0, 120)
  748.     g_iCvar_MaxBPAmmo = clamp(get_pcvar_num(cvar_maxbpammo), 1, 90)
  749.    
  750.     #if defined OLD_VERSION_SUPPORT
  751.     g_bCvar_BuyUntilMode = false
  752.     #else
  753.     g_bCvar_BuyUntilMode = bool:get_pcvar_num(cvar_buyindelay)
  754.     #endif
  755. }
  756.  
  757. primary_attack(id)
  758. {
  759.     // Fire Effect
  760.     set_user_weaponanim(id, V_GAUSS_ANIM_FIRE)
  761.     entity_set_vector(id, EV_VEC_punchangle, Float:{ -1.5, 0.0, 0.0 })
  762.     emit_sound(id, CHAN_WEAPON, antidotegun_firesound[random_num(0, sizeof antidotegun_firesound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  763.    
  764.     // Some vars
  765.     static iTarget, iBody, iEndOrigin[3]
  766.    
  767.     // Get end origin from eyes
  768.     get_user_origin(id, iEndOrigin, 3)
  769.    
  770.     // Make gun beam
  771.     beam_from_gun(id, iEndOrigin)
  772.    
  773.     // Get user aiming
  774.     get_user_aiming(id, iTarget, iBody)
  775.    
  776.     // Do sound by a new entity
  777.     new iEnt = create_entity("info_target")
  778.    
  779.     // Integer vector into a Float vector
  780.     static Float:flOrigin[3]
  781.     IVecFVec(iEndOrigin, flOrigin)
  782.    
  783.     // Set entity origin
  784.     entity_set_origin(iEnt, flOrigin)
  785.    
  786.     // Sound
  787.     emit_sound(iEnt, CHAN_WEAPON, antidotegun_hitsound[random_num(0, sizeof antidotegun_firesound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  788.    
  789.     // Remove entity
  790.     remove_entity(iEnt)
  791.    
  792.     // Aim target it's a player
  793.     if(is_user_valid_alive(iTarget))
  794.     {  
  795.         // Hit slowdown, first should be enabled
  796.         if(g_flCvar_HitSlowdown > 0.0)
  797.         {
  798.             // Get his current velocity vector
  799.             static Float:flVelocity[3]
  800.             get_user_velocity(iTarget, flVelocity)
  801.            
  802.             // Multiply his velocity by a number
  803.             xs_vec_mul_scalar(flVelocity, g_flCvar_HitSlowdown, flVelocity)
  804.            
  805.             // Set his new velocity vector
  806.             set_user_velocity(iTarget, flVelocity) 
  807.         }
  808.        
  809.         // It's allowed to be disinfected
  810.         if(zp_get_user_zombie(iTarget) && !zp_get_user_nemesis(iTarget) && !zp_get_user_last_zombie(iTarget))
  811.         {
  812.             // Disinfect user
  813.             #if defined OLD_VERSION_SUPPORT
  814.             zp_disinfect_user(iTarget)
  815.             #else
  816.             zp_disinfect_user(iTarget, 1)
  817.             #endif
  818.            
  819.             // Death message
  820.             message_begin(MSG_BROADCAST, g_msgDeathMsg)
  821.             write_byte(id) // killer
  822.             write_byte(iTarget) // victim
  823.             write_byte(iBody == HIT_HEAD ? 1 : 0) // headshot flag
  824.             write_string("antidote gun") // killer's weapon
  825.             message_end()
  826.            
  827.             // Screen fade fx
  828.             message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, iTarget)
  829.             write_short(UNIT_SECOND*1) // duration
  830.             write_short(UNIT_SECOND/2) // hold time
  831.             write_short(FFADE_IN) // fade type
  832.             write_byte(0) // r
  833.             write_byte(255) // g
  834.             write_byte(255) // b
  835.             write_byte(227) // alpha
  836.             message_end()
  837.            
  838.             // Beam Cylinder fx
  839.             message_begin(MSG_PVS, SVC_TEMPENTITY, iEndOrigin)
  840.             write_byte(TE_BEAMCYLINDER) // TE id
  841.             write_coord(iEndOrigin[0]) // position.x
  842.             write_coord(iEndOrigin[1]) // position.y
  843.             write_coord(iEndOrigin[2]) // position.z
  844.             write_coord(iEndOrigin[0]) // x axis
  845.             write_coord(iEndOrigin[1]) // y axis
  846.             write_coord(iEndOrigin[2] + 385) // z axis
  847.             write_short(g_sprRing) // sprite
  848.             write_byte(0) // startframe
  849.             write_byte(0) // framerate
  850.             write_byte(4) // life
  851.             write_byte(30) // width
  852.             write_byte(0) // noise
  853.             write_byte(0) // red
  854.             write_byte(255) // green
  855.             write_byte(255) // blue
  856.             write_byte(200) // brightness
  857.             write_byte(0) // speed
  858.             message_end()
  859.         }
  860.         // Can't be disinfected
  861.         else
  862.         {
  863.             // Faster particles
  864.             message_begin(MSG_PVS, SVC_TEMPENTITY, iEndOrigin)
  865.             write_byte(TE_PARTICLEBURST) // TE id
  866.             write_coord(iEndOrigin[0]) // position.x
  867.             write_coord(iEndOrigin[1]) // position.y
  868.             write_coord(iEndOrigin[2]) // position.z
  869.             write_short(45) // radius
  870.             write_byte(208) // particle color
  871.             write_byte(10) // duration * 10 will be randomized a bit
  872.             message_end()
  873.         }
  874.     }
  875.     else
  876.     {
  877.         // Aim target entity it's valid and isn't worldspawn?
  878.         if((iTarget > 0) && is_valid_ent(iTarget))
  879.         {
  880.             // Get aim target classname
  881.             static szClassname[32]
  882.             entity_get_string(iTarget, EV_SZ_classname, szClassname, charsmax(szClassname))
  883.            
  884.             // It's a breakable entity
  885.             if(equal(szClassname, "func_breakable"))
  886.             {
  887.                 // Get destroy this ent
  888.                 force_use(id, iTarget)
  889.             }
  890.         }
  891.     }
  892. }
  893.  
  894. antidotegun_reload(id, galil, force_reload = 0)
  895. {
  896.     // Next player attack time
  897.     set_pdata_float(id, m_flNextAttack, g_flCvar_ReloadSpeed, 5)
  898.  
  899.     // Send to the player the reload animation
  900.     set_user_weaponanim(id, V_GAUSS_ANIM_RELOAD)
  901.    
  902.     // Update the weapon offset "inreload" to 1 ("true")
  903.     if(force_reload)
  904.         set_pdata_int(galil, m_fInReload, 1, 4)
  905.  
  906.     // Next idle weapon time, soonest time ItemPostFrame will call WeaponIdle.
  907.     set_pdata_float(galil, m_flTimeWeaponIdle, g_flCvar_ReloadSpeed + 0.5, 4)
  908.    
  909.     // I'll be honest, i don't know what do this.
  910.     entity_set_float(id, EV_FL_frame, 200.0)
  911. }
  912.  
  913. update_ammo_hud(id, iAmmoAmount, iBPAmmoAmount)
  914. {
  915.     // Display the new antidotegun bullets
  916.     if(iAmmoAmount != -1)
  917.     {
  918.         message_begin(MSG_ONE_UNRELIABLE, g_msgCurWeapon, _, id)
  919.         write_byte(1) // active
  920.         write_byte(CSW_GALIL) // weapon
  921.         write_byte(iAmmoAmount) // clip
  922.         message_end()
  923.     }
  924.    
  925.     // Display the new amount of BPAmmo
  926.     if(iBPAmmoAmount != -1)
  927.     {
  928.         message_begin(MSG_ONE_UNRELIABLE, g_msgAmmoX, _, id)
  929.         write_byte(AMMOID_GALIL) // ammoid
  930.         write_byte(iBPAmmoAmount) // ammo amount
  931.         message_end()
  932.     }
  933. }
  934.  
  935. beam_from_gun(id, iEndOrigin[3])
  936. {
  937.     // Make a cool beam
  938.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  939.     write_byte(TE_BEAMENTPOINT) // TE id
  940.     write_short(id | 0x1000) // start entity
  941.     write_coord(iEndOrigin[0]) // endposition.x
  942.     write_coord(iEndOrigin[1]) // endposition.y
  943.     write_coord(iEndOrigin[2]) // endposition.z
  944.     write_short(g_sprBeam)    // sprite index
  945.     write_byte(1)   // framestart
  946.     write_byte(1)   // framerate
  947.     write_byte(1)   // life in 0.1's
  948.     write_byte(10)  // width
  949.     write_byte(0)   // noise
  950.     write_byte(0)   // r
  951.     write_byte(255) // g
  952.     write_byte(255) // b
  953.     write_byte(200) // brightness
  954.     write_byte(0)   // speed
  955.     message_end()
  956.    
  957.     // Dynamic Light
  958.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  959.     write_byte(TE_DLIGHT) // TE id
  960.     write_coord(iEndOrigin[0]) // position.x
  961.     write_coord(iEndOrigin[1]) // position.y
  962.     write_coord(iEndOrigin[2]) // position.z
  963.     write_byte(30) // radius
  964.     write_byte(0) // red
  965.     write_byte(255) // green
  966.     write_byte(255) // blue
  967.     write_byte(10) // life
  968.     write_byte(45) // decay rate
  969.     message_end()
  970.    
  971.     // Sparks
  972.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iEndOrigin)
  973.     write_byte(TE_SPARKS) // TE id
  974.     write_coord(iEndOrigin[0]) // position.x
  975.     write_coord(iEndOrigin[1]) // position.y
  976.     write_coord(iEndOrigin[2]) // position.z
  977.     message_end()
  978. }
  979.  
  980. /*================================================================================
  981.  [Stocks]
  982. =================================================================================*/
  983.  
  984. stock set_user_weaponanim(id, anim)
  985. {
  986.     entity_set_int(id, EV_INT_weaponanim, anim)
  987.     message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
  988.     write_byte(anim)
  989.     write_byte(entity_get_int(id, EV_INT_body))
  990.     message_end()
  991. }
  992.  
  993. stock launch_push(id, velamount) // from my Nemesis Rocket Launcher plugin.
  994. {
  995.     static Float:flNewVelocity[3], Float:flCurrentVelocity[3]
  996.    
  997.     velocity_by_aim(id, -velamount, flNewVelocity)
  998.    
  999.     get_user_velocity(id, flCurrentVelocity)
  1000.     xs_vec_add(flNewVelocity, flCurrentVelocity, flNewVelocity)
  1001.    
  1002.     set_user_velocity(id, flNewVelocity)   
  1003. }
  1004.  
  1005. stock ham_strip_weapon(id, weapon[])
  1006. {
  1007.     if(!equal(weapon,"weapon_",7))
  1008.         return 0
  1009.    
  1010.     new wId = get_weaponid(weapon)
  1011.    
  1012.     if(!wId) return 0
  1013.    
  1014.     new wEnt
  1015.    
  1016.     while((wEnt = find_ent_by_class(wEnt, weapon)) && entity_get_edict(wEnt, EV_ENT_owner) != id) {}
  1017.    
  1018.     if(!wEnt) return 0
  1019.    
  1020.     if(get_user_weapon(id) == wId)
  1021.         ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
  1022.    
  1023.     if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt))
  1024.         return 0
  1025.        
  1026.     ExecuteHamB(Ham_Item_Kill, wEnt)
  1027.    
  1028.     entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) & ~(1<<wId))
  1029.  
  1030.     return 1
  1031. }
  1032.  
  1033. stock client_printcolor(id, const input[], any:...)
  1034. {
  1035.     static iPlayersNum[32], iCount; iCount = 1
  1036.     static szMsg[191]
  1037.    
  1038.     vformat(szMsg, charsmax(szMsg), input, 3)
  1039.    
  1040.     replace_all(szMsg, 190, "/g", "^4") // green txt
  1041.     replace_all(szMsg, 190, "/y", "^1") // orange txt
  1042.     replace_all(szMsg, 190, "/ctr", "^3") // team txt
  1043.     replace_all(szMsg, 190, "/w", "^0") // team txt
  1044.    
  1045.     if(id) iPlayersNum[0] = id
  1046.     else get_players(iPlayersNum, iCount, "ch")
  1047.        
  1048.     for (new i = 0; i < iCount; i++)
  1049.     {
  1050.         if (g_bIsConnected[iPlayersNum[i]])
  1051.         {
  1052.             message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayersNum[i])
  1053.             write_byte(iPlayersNum[i])
  1054.             write_string(szMsg)
  1055.             message_end()
  1056.         }
  1057.     }
  1058. }


az odáig tiszta h #include <zmvip> helyett #include <zm_vip>
és a többi?



ZP-hez nem értek.
Kód:
modules.ini.

Valaminek itt?

_________________
DeteCT0R írta:
Van egy kis baj a pluginnal :DEs orulnek ha a kockak megneznek egy csepet:D

Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: vip1.9.1 extra items hiba
HozzászólásElküldve: 2017.06.02. 14:22 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.14. 08:21
Hozzászólások: 547
Megköszönt másnak: 95 alkalommal
Megköszönték neki: 71 alkalommal
engedélyezve van minden.
itt igazából a forditónál van a gond

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: vip1.9.1 extra items hiba
HozzászólásElküldve: 2017.06.02. 19:54 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.01.15. 19:04
Hozzászólások: 407
Megköszönt másnak: 17 alkalommal
Megköszönték neki: 176 alkalommal
Egyik pluginban, modulban sincs definiálva a zv_register_extra_item függvény, csak egyik include tartalmazza ezt a nativeot.


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: vip1.9.1 extra items hiba
HozzászólásElküldve: 2017.06.03. 08:05 
Offline
Nagyúr
Avatar

Csatlakozott: 2013.09.14. 08:21
Hozzászólások: 547
Megköszönt másnak: 95 alkalommal
Megköszönték neki: 71 alkalommal
demon írta:
Egyik pluginban, modulban sincs definiálva a zv_register_extra_item függvény, csak egyik include tartalmazza ezt a nativeot.


te hát akkor igy ahogy le esett. az egész modba át kell irni? meg a kiegészitökbe is?

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 5 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 1 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole