Help

Unpaid Requests, Public Plugins
Post Reply
Rain1153
Senior Member
Senior Member
India
Posts: 278
Joined: 6 years ago
Contact:

Help

#1

Post by Rain1153 » 5 years ago

LOL

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#2

Post by Night Fury » 5 years ago

I don't advice you to use this plugin as it's badly & heavily coded.

Try:
  1. /*
  2. *   ---------------------------------------------------------------------------------------------------------
  3. *   ------------------------------------[ZP] Zombie Class: Smoker--------------------------------------------
  4. *   ---------------------------------------------------------------------------------------------------------
  5. *   ------------------------------------Author: SNAKER_BEATTER-----------------------------------------------
  6. *   ---------------------------------------------------------------------------------------------------------
  7. *               About:
  8. *       When Left4Dead2 i watched in youtube and i found smoker. I dont get hes command but when i played
  9. *       it, He drags players using hes long tongue, like a real monster that attacks pregnant mothers...
  10. *       like from L4D2 when have to many damage long tongue ends
  11. *   ---------------------------------------------------------------------------------------------------------
  12. *               Description:
  13. *       Smoker is a zombie class for zombie plague 4.3 or later version. Like from L4D2 smoker can drag
  14. *       players by he's long tongue, After a long tongue use a cooldown starts, when take 500 damage
  15. *       long tongue is off and if falls with 50 damage long tongue is off too... you can use it on zombies
  16.         too(bug)
  17. *           You can use tha command with 'E' key (such as USE key) and when fall with 50 damage
  18. *           smoke release and if damaged 100 release smokes
  19. *           you and you're long tongue's target will be 3rdperson view and a hudmessage will show
  20. *           if you're zombie and not smoker you cant do anything
  21. *           if the cooldown starts the thirdpeson view sets to firstperson
  22. *
  23. *           Well green smokes from 1.4 version is not good and not like smokes so i change it
  24. *   ---------------------------------------------------------------------------------------------------------
  25. *               Credits:
  26. *       L4D2 (game) - the very original zombie smoker
  27. *   ---------------------------------------------------------------------------------------------------------
  28. *               Cvars:
  29. *       Their are no new cvar than the old version
  30. *       zp_smoker_tongue_max // how many times Smoker can use long tongue? default=999
  31. *       zp_smoker_tongue_speed // speed of long tongue default=250
  32. *       zp_smoker_tongue_cooldown // time in seconds before you can use long tongue again. default=15
  33. *       zp_smoker_tongue_stop_damage // damage to stop using long tongue set 0 to disable it. default=300
  34. *       zp_smoker_tongue_stop_damage_fall // damage to stop usng long tongue(only if falls) set 0 to disable it. default=50
  35. *       zp_smoker_tongue_infecthook // additional hooks after Smoker infects smb. def=5
  36. *       zp_smoker_tongue_unable_move // 0=human & Smoker can move / 1=unable human to move when dragging / 2=unable Smoker to move / 3=unable both
  37. *       zp_smoker_tongue_reward .// How many reward gives to smoker when used long tongue to any. default=2
  38. *       zp_smoker_tongue_target_zombie // Allow/disallow using long tongue to zombies / 1=enable for all zombies / 2=Only to smokers
  39. *       zp_smoker_smoke_damage_by_player // how many damage by player should smoke release smokes. default=5
  40. *       zp_smoker_smoke_damage_by_fall // how many damage by fall should smoke release. default=5
  41. *       zp_smoker_smoke_death_distance // Smoke death distance
  42. *       zp_smoker_smoke_death_blind // Smoke death set smoked all users around you're death body
  43. *       zp_smoker_smoke_death_glow // Glow all you're death smoke victims
  44. *
  45. *   ----------------------------------------------------------------------------------------------------------
  46. *               Modules:
  47. *       hamsandwich
  48. *       fakemeta
  49. *       engine
  50. *   -----------------------------------------------------------------------------------------------------------
  51. *               Change log:
  52. *       1.0 (Sept 12, 2011)
  53. *       {
  54. *           First release
  55. *       }
  56. *       1.1 (Sept 12, 2011)
  57. *       {
  58. *           smoke death function rewritten
  59. *           Fix if a human is using smoker class, when dies smoke releases
  60. *           (not sure) Fix if a survivor is using smoker class, when dies smoke releases
  61. *       }
  62. *       1.2 (Sept 16, 2011)
  63. *       {
  64. *           change autbind into e key
  65. *           Fix if a nemesis is using smoker class, when dies smoke releases
  66. *           Change print_chat on long tongue cooldown to Hudmessage
  67. *       }
  68. *       1.3 (Sept 17, 2011)
  69. *       {
  70. *           (new) thirdperson view when tongue start and firstperson when end
  71. *           (new) rewritten tongue_start function
  72. *           Fix new round human and survvor can use tongue abillity
  73. *           Fix damage smoke not working :: Now the damage tongue end and smoke damage have their own
  74. *           Fix cooldown hudmessage bug
  75. *       }
  76. *       1.4 (Sept 18, 2011)
  77. *       {
  78. *           (best) added smoke damage : hes own cvars and with custom smokes
  79. *           Smoker damage function rewritten
  80. *           Fix smoker is human he can smoke damage and if survivor and nemesis too
  81. *           Fix if player is zombie and he is not smoker he can smoke damage
  82. *       }
  83. *       1.5 (Sept 24, 2011)
  84. *       {
  85. *           Fix cooldown not working after smoker backs to human/survivor and get infected again
  86. *           Fix when cooldown is working still 3rdperson view
  87. *           Fix Floortarget's beam not working
  88. *           Fix nemesis and survivor may not be tongued
  89. *           Fix nemesis can use long tongue
  90. *           Fix survivor can release smoke death
  91. *           (best) Added bot support on smoke damage
  92. *           (bestornot) replace damage and death smokes
  93. *           (best) created my own smoker's tongue
  94. *       }
  95. *       1.6 (Sept 24, 2011 (Uploaded))
  96. *       {
  97. *           Added cfg dir
  98. *           (best) Added sounds when using long tongue
  99. *           (best) Added smoker models and v-models
  100. *           tongue_Start function rewritten
  101. *       }
  102. *       1.7 (Sept 24, 2011 (Uploaded))
  103. *       {
  104. *           (best) Added rewards when used long tongue to somebody
  105. *           (best) Added death smoke damage and block sreen every players at his radius
  106. *           Fix if zombie can smoked via death smoke command
  107. *       }
  108. *       1.8 (Sept 24, 2011 (Uploaded))
  109. *       {
  110. *           Fix nemesis can be smoked via death smoke
  111. *           Added rewards when victim somebody victimed by death smoke
  112. *           (bestornot) Removed/Fix if zombie or a nemesis is long tongued smoker rewarded
  113. *           Fix smoke death victim's smoke not working
  114. *           Wrewwritten tongue_Start function
  115. *       }
  116. *       1.9 (Sept 24, 2011 (Uploaded))
  117. *       {
  118. *           (best) Fix smoke death not working
  119. *           (best) renew sounds + smoke death sound
  120. *           Increases smoker's knockback so no need to stop damage
  121. *           Changed some humesssage mistypes
  122. *       }
  123. *       2.0 (Forgotten)
  124. *       {
  125. *            Removed some useless codes
  126. *            (best) Fix smoke death victim = after smoking hes screens turns to darky
  127. *            Changed all hudmessage to colorchat
  128. *       }
  129. *       2.1 (Oct 12, 2011 (Created))
  130. *       {
  131. *           Added cvar to allow/disallow using tongue to zombie (as requested by survival)
  132. *       }
  133. *       2.2 (Oct 13, 2011 (Uploaded))
  134. *       {
  135. *           Optomized codes
  136. *       }
  137. */
  138.  
  139. /******************************************************
  140.         [Include files]
  141. ******************************************************/
  142.  
  143. #include <zombie_escape>
  144. #include <ze_zombie_class>
  145. #include <fakemeta>
  146. #include <engine>
  147.  
  148. //IMPORTANT (install cs_ham_bots.amxx to your server)
  149.     #include <cs_ham_bots_api>
  150.  
  151. /******************************************************
  152.         [Plugin infos]
  153. ******************************************************/
  154.  
  155. #define PLUGIN "[ZP] Zombie Class Smoker"
  156. #define VERSION "2.2"
  157. #define AUTHOR "Snaker_beatter"
  158.  
  159. /******************************************************
  160.         [Id(s)]
  161. ******************************************************/
  162. //Sounds
  163. new const sound_drag[] = "barnacle/bcl_chew1.wav"
  164. new const sound_smo_die[] = "weapons/explode5.wav"
  165. //Main Class, modelT & Sprite
  166. new g_zclass_smoker, g_Tongue , g_xsmoke1 , g_xsmoke2
  167. //Some vars
  168. new g_tongued[33], g_tonguesLeft[33], g_unable2move[33]
  169. new Float:g_lastTongue[33]
  170. new bool: g_Ltongue_i[33] = false , bool: g_bind_isuse[33] = false
  171. //Cvars
  172. new cvar_tongue_speed, cvar_tongue_cooldown, cvar_tongue_stop_damage, cvar_tongue_stop_damage_fall, cvar_tongue_unb2move , cvar_tongue_start_autobind , cvar_smoke_damage_byplayer, cvar_smoke_damage_byfall , cvar_smoke_death_distance, cvar_smoke_death_blind, cvar_smoke_death_victimglow, cvar_tongue_reward,
  173. cvar_tongue_zombietarget
  174. //Smoker Atributes
  175. new const zclass_name[] = { "smoker zombie L4D2" }
  176. new const zclass_info[] = { "Long tongue & smokes" }
  177. const zclass_health = 2602
  178. const zclass_speed = 350
  179. const zclass_gravity = 800
  180. /******************************************************
  181.         [Main event] + [PLugin cfg]
  182. ******************************************************/
  183.  
  184. public plugin_init()
  185. {
  186.     cvar_tongue_speed = register_cvar("zp_smoker_tongue_speed", "250")
  187.     cvar_tongue_cooldown = register_cvar("zp_smoker_tongue_cooldown", "15")
  188.     cvar_tongue_stop_damage = register_cvar("zp_smoker_tongue_stop_damage", "250")
  189.     cvar_tongue_stop_damage_fall = register_cvar("zp_smoker_tongue_stop_damage_fall", "25")
  190.     cvar_tongue_unb2move = register_cvar("zp_smoker_tongue_unable_move", "3")
  191.     cvar_tongue_start_autobind = register_cvar("zp_smoker_autobind", "1")
  192.     cvar_tongue_reward = register_cvar("zp_smoker_tongue_reward", "2")
  193.     cvar_tongue_zombietarget = register_cvar("zp_smoker_tongue_target_zombie", "1")
  194.     cvar_smoke_damage_byfall = register_cvar("zp_smoker_smoke_damage_byfall", "1")
  195.     cvar_smoke_damage_byplayer = register_cvar("zp_smoker_smoke_damage_byplayer", "1")
  196.     cvar_smoke_death_distance = register_cvar("zp_smoker_smoke_death_distance", "180")
  197.     cvar_smoke_death_blind = register_cvar("zp_smoker_smoke_death_blind", "5")
  198.     cvar_smoke_death_victimglow = register_cvar("zp_smoker_smoke_death_glow", "1")
  199.     register_event("ResetHUD", "newSpawn", "b")
  200.     register_event("DeathMsg", "smoker_death", "a")
  201.     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  202.     RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
  203.     /* Bot support start */
  204.     //RegisterHamBots(Ham_Killed, "smoker_botdeath")
  205.     RegisterHamBots(Ham_TakeDamage, "fw_TakeDamage")
  206.     /* Bot support end */
  207.     register_clcmd("+smoker_tongue","tongue_start")
  208.     register_clcmd("-smoker_tongue","tongue_end")
  209.     plugin_cfg()
  210. }
  211.  
  212. public plugin_cfg()
  213. {
  214.     new const derectory[] = "addons/amxmodx/configs/zp_zclass_smoker.cfg"
  215.     server_cmd("exec %s", derectory)
  216. }
  217.  
  218. /******************************************************
  219.         [Precache event]
  220. ******************************************************/
  221.  
  222. public plugin_precache()
  223. {
  224.     register_plugin(PLUGIN, VERSION, AUTHOR)
  225.     g_zclass_smoker = ze_register_zombie_class(zclass_name, zclass_info, zclass_health, zclass_speed, zclass_gravity)
  226.     g_Tongue = precache_model("sprites/l4d_tongue.spr")
  227.     g_xsmoke1 = precache_model("sprites/l4d_smoke_damage.spr")
  228.     g_xsmoke2 = precache_model("sprites/l4d_smoke_death.spr")
  229.     precache_sound(sound_drag)
  230.     precache_sound(sound_smo_die)
  231. }
  232.  
  233. /****************************************************
  234.         [Events]
  235. ****************************************************/
  236.  
  237. public ze_user_infected(id)
  238. {
  239.     if (ze_get_current_zombie_class(id) == g_zclass_smoker)
  240.     {  
  241.         g_tonguesLeft[id] = 999
  242.         new bind_mode = get_pcvar_num(cvar_tongue_start_autobind)
  243.         if (bind_mode == 1)
  244.         {
  245.             g_bind_isuse[id] = true
  246.             client_print(id, print_chat, "[ZP] You can use long tongue with 'E' key")
  247.         }
  248.         else if (bind_mode == 0)
  249.         {
  250.             g_bind_isuse[id] = false
  251.             client_print(id, print_chat, "[ZP] You can use long tongue, just bind 'KEY' +tongue_start")
  252.         }
  253.     }
  254. }
  255.  
  256. public newSpawn(id)
  257. {
  258.     if (g_tongued[id])
  259.     {
  260.         tongue_end(id)
  261.     }
  262. }
  263.  
  264. public smoker_botdeath(victim, attacker, shouldgib)
  265. {  
  266. }
  267. public smoker_death() // if smoker dies drag off
  268. {
  269.     new id = read_data(2)
  270.     smoke_death(id)
  271.     beam_remove(id)
  272.    
  273.     if (g_tongued[id])
  274.         tongue_end(id)
  275. }
  276.  
  277. public fw_TakeDamage(victim, inflictor, attacker, Float:damage) // if take damage drag off
  278. {
  279.     new g_cvar_falls = get_pcvar_num(cvar_tongue_stop_damage_fall) > 0 || get_pcvar_num(cvar_smoke_damage_byfall) > 0
  280.     new g_cvar_players = get_pcvar_num(cvar_tongue_stop_damage) > 0 || get_pcvar_num(cvar_smoke_damage_byplayer) > 0
  281.        
  282.     if (ze_get_current_zombie_class(victim) == g_zclass_smoker)
  283.     {
  284.         new g_over_damage[33]
  285.         g_over_damage[victim] = g_over_damage[victim] + floatround(damage)
  286.  
  287.         if (victim == attacker || !is_user_connected(attacker) && (g_cvar_falls))
  288.         {
  289.             if (g_over_damage[victim] >= get_pcvar_num(cvar_tongue_stop_damage_fall))
  290.             {
  291.                 g_over_damage[victim] = 0
  292.                 tongue_end(victim)
  293.                 return HAM_IGNORED;
  294.             }
  295.             if (damage > get_pcvar_num(cvar_smoke_damage_byfall))
  296.             {
  297.                 g_over_damage[victim] = 0
  298.                 smoke_damage(victim)
  299.                 return HAM_IGNORED;
  300.             }
  301.         }
  302.        
  303.         if (is_user_alive(attacker) && (g_cvar_players))
  304.         {
  305.             if (g_over_damage[victim] >= get_pcvar_num(cvar_smoke_damage_byplayer))
  306.             {
  307.                 g_over_damage[victim] = 0
  308.                 smoke_damage(victim)
  309.             }
  310.            
  311.             if (g_over_damage[victim] >= get_pcvar_num(cvar_tongue_stop_damage))
  312.             {
  313.                 g_over_damage[victim] = 0
  314.                 tongue_end(victim)
  315.                 return HAM_IGNORED;
  316.             }
  317.         }      
  318.     }
  319.    
  320.     return HAM_IGNORED
  321. }
  322.  
  323. public fw_PlayerPreThink(id)
  324. {
  325.     if (!is_user_alive(id))
  326.     {
  327.         return FMRES_IGNORED
  328.     }
  329.        
  330.     new button = get_user_button(id)
  331.     new oldbutton = get_user_oldbutton(id)
  332.    
  333.     if (g_bind_isuse[id] && ze_is_user_zombie(id) && (ze_get_current_zombie_class(id) == g_zclass_smoker))
  334.     {
  335.         if (!(oldbutton & IN_USE) && (button & IN_USE))
  336.         {
  337.             tongue_start(id)
  338.         }
  339.         if ((oldbutton & IN_USE) && !(button & IN_USE))
  340.         {
  341.             tongue_end(id)
  342.         }
  343.     }
  344.    
  345.     if (!g_Ltongue_i[id])
  346.     {
  347.         g_unable2move[id] = false
  348.     }
  349.        
  350.     if (g_unable2move[id] && get_pcvar_num(cvar_tongue_unb2move) > 0)
  351.     {
  352.         set_pev(id, pev_maxspeed, 1.0)
  353.     }
  354.    
  355.     return PLUGIN_CONTINUE
  356. }
  357.  
  358. public client_disconnected(id) // if client disconnects drag off
  359. {
  360.     if (id <= 0 || id > 32)
  361.         return
  362.    
  363.     if (g_tongued[id])
  364.         tongue_end(id)
  365.    
  366.     if(g_unable2move[id])
  367.         g_unable2move[id] = false
  368. }
  369.  
  370. /*****************************************************
  371.         [main commands]
  372. *****************************************************/
  373.  
  374. public tongue_start(id) // starts drag, checks if player is Smoker, checks cvars
  375. {  
  376.     new g_unalive = is_user_alive(id)
  377.    
  378.     if (!g_unalive)
  379.     {
  380.         print_chatColor(id, "\g[ZP] \nYou can't use \tlong tongue if you are death!")
  381.         return PLUGIN_HANDLED
  382.     }
  383.            
  384.     if (ze_is_user_zombie(id))
  385.     {
  386.         if (ze_get_current_zombie_class(id) == g_zclass_smoker)
  387.         {  
  388.             if (!g_Ltongue_i[id])
  389.             {
  390.                 set_view(id, CAMERA_UPLEFT)
  391.                 static Float:cdown
  392.                 cdown = get_pcvar_float(cvar_tongue_cooldown)
  393.  
  394.                 if (!g_unalive)
  395.                 {
  396.                     print_chatColor(id, "\g[ZP] \nYou can't use \tlong tongue if you are death!")
  397.                     return PLUGIN_HANDLED
  398.                 }
  399.            
  400.                 if (g_tonguesLeft[id] <= 0)
  401.                 {
  402.                     print_chatColor(id, "\g[ZP] \nYou use max \tlong tongue, you cant do anymore")
  403.                     return PLUGIN_HANDLED
  404.                 }
  405.  
  406.                 if (get_gametime() - g_lastTongue[id] < cdown)
  407.                 {
  408.                     print_chatColor(id, "\g[ZP] \nYou have to \twait %.f0  to use long tongue again!", get_pcvar_float(cvar_tongue_cooldown) - (get_gametime() - g_lastTongue[id]))
  409.                     set_view(id, CAMERA_NONE)
  410.                     return PLUGIN_HANDLED
  411.                 }
  412.  
  413.                 new tonguetarget, targetbody
  414.                 get_user_aiming(id, tonguetarget, targetbody)
  415.                
  416.                 if (is_user_alive(tonguetarget))
  417.                 {
  418.                     tonguetarget_classes(id, tonguetarget)
  419.                    
  420.                     if (get_pcvar_float(cvar_tongue_speed) <= 0.0)
  421.                         cvar_tongue_speed = 1
  422.            
  423.                     new parm[2]
  424.                     parm[0] = id
  425.                     parm[1] = tonguetarget
  426.                    
  427.                     set_task(0.1, "smoker_reelin", id, parm, 2, "b")
  428.                     harpoon_target(parm)
  429.                        
  430.                     g_tonguesLeft[id]--
  431.                     g_Ltongue_i[id] = true
  432.                
  433.                     if (get_pcvar_num(cvar_tongue_unb2move) == 1)
  434.                     {
  435.                         g_unable2move[tonguetarget] = true
  436.                     }  
  437.                 }
  438.                 else
  439.                 {
  440.                     g_tongued[id] = 33
  441.                     FloorTarget(id)
  442.                     emit_sound(tonguetarget, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  443.                     g_Ltongue_i[id] = true
  444.                     g_tonguesLeft[id]--
  445.                 }      
  446.             }
  447.             else
  448.                 return PLUGIN_HANDLED
  449.         }  
  450.     }
  451.     else
  452.     {
  453.         print_chatColor(id, "\g[ZP] \nYou can't use \tsmoker's long tongue if you're a  human!")   
  454.         return PLUGIN_HANDLED
  455.     }
  456.     return PLUGIN_CONTINUE
  457. }
  458.  
  459. public smoker_reelin(parm[]) // player to smoker
  460. {
  461.     new id = parm[0]
  462.     new victim = parm[1]
  463.  
  464.     if (!g_tongued[id] || !is_user_alive(victim))
  465.     {
  466.         tongue_end(id)
  467.         return
  468.     }
  469.    
  470.     new Float:fl_Velocity[3]
  471.     new idOrigin[3], vicOrigin[3]
  472.  
  473.     get_user_origin(victim, vicOrigin)
  474.     get_user_origin(id, idOrigin)
  475.  
  476.     new distance = get_distance(idOrigin, vicOrigin)
  477.  
  478.     if (distance > 1)
  479.     {
  480.         new Float:fl_Time = distance / get_pcvar_float(cvar_tongue_speed)
  481.  
  482.         fl_Velocity[0] = (idOrigin[0] - vicOrigin[0]) / fl_Time
  483.         fl_Velocity[1] = (idOrigin[1] - vicOrigin[1]) / fl_Time
  484.         fl_Velocity[2] = (idOrigin[2] - vicOrigin[2]) / fl_Time
  485.     }
  486.     else
  487.     {
  488.         fl_Velocity[0] = 0.0
  489.         fl_Velocity[1] = 0.0
  490.         fl_Velocity[2] = 0.0
  491.     }
  492.  
  493.     entity_set_vector(victim, EV_VEC_velocity, fl_Velocity)
  494. }
  495.  
  496. public tongue_end(id) // drags end function
  497. {
  498.     g_tongued[id] = 0
  499.     beam_remove(id)
  500.     remove_task(id)
  501.     set_view(id, CAMERA_NONE)
  502.    
  503.     if (g_Ltongue_i[id])
  504.     {
  505.         g_lastTongue[id] = get_gametime()
  506.     }
  507.     g_Ltongue_i[id] = false
  508.     g_unable2move[id] = false
  509. }
  510.  
  511. public harpoon_target(parm[]) // set long tongue if target is player
  512. {
  513.     new id = parm[0]
  514.     new tonguetarget = parm[1]
  515.  
  516.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  517.     write_byte(8)   // TE_BEAMENTS
  518.     write_short(id)
  519.     write_short(tonguetarget)
  520.     write_short(g_Tongue)   // sprite index
  521.     write_byte(0)   // start frame
  522.     write_byte(0)   // framerate
  523.     write_byte(200) // life
  524.     write_byte(12)  // width
  525.     write_byte(1)   // noise
  526.     write_byte(58)  // r, g, b
  527.     write_byte(68)  // r, g, b
  528.     write_byte(57)  // r, g, b
  529.     write_byte(90)  // brightness
  530.     write_byte(10)  // speed
  531.     message_end()
  532. }
  533.  
  534. public FloorTarget(id) // set long tongue target isn't player
  535. {
  536.     set_view(id, CAMERA_NONE)
  537.     new endorigin[3]
  538.     get_user_origin(id, endorigin, 3)
  539.  
  540.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  541.     write_byte (TE_BEAMENTPOINT); // TE_BEAMENTPOINT
  542.     write_short(id)
  543.     write_coord(endorigin[0])
  544.     write_coord(endorigin[1])
  545.     write_coord(endorigin[2])
  546.     write_short(g_Tongue) // sprite index
  547.     write_byte(0)   // start frame
  548.     write_byte(0)   // framerate
  549.     write_byte(200) // life
  550.     write_byte(15)  // width
  551.     write_byte(1)   // noise
  552.     write_byte(58)  // r, g, b
  553.     write_byte(68)  // r, g, b
  554.     write_byte(57)  // r, g, b
  555.     write_byte(90)  // brightness
  556.     write_byte(10)  // speed
  557.     message_end()
  558. }
  559.  
  560. public beam_remove(id) // remove beam
  561. {
  562.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  563.     write_byte(99)  //TE_KILLBEAM
  564.     write_short(id) //entity
  565.     message_end()
  566. }
  567.  
  568. public smoke_damage(id) // when smoker damaged create smoke
  569. {
  570.     if (ze_is_user_zombie(id))
  571.     {
  572.         if (ze_get_current_zombie_class(id) == g_zclass_smoker)
  573.         {
  574.             new g_scale
  575.             g_scale = random_num(60, 70)
  576.             new Float:origin[3]
  577.             pev(id, pev_origin, origin)
  578.             create_sprite(origin, g_xsmoke1, 100, g_scale)
  579.             screenshakeandflash(id)
  580.         }
  581.     }
  582.     else
  583.     {
  584.         return PLUGIN_HANDLED
  585.     }
  586.     return PLUGIN_HANDLED
  587. }
  588.  
  589. public smoke_death(id) // when smoker dies create smoke
  590. {
  591.     if (ze_is_user_zombie(id))
  592.     {
  593.         if (ze_get_current_zombie_class(id) == g_zclass_smoker)
  594.         {
  595.             new Float:origin[3]
  596.             pev(id, pev_origin, origin)
  597.             create_sprite(origin, g_xsmoke2, 200, 180)
  598.             deathh_smoke(id)
  599.             emit_sound(id, CHAN_BODY, sound_smo_die, 1.0, ATTN_NORM, 0, PITCH_NORM)
  600.         }
  601.     }
  602.     else
  603.     {
  604.         return PLUGIN_HANDLED
  605.     }
  606.    
  607.     return PLUGIN_HANDLED
  608. }
  609.  
  610. public screenshakeandflash(id)
  611. {
  612.     new g_msgScreenShake = get_user_msgid("ScreenShake")
  613.     message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, _, id)
  614.     write_short(1<<12*4) // amplitude
  615.     write_short(1<<12*2) // duration
  616.     write_short(1<<12*10) // frequency
  617.     message_end()
  618.     new g_msgScreenFade = get_user_msgid("ScreenFade")
  619.     message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
  620.     write_short( 1<<10) // fade lasts this long duration
  621.     write_short( 1<<10) // fade lasts this long hold time
  622.     write_short( 1<<12 ) // fade type (in / out)
  623.     write_byte(255) // fade red
  624.     write_byte(255) // fade green
  625.     write_byte(255) // fade blue
  626.     write_byte(100) // fade alpha
  627.     message_end()
  628. }
  629.  
  630. public tonguetarget_classes(id, target)
  631. {
  632.     /* Note: this targets are alive, if you want death go back to line "447" */
  633.     new id_name[32], target_name[32]
  634.     get_user_name(id, id_name, 31)
  635.     get_user_name(target, target_name, 31)
  636.    
  637.     if (ze_is_user_zombie(target))
  638.     {
  639.         if (get_pcvar_num(cvar_tongue_zombietarget) == 1)
  640.         {
  641.             print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to %s", target_name)
  642.             print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)
  643.             g_tongued[id] = target
  644.             emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
  645.         }
  646.         else
  647.         {
  648.             g_tongued[id] = target = false
  649.             print_chatColor(id, "\g[ZP] \nYou \tCant use long tongue to %s", target_name)
  650.             emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM) // still add some sound so it wont show as a bug
  651.         }
  652.         if (get_pcvar_num(cvar_tongue_zombietarget) == 2) // allow only for smoker zombies
  653.         {
  654.             if (ze_get_current_zombie_class(target) == g_zclass_smoker)
  655.             {
  656.                 g_tongued[id] = target         
  657.                 print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to %s", target_name)
  658.                 print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)             
  659.                 emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM) // still add some sound so it wont show as a bug
  660.             }
  661.             //else {
  662.             if (ze_get_current_zombie_class(target) != g_zclass_smoker)
  663.             {
  664.                 g_tongued[id] = target = false
  665.                 print_chatColor(id, "\g[ZP] \nYou \tCan only use long tongue to smokers")
  666.                 emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
  667.             }
  668.             //} //else is end
  669.         }
  670.     }
  671.     else
  672.     {
  673.         give_ammopacks(id)
  674.         print_chatColor(id, "\g[ZP] \nYou are using you're \tlong tongue to enemy %s You rewarded %d AP", target_name, get_pcvar_num(cvar_tongue_reward))
  675.         print_chatColor(target, "\g[ZP] \nsmoker %s is using \the's long tongue to you!", id_name)
  676.         g_tongued[id] = target
  677.         emit_sound(target, CHAN_BODY, sound_drag, 1.0, ATTN_NORM, 0, PITCH_NORM)
  678.     }
  679. }
  680.  
  681. public deathh_smoke(id)
  682. {
  683.     new bool:deathh_smoke_allowed[33]
  684.     for(new i = 1; i <= get_maxplayers(); i ++)
  685.     {
  686.         if (ze_is_user_zombie(i) || get_entity_distance(id, i) > get_pcvar_num(cvar_smoke_death_distance))
  687.         {
  688.             return PLUGIN_HANDLED
  689.         }
  690.        
  691.         if (is_user_bot(i))
  692.         {
  693.             deathh_smoke_allowed[id] = true
  694.         }
  695.        
  696.         print_chatColor(id, "\g[ZP] \nYou rewarded \t2 ammopacks by using smoke death to a victim")
  697.         give_ammopacks(id)
  698.  
  699.         new g_msgScreenFade = get_user_msgid("ScreenFade")
  700.         message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, i)
  701.         write_short(get_pcvar_num(cvar_smoke_death_blind)) // Time
  702.         write_short(get_pcvar_num(cvar_smoke_death_blind)) // time
  703.         write_short(0x0004)
  704.         write_byte(255) // red
  705.         write_byte(255) // green
  706.         write_byte(255) // blue
  707.         write_byte(135) // Alpha
  708.         message_end()
  709.        
  710.         new Float:orgin[3]
  711.         pev(i, pev_origin, orgin)
  712.         new g_scale = random_num(40, 30)
  713.         create_sprite(orgin, g_xsmoke1, 150, g_scale)
  714.        
  715.         if(get_pcvar_num(cvar_smoke_death_victimglow) == 1)
  716.         {
  717.             set_rendering(i, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 25)
  718.             print_chatColor(i, "\g[ZP] \n You'd been \tsmoked by smoker's death smoke")
  719.         }
  720.        
  721.         set_task(get_pcvar_float(cvar_smoke_death_blind), "deathh_smoke_unblind", i)
  722.     }
  723.     return PLUGIN_HANDLED
  724. }
  725.  
  726. public deathh_smoke_unblind(user)
  727. {
  728.     new g_msgScreenFade = get_user_msgid("ScreenFade")
  729.     message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, user)
  730.     write_short(1<<12) // Time
  731.     write_short(0) // time
  732.     write_short(0x0004)
  733.     write_byte(0) // red
  734.     write_byte(0) // green
  735.     write_byte(0) // blue
  736.     write_byte(1) // Alpha (if use 100 or upper will cause dark screen to user (not bug))
  737.     message_end()
  738.    
  739.     new Float:orgin[3]
  740.     pev(user, pev_origin, orgin)
  741.     new g_scale = random_num(40, 30)
  742.     create_sprite(orgin, g_xsmoke1, 130, g_scale)
  743.    
  744.     // plus remove glow
  745.     if (get_pcvar_num(cvar_smoke_death_victimglow) == 1)
  746.     {
  747.         set_rendering(user)
  748.     }
  749. }
  750.  
  751. stock give_ammopacks(id)
  752. {
  753.     ze_set_escape_coins(id, ze_get_escape_coins(id) + get_pcvar_num(cvar_tongue_reward))
  754. }
  755.  
  756. stock create_sprite(const Float:XYZ_position[3], sprite_index, brightness, scale)
  757. {
  758.     // Sprite
  759.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  760.     write_byte(TE_SPRITE) // TE id (Additive sprite, plays 1 cycle)
  761.     engfunc(EngFunc_WriteCoord, XYZ_position[0]) // x
  762.     engfunc(EngFunc_WriteCoord, XYZ_position[1]) // y
  763.     engfunc(EngFunc_WriteCoord, XYZ_position[2]) // z
  764.     write_short(sprite_index) // sprite index
  765.     write_byte(scale) // scale in 0.1's
  766.     write_byte(brightness) // brightness
  767.     message_end()
  768. }
  769.  
  770. // Print chat color by x[L]eonn
  771. stock print_chatColor(const id,const input[], any:...)
  772. {
  773.     new msg[191], players[32], count = 1;
  774.     vformat(msg,190,input,3);
  775.     replace_all(msg,190,"\g","^4");// green
  776.     replace_all(msg,190,"\n","^1");// normal
  777.     replace_all(msg,190,"\t","^3");// team
  778.    
  779.     if (id) players[0] = id; else get_players(players,count,"ch");
  780.     for (new i=0;i<count;i++)
  781.     if (is_user_connected(players[i]))
  782.     {
  783.         message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
  784.         write_byte(players[i]);
  785.         write_string(msg);
  786.         message_end();
  787.     }
  788. }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 3 guests