Page 1 of 1

Why would this happen?

Posted: 21 Sep 2018, 00:04
by Mark
Look in pic trying to figure it out

20180920190312_1.jpg

If i add limits this happens if i have no lmits it displays normal

Re: Why would this happen?

Posted: 21 Sep 2018, 06:09
by Raheem
What the problem, the missing bracket or the double of 30 % OFF?

Re: Why would this happen?

Posted: 21 Sep 2018, 11:06
by Night Fury
Raheem wrote: 5 years ago What the problem, the missing bracket or the double of 30 % OFF?
Most of his problems are because of de_dust map.

Re: Why would this happen?

Posted: 21 Sep 2018, 11:10
by Raheem
Jack GamePlay wrote: 5 years ago Most of his problems are because of de_dust map.
:lol:, NO bro map not the issue.

I reviewed the photo again, seems there is line break missing ^n. Post the code that cuases this i'll test it.

Re: Why would this happen?

Posted: 21 Sep 2018, 12:26
by Mark
Raheem wrote: 5 years ago
Jack GamePlay wrote: 5 years ago Most of his problems are because of de_dust map.
:lol:, NO bro map not the issue.

I reviewed the photo again, seems there is line break missing ^n. Post the code that cuases this i'll test it.
What code you want me to post lol the item_limit?
  1. #include <zombie_escape>
  2.  
  3. // Variables
  4. new g_iLimitCounter[MAX_PLAYERS+1][MAX_EXTRA_ITEMS],
  5.     g_iMaxClients
  6.  
  7. public plugin_init()
  8. {
  9.     register_plugin("[ZE] Items Manager: Limit", ZE_VERSION, AUTHORS)
  10.    
  11.     // Static Values
  12.     g_iMaxClients = get_member_game(m_nMaxPlayers)
  13. }
  14.  
  15. public ze_select_item_pre(id, itemid, ignorecost)
  16. {
  17.     new iLimit = ze_get_item_limit(itemid)
  18.    
  19.     if (iLimit > 0)
  20.     {
  21.         // Format extra text to be added beside our item
  22.         new szText[32]
  23.         formatex(szText, charsmax(szText), " %L", id, "ITEM_LIMIT", g_iLimitCounter[id][itemid], iLimit)
  24.        
  25.         // Add the text
  26.         ze_add_text_to_item(szText)
  27.        
  28.         // Check if reached max or not?
  29.         if (g_iLimitCounter[id][itemid] >= iLimit)
  30.         {
  31.             return ZE_ITEM_UNAVAILABLE
  32.         }
  33.     }
  34.    
  35.     return ZE_ITEM_AVAILABLE
  36. }
  37.  
  38. public ze_select_item_post(id, itemid, ignorecost)
  39. {
  40.     if (ignorecost)
  41.         return
  42.    
  43.     // Increase Counter by 1
  44.     g_iLimitCounter[id][itemid]++
  45. }
  46.  
  47. public ze_game_started()
  48. {
  49.     // Rest our counter to zero
  50.     for (new j = 1; j <= g_iMaxClients; j++)
  51.     {
  52.         for (new i = 0; i < MAX_EXTRA_ITEMS; i++)
  53.         {
  54.             g_iLimitCounter[j][i] = 0
  55.         }
  56.     }
  57. }

Re: Why would this happen?

Posted: 21 Sep 2018, 12:38
by Raheem
Item caused this.

Re: Why would this happen?

Posted: 21 Sep 2018, 13:33
by Mark
Raheem wrote: 5 years agoItem caused this.
Item like the extra item is doing this?

Re: Why would this happen?

Posted: 21 Sep 2018, 14:32
by Raheem
I'm telling you to post an item which caused this for you. I need to know how can i reproduce this bug so if it's bug in Mod to be fixed.

Re: Why would this happen?

Posted: 21 Sep 2018, 14:56
by Mark
oh

  1. #include < zombie_escape >
  2. #include < fakemeta >
  3.  
  4.  
  5. #define PLUGIN      "[ZP] Extra Item: Jump Bomb"
  6. #define VERSION     "1.0"
  7. #define AUTHOR      "Opo4uMapy"
  8.  
  9. native cs_get_user_bpammo(index, weapon)
  10. native cs_set_user_bpammo(index, weapon, amount)
  11.  
  12. #define JUMPBOMB_ID     55556
  13.  
  14. /////////////////////////////////////Cvars/////////////////////////////////////
  15.  
  16. #define RADIUS          300.0       // Radius of explosion
  17. #define JUMP_DAMAGE     200      // Damage
  18. #define JUMP_EXP        1000.0       // Grenade recoil force  
  19.  
  20. #define GRENADE_ICON                //Иконка с лева. Что бы отключить поставьте //
  21.  
  22. #define BUY_GRENADE_MSG     "[ZP] You bought a jumping grenade"
  23. #define MAX_GRENADE_MSG     "[ZP] You are at the max!"
  24.  
  25. #define TRAIL       //Трайл за гранатой. Что бы отключить закоментируем ( //#define TRAIL )
  26.  
  27. /////////////////////////////////////WeaponList/////////////////////////////////////
  28.  
  29. #define WEAPONLIST  // WeaponList. Что бы отключить закоментируем ( //#define WEAPONLIST )
  30.  
  31. #define WEAPON_DEFAULT      "weapon_smokegrenade"   //Weapon под которую сделана граната
  32. #define DEFAULT_CSW     CSW_SMOKEGRENADE    //CSW под которую сделана граната
  33.  
  34.  
  35. #define WEAPON_NEW      "weapon_zombj1_sisa"    //Название WeaponList'a новой гранаты
  36.  
  37. new const WeaponList_Sprite[][] =
  38. {
  39.     "sprites/weapon_zombj1_sisa.txt",
  40.     "sprites/640hud61.spr",
  41.     "sprites/640hud7x.spr"
  42. }
  43.  
  44. enum
  45. {
  46.     prim_ammoid         = 13,
  47.     prim_ammomaxamount  = 1,
  48.     sec_ammoid      = -1,
  49.     sec_ammomaxamount   = -1,
  50.     slotid          = 3,
  51.     number_in_slot      = 3,
  52.     weaponid        = 9,
  53.     flags           = 24
  54. }
  55.  
  56.  
  57. ////////////////////////////////////////////////////////////////////////////////////
  58.  
  59. // Модели гранаты
  60. new const BOMB_MODEL[][] =
  61. {
  62.     "models/v_zombibomb.mdl",
  63.     "models/p_zombibomb.mdl",
  64.     "models/w_zombibomb.mdl"
  65. }
  66.  
  67. //Звуки покупки
  68. #define g_SoundGrenadeBuy   "items/gunpickup2.wav"
  69. #define g_SoundAmmoPurchase "items/9mmclip1.wav"
  70.    
  71. //Звук взрыва
  72. #define g_SoundBombExplode  "nst_zombie/zombi_bomb_exp.wav"
  73.  
  74. //Не изменять! Звуки прописаны в модели.
  75. new const frogbomb_sound[][] =
  76. {
  77.     "nst_zombie/zombi_bomb_pull_1.wav",
  78.     "nst_zombie/zombi_bomb_deploy.wav",
  79.     "nst_zombie/zombi_bomb_throw.wav"
  80. }
  81.  
  82. new const frogbomb_sound_idle[][] =
  83. {
  84.     "nst_zombie/zombi_bomb_idle_1.wav",
  85.     "nst_zombie/zombi_bomb_idle_2.wav",
  86.     "nst_zombie/zombi_bomb_idle_3.wav",
  87.     "nst_zombie/zombi_bomb_idle_4.wav"
  88. }
  89. new g_itemid
  90.  
  91. new g_JumpGrenadeCount[33], g_iExplo
  92.  
  93. new g_trailSpr
  94.  
  95. new grenade_icons[33][32]
  96.  
  97.  
  98. public plugin_precache()
  99. {
  100.     static i
  101.  
  102.     for(i = 0; i < sizeof BOMB_MODEL; i++)
  103.         precache_model(BOMB_MODEL[i])
  104.  
  105.     for(i = 0; i < sizeof frogbomb_sound; i++)
  106.         precache_sound(frogbomb_sound[i])
  107.  
  108.     for(i = 0; i < sizeof frogbomb_sound_idle; i++)
  109.         precache_sound(frogbomb_sound_idle[i])
  110.  
  111.     precache_sound(g_SoundGrenadeBuy)
  112.     precache_sound(g_SoundAmmoPurchase)
  113.     precache_sound(g_SoundBombExplode)
  114.  
  115.  
  116.     register_clcmd(WEAPON_NEW, "hook")
  117.  
  118.     for(i = 0; i < sizeof WeaponList_Sprite; i++)
  119.         precache_generic(WeaponList_Sprite[i])
  120.  
  121.  
  122.  
  123.     g_iExplo = precache_model("sprites/zombiebomb_exp.spr")
  124.  
  125.  
  126.     g_trailSpr = precache_model("sprites/laserbeam.spr")
  127.  
  128. }
  129.  
  130. public plugin_init()
  131. {
  132.     register_plugin(PLUGIN, VERSION, AUTHOR)
  133.  
  134.     //Ham
  135.     RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
  136.     RegisterHam(Ham_Item_Deploy, WEAPON_DEFAULT, "DeployPost", 1)
  137.  
  138.     //Forward
  139.     register_forward(FM_SetModel, "fw_SetModel")
  140.  
  141.     //Event
  142.     register_event("DeathMsg", "DeathMsg", "a")
  143.  
  144.  
  145.     register_event("CurWeapon", "grenade_icon", "be", "1=1")
  146.  
  147.  
  148.     //Extra Item
  149.     g_itemid = ze_register_item("Jump Grenade", 100, 0)
  150.  
  151. }
  152.  
  153.  
  154. public hook(id)
  155. {
  156.     if(!is_user_connected(id))
  157.         return PLUGIN_CONTINUE
  158.        
  159.     engclient_cmd(id, WEAPON_DEFAULT)
  160.    
  161.     return PLUGIN_HANDLED
  162. }
  163.  
  164.  
  165. public ze_select_item_pre(id, itemid)
  166. {
  167.     // Return Available and we will block it in Post, So it dosen't affect other plugins
  168.     if (itemid != g_itemid)
  169.         return ZE_ITEM_AVAILABLE
  170.    
  171.     // Available for Zombies only, So don't show it for Humans
  172.     if (!ze_is_user_zombie(id))
  173.         return ZE_ITEM_DONT_SHOW
  174.    
  175.     return ZE_ITEM_AVAILABLE
  176. }
  177.  
  178. public ze_select_item_post(id, itemid)
  179. {
  180.     if(itemid == g_itemid)
  181.     {
  182.         new Ammo = cs_get_user_bpammo(id, DEFAULT_CSW)
  183.         if(g_JumpGrenadeCount[id] >= 1)
  184.         {
  185.             cs_set_user_bpammo(id, DEFAULT_CSW, Ammo + 1)
  186.             emit_sound(id, CHAN_ITEM, g_SoundAmmoPurchase, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  187.             g_JumpGrenadeCount[id]++
  188.         }
  189.         else
  190.         {
  191.             fm_give_item(id, WEAPON_DEFAULT)
  192.             client_print(id, print_chat, "%s", BUY_GRENADE_MSG)
  193.             emit_sound(id, CHAN_ITEM, g_SoundGrenadeBuy, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  194.             g_JumpGrenadeCount[id] = 1
  195.         }
  196.  
  197.         AmmoPickup(id)
  198.         WeaponList(id, 1)
  199.     }
  200.     return PLUGIN_HANDLED
  201. }
  202.  
  203. public ze_user_humanized(id)
  204. {
  205.     g_JumpGrenadeCount[id] = 0
  206.     WeaponList(id, 0)
  207. }
  208.  
  209. public DeployPost(entity)
  210. {
  211.     static id
  212.     id = get_pdata_cbase(entity, 41, 4)
  213.  
  214.     if(!is_user_alive(id) || !ze_is_user_zombie(id))
  215.         return PLUGIN_CONTINUE
  216.  
  217.     set_pev(id, pev_viewmodel2, BOMB_MODEL[0])
  218.     set_pev(id, pev_weaponmodel2, BOMB_MODEL[1])
  219.  
  220.     return PLUGIN_CONTINUE
  221. }
  222.  
  223. public fw_SetModel(Entity, const Model[])
  224. {
  225.     if (Entity < 0)
  226.         return FMRES_IGNORED
  227.  
  228.     if (pev(Entity, pev_dmgtime) == 0.0)
  229.         return FMRES_IGNORED
  230.  
  231.     new iOwner = pev(Entity, pev_owner)
  232.  
  233.     if(!ze_is_user_zombie(iOwner))
  234.         return FMRES_IGNORED
  235.            
  236.     if(g_JumpGrenadeCount[iOwner] >= 1 && equal(Model[7], "w_sm", 4))
  237.     {
  238.         g_JumpGrenadeCount[iOwner]--
  239.  
  240.         set_pev(Entity, pev_flTimeStepSound, JUMPBOMB_ID)
  241.         set_pev(Entity, pev_body, 23)
  242.  
  243.         fm_set_rendering(Entity, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 16)
  244.  
  245.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  246.         write_byte(TE_BEAMFOLLOW)
  247.         write_short(Entity)         // entity
  248.         write_short(g_trailSpr)     // sprite
  249.         write_byte(2)           // life
  250.         write_byte(5)           // width
  251.         write_byte(0)           // r
  252.         write_byte(200)         // g
  253.         write_byte(0)           // b
  254.         write_byte(200)         // brightness
  255.         message_end()
  256.  
  257.         engfunc(EngFunc_SetModel, Entity, BOMB_MODEL[2])
  258.  
  259.         return FMRES_SUPERCEDE    
  260.     }
  261.     return FMRES_IGNORED
  262. }
  263.  
  264. public fw_ThinkGrenade(Entity)
  265. {
  266.     if(!pev_valid(Entity))
  267.         return HAM_IGNORED
  268.        
  269.     static Float:dmg_time
  270.     pev(Entity, pev_dmgtime, dmg_time)
  271.        
  272.     if(dmg_time > get_gametime())
  273.         return HAM_IGNORED
  274.        
  275.     if(pev(Entity, pev_flTimeStepSound) == JUMPBOMB_ID)
  276.     {
  277.         JumpBombExplode(Entity)
  278.         return HAM_SUPERCEDE
  279.     }
  280.     return HAM_IGNORED
  281. }
  282.  
  283. public JumpBombExplode(Entity)
  284. {
  285.     if(Entity < 0)
  286.         return
  287.        
  288.     static Float:Origin[3]
  289.     pev(Entity, pev_origin, Origin)
  290.  
  291.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
  292.     write_byte(TE_SPRITE)
  293.     engfunc(EngFunc_WriteCoord, Origin[0])
  294.     engfunc(EngFunc_WriteCoord, Origin[1])
  295.     engfunc(EngFunc_WriteCoord, Origin[2] + 45.0)
  296.     write_short(g_iExplo)
  297.     write_byte(35)
  298.     write_byte(186)
  299.     message_end()
  300.            
  301.     emit_sound(Entity, CHAN_WEAPON, g_SoundBombExplode, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  302.      
  303.     for(new victim = 1; victim <= get_maxplayers(); victim++)
  304.     {
  305.         if (!is_user_alive(victim))
  306.             continue
  307.                  
  308.         new Float:VictimOrigin[3]
  309.         pev(victim, pev_origin, VictimOrigin)
  310.                    
  311.         new Float:Distance = get_distance_f(Origin, VictimOrigin)  
  312.                    
  313.         if(Distance <= RADIUS)
  314.         {
  315.             static Float:NewSpeed
  316.  
  317.             NewSpeed = JUMP_EXP * (1.0 - (Distance / RADIUS))
  318.                            
  319.             static Float:Velocity[3]
  320.             get_speed_vector(Origin, VictimOrigin, NewSpeed, Velocity)
  321.                            
  322.             set_pev(victim, pev_velocity, Velocity)
  323.            
  324.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"), _, victim)
  325.             write_short(1<<12 * 10)      
  326.             write_short(1<<12 * 10)
  327.             write_short(1<<12 * 10)
  328.             message_end()
  329.  
  330.             if(ze_is_user_zombie(victim))
  331.                 set_user_takedamage(victim, JUMP_DAMAGE)
  332.  
  333.         }
  334.     }
  335.     engfunc(EngFunc_RemoveEntity, Entity)
  336. }      
  337.  
  338. public grenade_icon(id)
  339. {
  340.     remove_grenade_icon(id)
  341.        
  342.     if(is_user_bot(id))
  343.         return
  344.  
  345.     static igrenade, grenade_sprite[16], grenade_color[3]
  346.     igrenade = get_user_weapon(id)
  347.    
  348.     switch(igrenade)
  349.     {
  350.         case DEFAULT_CSW:
  351.         {
  352.             if(!is_user_alive(id) || ze_is_user_zombie(id))
  353.             {
  354.                 grenade_sprite = "dmg_gas"
  355.                 grenade_color = {255, 165, 0}
  356.             }
  357.             else
  358.             {
  359.                 grenade_sprite = ""
  360.                 grenade_color = {0, 0, 0}
  361.             }
  362.         }
  363.         default: return
  364.     }
  365.     grenade_icons[id] = grenade_sprite
  366.    
  367.     message_begin(MSG_ONE, get_user_msgid("StatusIcon"),{0, 0, 0}, id)
  368.     write_byte(1)
  369.     write_string(grenade_icons[id])
  370.     write_byte(grenade_color[0])
  371.     write_byte(grenade_color[1])
  372.     write_byte(grenade_color[2])
  373.     message_end()
  374.  
  375.     return
  376. }
  377.  
  378. public ze_roundend()
  379. {
  380.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  381.     {
  382.         if(!is_user_alive(id) || !ze_is_user_zombie(id))
  383.             continue
  384.  
  385.         ham_strip_weapon(id, WEAPON_DEFAULT)
  386.         g_JumpGrenadeCount[id] = 0
  387.     }
  388. }
  389.  
  390. public DeathMsg()
  391. {
  392.     new attacker = read_data(1)
  393.     new victim = read_data(2)
  394.  
  395.     if(!is_user_connected(attacker))
  396.         return HAM_IGNORED
  397.  
  398.     if(victim == attacker || !victim)
  399.         return HAM_IGNORED
  400.  
  401.     if(!ze_is_user_zombie(victim))
  402.         return HAM_IGNORED
  403.  
  404.     remove_grenade_icon(victim)
  405.  
  406.     WeaponList(victim, 0)
  407.  
  408.     g_JumpGrenadeCount[victim] = 0
  409.  
  410.     return HAM_HANDLED
  411. }
  412.  
  413. public client_connect(id) g_JumpGrenadeCount[id] = 0
  414.  
  415. WeaponList(index, mode = 0)
  416. {
  417.     if (!is_user_connected(index))
  418.         return
  419.    
  420.     message_begin(MSG_ONE, get_user_msgid("WeaponList"), {0, 0, 0}, index)
  421.     write_string(mode ? WEAPON_NEW : WEAPON_DEFAULT)
  422.     write_byte(prim_ammoid)
  423.     write_byte(prim_ammomaxamount)
  424.     write_byte(sec_ammoid)
  425.     write_byte(sec_ammomaxamount)
  426.     write_byte(slotid)
  427.     write_byte(number_in_slot)
  428.     write_byte(weaponid)
  429.     write_byte(flags)
  430.     message_end()
  431. }
  432.  
  433. static remove_grenade_icon(index)
  434. {
  435.     message_begin(MSG_ONE, get_user_msgid("StatusIcon"), {0, 0, 0}, index)
  436.     write_byte(0)
  437.     write_string(grenade_icons[index])
  438.     message_end()
  439. }
  440.  
  441.  
  442. stock set_user_takedamage(index, damage)
  443. {
  444.     if(!is_user_alive(index))
  445.         return
  446.  
  447.     new vec[3]
  448.     FVecIVec(get_target_origin_f(index), vec)
  449.  
  450.     message_begin(MSG_ONE, get_user_msgid("Damage"), _, index)
  451.     write_byte(0)
  452.     write_byte(damage)
  453.     write_long(DMG_CRUSH)
  454.     write_coord(vec[0])
  455.     write_coord(vec[1])
  456.     write_coord(vec[2])
  457.     message_end()
  458.  
  459.     if(pev(index, pev_health) - 20.0 <= 0)
  460.         ExecuteHamB(Ham_Killed, index, index, 1)
  461.     else ExecuteHamB(Ham_TakeDamage, index, 0, index, float(damage), DMG_BLAST)
  462. }
  463.  
  464. stock AmmoPickup(index)
  465. {
  466.     message_begin(MSG_ONE, get_user_msgid("AmmoPickup"), _, index)
  467.     write_byte(13)
  468.     write_byte(1)
  469.     message_end()
  470. }
  471.  
  472. stock Float:get_target_origin_f(index)
  473. {
  474.     new Float:orig[3]
  475.     pev(index, pev_origin, orig)
  476.  
  477.     if(index > get_maxplayers())
  478.     {
  479.         new Float:mins[3], Float:maxs[3]
  480.         pev(index, pev_mins, mins)
  481.         pev(index, pev_maxs, maxs)
  482.        
  483.         if(!mins[2]) orig[2] += maxs[2] / 2
  484.     }
  485.     return orig
  486. }
  487.  
  488. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  489. {
  490.     new_velocity[0] = origin2[0] - origin1[0]
  491.     new_velocity[1] = origin2[1] - origin1[1]
  492.     new_velocity[2] = origin2[2] - origin1[2]
  493.     new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  494.     new_velocity[0] *= num
  495.     new_velocity[1] *= num
  496.     new_velocity[2] *= num
  497.  
  498.     return 1
  499. }
  500.  
  501. stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
  502. {
  503.     new Float:RenderColor[3]
  504.     RenderColor[0] = float(r)
  505.     RenderColor[1] = float(g)
  506.     RenderColor[2] = float(b)
  507.  
  508.     set_pev(entity, pev_renderfx, fx)
  509.     set_pev(entity, pev_rendercolor, RenderColor)
  510.     set_pev(entity, pev_rendermode, render)
  511.     set_pev(entity, pev_renderamt, float(amount))
  512.  
  513.     return 1
  514. }
  515.  
  516. stock fm_give_item(index, const item[])
  517. {
  518.     if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5))
  519.         return 0
  520.  
  521.     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
  522.     if (!pev_valid(ent))
  523.         return 0
  524.  
  525.     new Float:origin[3]
  526.     pev(index, pev_origin, origin)
  527.     set_pev(ent, pev_origin, origin)
  528.     set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
  529.     dllfunc(DLLFunc_Spawn, ent)
  530.  
  531.     new save = pev(ent, pev_solid)
  532.     dllfunc(DLLFunc_Touch, ent, index)
  533.     if (pev(ent, pev_solid) != save)
  534.         return ent
  535.  
  536.     engfunc(EngFunc_RemoveEntity, ent)
  537.  
  538.     return -1
  539. }
  540.  
  541. stock ham_strip_weapon(index, weapon[])
  542. {
  543.     if(!equal(weapon, "weapon_", 7))
  544.     return 0
  545.  
  546.     new wId = get_weaponid(weapon)
  547.     if(!wId) return 0
  548.  
  549.     new wEnt
  550.     while((wEnt = engfunc(EngFunc_FindEntityByString, wEnt, "classname", weapon)) && pev(wEnt,pev_owner) != index) {}
  551.  
  552.     if(!wEnt)
  553.     return 0
  554.  
  555.     if(get_user_weapon(index) == wId)
  556.     ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
  557.  
  558.     if(!ExecuteHamB(Ham_RemovePlayerItem, index, wEnt))
  559.     return 0
  560.  
  561.     ExecuteHamB(Ham_Item_Kill, wEnt)
  562.  
  563.     set_pev(index, pev_weapons, pev(index, pev_weapons) & ~(1<<wId))
  564.  
  565.     return 1
  566. }

  1. #include <zombie_escape>
  2. #include <cstrike>
  3. #include <engine>
  4. #include <fun>
  5.  
  6.  
  7. #define Plugin    "[ZE] Knockback Bomb"
  8. #define Version   "1.0"
  9. #define Author    "0"
  10.  
  11. // === Customization starts below! ===
  12. new const g_PlayerModel [ ] = "models/zombie_escape/p_grenade_knock.mdl"
  13. new const g_ViewModel [ ] = "models/zombie_escape/v_grenade_knockback.mdl"
  14. new const g_WorldModel [ ] = "models/zombie_escape/w_grenade_knock.mdl"
  15.  
  16. // You can add more than 1 sound!
  17. new const g_SoundGrenadeBuy [ ] [ ] = { "items/gunpickup2.wav" }
  18. new const g_SoundAmmoPurchase [ ] [ ] = { "items/9mmclip1.wav" }
  19. new const g_SoundBombExplode [ ] [ ] = { "zombie_escape/grenade_infect.wav" }
  20.  
  21. #define MAXCARRY    4 // How many grenades 1 player can hold at the same time
  22. #define RADIUS        500.0 // Affect radius
  23. // === Customization ends above! ===
  24.  
  25. #define MAXPLAYERS        32
  26. #define pev_nade_type        pev_flTimeStepSound
  27. #define NADE_TYPE_JUMPING    26517
  28. #define AMMOID_SM        13
  29.  
  30. new g_iExplo
  31.  
  32. new g_iNadeID
  33.  
  34. new g_iKnockbackNadeCount [ MAXPLAYERS+1 ]
  35. new g_iCurrentWeapon [ MAXPLAYERS+1 ]
  36.  
  37. new cvar_speed
  38.  
  39. new g_MaxPlayers
  40. new g_msgAmmoPickup
  41.  
  42. public plugin_precache ( )
  43. {
  44.     precache_model ( g_PlayerModel )
  45.     precache_model ( g_ViewModel )
  46.     precache_model ( g_WorldModel )
  47.    
  48.     new i
  49.     for ( i = 0; i < sizeof g_SoundGrenadeBuy; i++ )
  50.         precache_sound ( g_SoundGrenadeBuy [ i ] )
  51.     for ( i = 0; i < sizeof g_SoundAmmoPurchase; i++ )
  52.         precache_sound ( g_SoundAmmoPurchase [ i ] )
  53.     for ( i = 0; i < sizeof g_SoundBombExplode; i++ )
  54.         precache_sound ( g_SoundBombExplode [ i ] )
  55.    
  56.     g_iExplo = precache_model ( "sprites/xfire.spr" )
  57. }
  58.  
  59. public plugin_init ( )
  60. {
  61.     register_plugin ( Plugin, Version, Author )
  62.    
  63.     g_iNadeID = ze_register_item("Knockback Bomb", 30, 0)
  64.    
  65.  
  66.     register_event ( "CurWeapon", "EV_CurWeapon", "be", "1=1" )
  67.     register_event ( "HLTV", "EV_NewRound", "a", "1=0", "2=0" )
  68.     register_event ( "DeathMsg", "EV_DeathMsg", "a" )
  69.    
  70.     register_forward ( FM_SetModel, "fw_SetModel" )
  71.     RegisterHam ( Ham_Think, "grenade", "fw_ThinkGrenade" )
  72.    
  73.     cvar_speed = register_cvar ( "ze_zombiebomb_knockback", "800" )
  74.    
  75.     g_msgAmmoPickup = get_user_msgid ( "AmmoPickup" )
  76.    
  77.     g_MaxPlayers = get_maxplayers ( )
  78. }
  79.  
  80. public client_connect ( Player )
  81. {
  82.     g_iKnockbackNadeCount [ Player ] = 0
  83. }
  84.  
  85. public ze_select_item_pre(id, itemid)
  86. {
  87.     // Return Available and we will block it in Post, So it dosen't affect other plugins
  88.     if (itemid != g_iNadeID)
  89.         return ZE_ITEM_AVAILABLE
  90.    
  91.     // Available for Zombies only, So don't show it for Humans
  92.     if (!ze_is_user_zombie(id))
  93.         return ZE_ITEM_DONT_SHOW
  94.    
  95.     return ZE_ITEM_AVAILABLE
  96. }
  97.  
  98. public ze_select_item_post(id, itemid)
  99. {
  100.     if (itemid != g_iNadeID)
  101.         return
  102.    
  103.     if (g_iKnockbackNadeCount [ id ] >= MAXCARRY)
  104.     {
  105.         ze_colored_print(id, "!tCannot hold more grenades!y!")
  106.     }
  107.     else if (g_iKnockbackNadeCount [ id ] >= 1)
  108.     {
  109.         new iBpAmmo = cs_get_user_bpammo ( id, CSW_SMOKEGRENADE )
  110.         cs_set_user_bpammo ( id, CSW_SMOKEGRENADE, iBpAmmo+1 )
  111.         emit_sound ( id, CHAN_ITEM, g_SoundAmmoPurchase[random_num(0, sizeof g_SoundAmmoPurchase-1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
  112.         AmmoPickup ( id, AMMOID_SM, 1 )
  113.         g_iKnockbackNadeCount [ id ]++
  114.     }
  115.     else if (g_iKnockbackNadeCount [ id ] == 0)
  116.     {
  117.         give_item ( id, "weapon_smokegrenade" )
  118.         emit_sound ( id, CHAN_ITEM, g_SoundGrenadeBuy[random_num(0, sizeof g_SoundGrenadeBuy-1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
  119.         AmmoPickup ( id, AMMOID_SM, 1 )
  120.         g_iKnockbackNadeCount [ id ] = 1
  121.     }
  122. }
  123.  
  124. public ze_user_infected (Player, Infector)
  125. {
  126.     g_iKnockbackNadeCount [ Player ] = 0        
  127. }
  128.  
  129. public EV_CurWeapon ( Player )
  130. {
  131.     if ( !is_user_alive ( Player ) || !ze_is_user_zombie ( Player ) )
  132.         return PLUGIN_CONTINUE
  133.    
  134.     g_iCurrentWeapon [ Player ] = read_data ( 2 )
  135.    
  136.     if ( g_iKnockbackNadeCount [ Player ] > 0 && g_iCurrentWeapon [ Player ] == CSW_SMOKEGRENADE )
  137.     {
  138.         set_pev ( Player, pev_viewmodel2, g_ViewModel )
  139.         set_pev ( Player, pev_weaponmodel2, g_WorldModel )
  140.     }
  141.    
  142.     return PLUGIN_CONTINUE
  143. }
  144.  
  145. public EV_NewRound ( )
  146. {
  147.     arrayset ( g_iKnockbackNadeCount, 0, 33 )
  148. }
  149.  
  150. public EV_DeathMsg ( )
  151. {
  152.     new iVictim = read_data ( 2 )
  153.    
  154.     if ( !is_user_connected ( iVictim ) )
  155.         return
  156.    
  157.     g_iKnockbackNadeCount [ iVictim ] = 0
  158. }
  159.  
  160. public fw_SetModel ( Entity, const Model [ ] )
  161. {
  162.     if ( Entity < 0 )
  163.         return FMRES_IGNORED
  164.    
  165.     if ( pev ( Entity, pev_dmgtime ) == 0.0 )
  166.         return FMRES_IGNORED
  167.    
  168.     new iOwner = entity_get_edict ( Entity, EV_ENT_owner )    
  169.    
  170.     if ( g_iKnockbackNadeCount [ iOwner ] >= 1 && equal ( Model [ 7 ], "w_sm", 4 ) )
  171.     {
  172.         // Reset any other nade
  173.         set_pev ( Entity, pev_nade_type, 0 )
  174.        
  175.         set_pev ( Entity, pev_nade_type, NADE_TYPE_JUMPING )
  176.        
  177.         g_iKnockbackNadeCount [ iOwner ]--
  178.        
  179.         entity_set_model ( Entity, g_WorldModel )
  180.         return FMRES_SUPERCEDE
  181.     }
  182.     return FMRES_IGNORED
  183. }
  184.  
  185. public fw_ThinkGrenade ( Entity )
  186. {
  187.     if ( !pev_valid ( Entity ) )
  188.         return HAM_IGNORED
  189.    
  190.     static Float:dmg_time
  191.     pev ( Entity, pev_dmgtime, dmg_time )
  192.    
  193.     if ( dmg_time > get_gametime ( ) )
  194.         return HAM_IGNORED
  195.    
  196.     if ( pev ( Entity, pev_nade_type ) == NADE_TYPE_JUMPING )
  197.     {
  198.         jumping_explode ( Entity )
  199.         return HAM_SUPERCEDE
  200.     }
  201.     return HAM_IGNORED
  202. }
  203.  
  204. public jumping_explode ( Entity )
  205. {
  206.     if ( Entity < 0 )
  207.         return
  208.    
  209.     static Float:flOrigin [ 3 ]
  210.     pev ( Entity, pev_origin, flOrigin )
  211.    
  212.     engfunc ( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flOrigin, 0 )
  213.     write_byte ( TE_SPRITE )
  214.     engfunc ( EngFunc_WriteCoord, flOrigin [ 0 ] )
  215.     engfunc ( EngFunc_WriteCoord, flOrigin [ 1 ] )
  216.     engfunc ( EngFunc_WriteCoord, flOrigin [ 2 ] + 45.0 )
  217.     write_short ( g_iExplo )
  218.     write_byte ( 35 )
  219.     write_byte ( 186 )
  220.     message_end ( )
  221.    
  222.    
  223.     emit_sound ( Entity, CHAN_WEAPON, g_SoundBombExplode[random_num(0, sizeof g_SoundBombExplode-1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
  224.    
  225.     for ( new i = 1; i < g_MaxPlayers; i++ )
  226.     {
  227.         if ( !is_user_alive  ( i ) )
  228.             continue
  229.        
  230.  
  231.        
  232.         // Debug!
  233.         //client_print ( iOwner, print_chat, "Owner of Smoke Grenade!" )    
  234.        
  235.         new Float:flVictimOrigin [ 3 ]
  236.         pev ( i, pev_origin, flVictimOrigin )
  237.        
  238.         new Float:flDistance = get_distance_f ( flOrigin, flVictimOrigin )    
  239.        
  240.         if ( flDistance <= RADIUS )
  241.         {
  242.             static Float:flSpeed
  243.             flSpeed = get_pcvar_float ( cvar_speed )
  244.            
  245.             static Float:flNewSpeed
  246.             flNewSpeed = flSpeed * ( 1.5 - ( flDistance / RADIUS ) )
  247.            
  248.             static Float:flVelocity [ 3 ]
  249.             get_speed_vector ( flOrigin, flVictimOrigin, flNewSpeed, flVelocity )
  250.            
  251.             set_pev ( i, pev_velocity,flVelocity )
  252.         }
  253.     }
  254.    
  255.     engfunc ( EngFunc_RemoveEntity, Entity )
  256. }        
  257.  
  258. public AmmoPickup ( Player, AmmoID, AmmoAmount )
  259. {
  260.     message_begin ( MSG_ONE, g_msgAmmoPickup, _, Player )
  261.     write_byte ( AmmoID )
  262.     write_byte ( AmmoAmount )
  263.     message_end ( )
  264. }
  265.  
  266. stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  267. {
  268.     new_velocity[0] = origin2[0] - origin1[0]
  269.     new_velocity[1] = origin2[1] - origin1[1]
  270.     new_velocity[2] = origin2[2] - origin1[2]
  271.     new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  272.     new_velocity[0] *= num
  273.     new_velocity[1] *= num
  274.     new_velocity[2] *= num
  275.    
  276.     return 1;
  277. }

Re: Why would this happen?

Posted: 21 Sep 2018, 15:23
by Raheem
Explain how can i get what in photo? What you did so you got it? I'll try test with my items.

Re: Why would this happen?

Posted: 21 Sep 2018, 15:47
by Mark
Raheem wrote: 5 years ago Explain how can i get what in photo? What you did so you got it? I'll try test with my items.
just added limits and set item discount

Re: Why would this happen?

Posted: 21 Sep 2018, 20:43
by Raheem
Right this will happen if the extra-text exceed it's limit in ze_items_manager.sma --> g_szAdditionalMenuText[32].

So you can fix this simply by increasing this array size like --> g_szAdditionalMenuText[128].

Maybe i'll increase this limit on github to higher value i'll make it --> g_szAdditionalMenuText[64], just doubled.

Check: https://github.com/raheem-cs/Zombie-Esc ... cde16e7085

Re: Why would this happen?

Posted: 21 Sep 2018, 21:39
by Mark
Raheem wrote: 5 years ago Right this will happen if the extra-text exceed it's limit in ze_items_manager.sma --> g_szAdditionalMenuText[32].

So you can fix this simply by increasing this array size like --> g_szAdditionalMenuText[128].

Maybe i'll increase this limit on github to higher value i'll make it --> g_szAdditionalMenuText[64], just doubled.

Check: https://github.com/raheem-cs/Zombie-Esc ... cde16e7085
Yep fixed thanks!

Re: Why would this happen?

Posted: 22 Sep 2018, 01:36
by Night Fury
Can someone tell me what the problem is because I only see 4 huds with an opened menu

Re: Why would this happen?

Posted: 22 Sep 2018, 02:19
by Mark
Jack GamePlay wrote: 5 years ago Can someone tell me what the problem is because I only see 4 huds with an opened menu
what lol

Re: Why would this happen?

Posted: 23 Sep 2018, 10:10
by Raheem
[mention]Jack GamePlay[/mention], see this photo:
  • bug.jpg

Re: Why would this happen?

Posted: 09 Oct 2018, 18:39
by Spir0x
What's the (30 % OFF) where is this plugin

Re: Why would this happen?

Posted: 10 Oct 2018, 08:18
by Night Fury
Spir0x wrote: 5 years ago What's the (30 % OFF) where is this plugin
viewtopic.php?f=17&t=3431