HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX Compiler
  2.   Credits: --- Mercylezz, for his some useful codes...
  3.   --- Mini_midget, for his idea and some codes :)
  4. --- GHW_Chronic, custom blood color for zombie
  5. --- crazyeffect, helped me about ML
  6. --- kmlkz, fix my mistake :)
  7. --- www.PartnersInRhyme.com , provide free SFX sounds (thunder sounds)
  8. --- All translators that help me completing MultiLang
  9. --- People that use this plugin
  10. --- All bug reporters
  11. */
  12.  
  13. #include <amxmodx>
  14. #include <amxmisc>
  15. #include <hamsandwich>
  16. #include <fakemeta>
  17. #include <hlsdk_const>
  18.  
  19. #define PLUGIN "Half-Life : Zombie Mod"
  20. #define VERSION "001"
  21. #define AUTHOR "Anggara_nothing"
  22.  
  23. // Uncomment this line for let this plug-in support Opposing Force
  24. //#define Opposing_Force
  25.  
  26. new const ZOMBIE_CLAWS[] = "models/v_knife_zombie.mdl"; // Edit this line for custom claw model
  27. new const ZOMBIE_MODEL[] = "hlzmzombie"; // Edit this line for custom zombie model (short name only)
  28. new const HUMAN_MODEL[] = "hlzmhecu"; // Edit this line for custom human model (short name only)
  29.  
  30. new const g_ambience_thunder[][] = // Thunder sounds
  31. {
  32. "ambience_thunder/thunder.wav",
  33. "ambience_thunder/thunder3.wav"
  34. }
  35. new const g_zombie_hitwall_sounds[][] = // Zombie "hitwall" sounds
  36. {
  37. "zombie/claw_strike1.wav",
  38. "zombie/claw_strike2.wav",
  39. "zombie/claw_strike3.wav"
  40. }
  41. new const g_zombie_pain_sounds[][] = // Zombie pain sounds
  42. {
  43. "zombie/zo_pain1.wav",
  44. "zombie/zo_pain2.wav"
  45. }
  46. new const g_zombie_die_sounds[][] = // Zombie dead sounds
  47. {
  48. "bullchicken/bc_die3.wav",
  49. "headcrab/hc_die2.wav",
  50. "bullchicken/bc_die1.wav",
  51. "aslave/slv_die2.wav"
  52. }
  53. new const g_zombie_idle_sounds[][] = // Zombie idle sounds
  54. {
  55. "zombie/zo_idle1.wav",
  56. "zombie/zo_idle2.wav",
  57. "zombie/zo_idle3.wav",
  58. "zombie/zo_idle4.wav",
  59. "headcrab/hc_idle3.wav",
  60. "nihilanth/nil_die.wav",
  61. "nihilanth/nil_now_die.wav",
  62. "nihilanth/nil_win.wav"
  63. }
  64. new const g_zombie_spawn_sounds[][] = // Zombie spawn sounds
  65. {
  66. "scientist/c1a0_sci_catscream.wav",
  67. "scientist/scream01.wav",
  68. "scientist/scream04.wav",
  69. "scientist/scream05.wav",
  70. "scientist/scream1.wav"
  71. }
  72. new const g_human_idle_sounds[][] = // Human idle sounds
  73. {
  74. "hgrunt/gr_idle1.wav",
  75. "hgrunt/gr_idle2.wav",
  76. "hgrunt/gr_idle3.wav",
  77. "hgrunt/gr_alert1.wav",
  78. "hgrunt/gr_loadtalk.wav"
  79. }
  80. new const g_human_pain_sounds[][] = // Human pain sounds
  81. {
  82. "hgrunt/gr_pain1.wav",
  83. "hgrunt/gr_pain2.wav",
  84. "hgrunt/gr_pain3.wav",
  85. "hgrunt/gr_pain4.wav",
  86. "hgrunt/gr_pain5.wav"
  87. }
  88. new const g_human_die_sounds[][] = // Human death sounds
  89. {
  90. "hgrunt/gr_die1.wav",
  91. "hgrunt/gr_die2.wav",
  92. "hgrunt/gr_die3.wav"
  93. }
  94. new const g_human_spawn_sounds[][] = // Human spawn sound
  95. {
  96. "barney/letsgo.wav",
  97. "scientist/letsgo.wav",
  98. "scientist/yesletsgo.wav"
  99. }
  100.  
  101.  
  102. //----------------------------------------------------------------------------------------
  103. //-- Don't edit below this line...
  104. //----------------------------------------------------------------------------------------
  105.  
  106. new blooddecalwad[14] = {27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}
  107.  
  108. // Custom blood color by GHW_Chronic
  109. #define TE_BLOODSPRITE 115
  110.  
  111. #define TASK_STRIP 9991
  112. #define TASK_NVISION 9992
  113. #define TASK_ZIDLE 9993
  114. #define TASK_HIDLE 9994
  115. #define THUNDER_PRECHECK 9995
  116. #define THUNDER 9996
  117.  
  118. #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
  119.  
  120. new blood,blood2,dmgamount,dmgcolor;
  121.  
  122. new bool:g_zombie[33] // is user zombie ???
  123. new bool:g_spawned[33] = false// is user has spawned ???
  124. new g_nvisionenabled[33] // is user turn on nightvision ???
  125.  
  126. new cvar_hlzm_enable,cvar_zombiehealth,cvar_zombiearmor,cvar_zombiespeed,cvar_zombiegravity,cvar_fs,cvar_night_enable,
  127. cvar_night_radius,cvar_night_red,cvar_night_green,cvar_night_blue,cvar_h_health,cvar_h_speed,cvar_h_gravity,
  128. cvar_h_armor,cvar_lighting,cvar_sky,cvar_zombieextrasound,cvar_zombieidle, cvar_lt,
  129. cvar_humanextrasound,cvar_humanidle,cvar_zombie_spawn,cvar_human_spawn;
  130.  
  131. new modname[1996];
  132. new zm_enabled = 1
  133.  
  134. new g_lights_reach;
  135. new g_thunder_randomswitch;
  136.  
  137. // Awesome mercylezz thunder effects =0
  138. new const lights_thunder1[][] = { "i" ,"j", "k", "l", "m", "n", "o", "n", "m", "l", "k", "j", "i", "h", "g", "f", "e", "d", "c", "b", "a"}
  139. new const lights_thunder2[][] = { "k", "l", "m", "l", "k", "j", "i", "h", "g", "f", "e", "d", "c", "b", "a", "a", "b", "c", "d", "e", "d", "c", "b", "a"}
  140.  
  141. // Weapon entities
  142. new const g_weapon_ents[][] =
  143. {
  144. "weapon_357",
  145. "weapon_9mmAR",
  146. "weapon_9mmhandgun",
  147. "weapon_crossbow",
  148. "weapon_egon",
  149. "weapon_gauss",
  150. "weapon_glock",
  151. "weapon_handgrenade",
  152. "weapon_hornetgun",
  153. "weapon_mp5",
  154. "weapon_python",
  155. "weapon_rpg",
  156. "weapon_satchel",
  157. "weapon_shotgun",
  158. "weapon_snark",
  159. "weapon_tripmine",
  160. "item_longjump",
  161. "item_suit",
  162. "item_battery",
  163. "item_healthkit",
  164. "weaponbox"
  165. }
  166. // Item entities
  167. new const g_item_ents[][] =
  168. {
  169. "ammo_357",
  170. //"ammo_556",
  171. "ammo_9mmAR",
  172. "ammo_9mmbox",
  173. "ammo_9mmclip",
  174. "ammo_ARgrenades",
  175. "ammo_buckshot",
  176. "ammo_crossbow",
  177. "ammo_egonclip",
  178. "ammo_gaussclip",
  179. "ammo_glockclip",
  180. "ammo_mp5clip",
  181. "ammo_mp5grenades",
  182. "ammo_rpgclip",
  183. "item_longjump",
  184. "item_suit",
  185. "item_battery",
  186. "item_healthkit",
  187. "weaponbox"
  188. }
  189. // "Func" entities
  190. new const g_func_ents[][] =
  191. {
  192. "func_recharge",
  193. "func_healthcharger",
  194. "func_tank",
  195. "func_tankcontrols",
  196. "func_tanklaser",
  197. "func_tankmortar",
  198. "func_tankrocket",
  199. "monster_barney",
  200. "monster_scientist"
  201. }
  202.  
  203. #if defined Opposing_Force
  204.  
  205. // Weapon entities
  206. new const op4_weapon_ents[][] =
  207. {
  208. "weapon_displacer", // Opposing Force stuff
  209. "weapon_eagle", // Opposing Force stuff
  210. "weapon_grapple", // Opposing Force stuff
  211. "weapon_knife", // Opposing Force stuff
  212. "weapon_m249", // Opposing Force stuff
  213. "weapon_penguin", // Opposing Force stuff
  214. "weapon_pipewrench", // Opposing Force stuff
  215. "weapon_shockrifle", // Opposing Force stuff
  216. "weapon_shockroach", // Opposing Force stuff
  217. "weapon_sniperrifle", // Opposing Force stuff
  218. "weapon_sporelauncher" // Opposing Force stuff
  219. }
  220. // Item entities
  221. new const op4_item_ents[][] =
  222. {
  223. "ammo_762", // Opposing Force stuff
  224. "ammo_eagleclip", // Opposing Force stuff
  225. "ammo_spore", // Opposing Force stuff
  226. "item_vest" // Opposing Force stuff
  227. }
  228. // "Func" entities
  229. new const op4_func_ents[][] =
  230. {
  231. "monster_cleansuit_scientist", // Opposing Force stuff
  232. "monster_drillsergeant", // Opposing Force stuff
  233. "monster_grunt_ally_repel", // Opposing Force stuff
  234. "monster_medic_ally_repel", // Opposing Force stuff
  235. "monster_human_friendly_grunt", // Opposing Force stuff
  236. "monster_human_grunt_ally", // Opposing Force stuff
  237. "monster_human_medic_ally", // Opposing Force stuff
  238. "monster_human_torch_ally", // Opposing Force stuff
  239. "monster_otis" // Opposing Force stuff
  240. }
  241.  
  242. #endif
  243.  
  244. public plugin_init() {
  245.  
  246. register_plugin(PLUGIN, VERSION, AUTHOR)
  247. register_cvar("hlzm_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  248. set_cvar_string("hlzm_version", VERSION)
  249.  
  250. static i;
  251. RegisterHam(Ham_Spawn,"player","Hamspawn",1)
  252. RegisterHam(Ham_TakeDamage,"player","Hamtakedamage")
  253. RegisterHam(Ham_Killed, "player", "HamPlayerKilled")
  254. RegisterHam(Ham_BloodColor, "player", "ham_BloodColor")
  255.  
  256. for(i=0;i<sizeof(g_func_ents);i++)
  257. RegisterHam(Ham_Use, g_func_ents[i], "HamUseStationary") // Register func entities
  258.  
  259. for(i=0;i<sizeof(g_item_ents);i++)
  260. RegisterHam(Ham_Touch,g_item_ents[i],"Hamtouch") // Register item entities
  261.  
  262. for(i=0;i<sizeof(g_weapon_ents);i++)
  263. RegisterHam(Ham_Item_AddToPlayer,g_weapon_ents[i],"Hamtouch") // Register weapon entities
  264.  
  265. #if defined Opposing_Force
  266. for(i=0;i<sizeof(op4_func_ents);i++)
  267. RegisterHam(Ham_Use, op4_func_ents[i], "HamUseStationary")
  268.  
  269. for(i=0;i<sizeof(op4_item_ents);i++)
  270. RegisterHam(Ham_Touch,op4_item_ents[i],"Hamtouch")
  271.  
  272. for(i=0;i<sizeof(op4_weapon_ents);i++)
  273. RegisterHam(Ham_Item_AddToPlayer,op4_weapon_ents[i],"Hamtouch")
  274. #endif
  275.  
  276. register_forward(FM_PlayerPreThink,"FMPlayerPreThink", 1) // Set player speed,and gravity
  277. register_forward(FM_EmitSound,"FMEmitSound") // Block crowbar sound
  278. register_forward(FM_CmdStart, "FMCmdStart") // Toggle nightvision
  279. register_forward(FM_GetGameDescription,"gamename")
  280.  
  281. register_event("ResetHUD","event_hud_reset", "be") // Fix zombie-spawn-first-time bug
  282.  
  283. // MultiLangual File
  284. register_dictionary("zsm_hl.txt")
  285.  
  286. // Team list
  287. static string[100];
  288. format(string,99,"%s;%s",HUMAN_MODEL,ZOMBIE_MODEL)
  289. set_cvar_num("mp_teamplay",21)
  290. set_cvar_num("mp_flashlight",1)
  291. set_cvar_string("mp_teamlist",string)
  292.  
  293. // Prevent HL engine light
  294. set_cvar_num("sv_skycolor_r", 0)
  295. set_cvar_num("sv_skycolor_g", 0)
  296. set_cvar_num("sv_skycolor_b", 0)
  297.  
  298. if(!get_pcvar_num(cvar_hlzm_enable)) zm_enabled = 0
  299. else set_task(3.0,"day_light", _, _, _, "b")
  300.  
  301. formatex(modname, charsmax(modname), "%s %s",PLUGIN,VERSION)
  302. }
  303.  
  304. public plugin_cfg()
  305. {
  306. if(!get_pcvar_num(cvar_hlzm_enable)) zm_enabled = 0
  307. else
  308. {
  309. new cfg_dir[64]
  310. get_configsdir(cfg_dir,charsmax(cfg_dir))
  311. server_cmd("exec %s/hlzm.cfg",cfg_dir)
  312.  
  313. set_task(10.0, "thunder_check", _, _, _, "b")
  314. }
  315. }
  316.  
  317. public plugin_precache()
  318. {
  319. // Gameplay
  320. cvar_hlzm_enable = register_cvar("zm_enable","1")
  321. cvar_lighting = register_cvar("zm_light","a")
  322. cvar_sky = register_cvar("zm_sky","space")
  323. cvar_lt = register_cvar("zm_thunderrate", "90")
  324.  
  325. // Zombie's Character
  326. cvar_zombiehealth = register_cvar("zombie_health","200")
  327. cvar_zombiearmor = register_cvar("zombie_armor", "0")
  328. cvar_zombiespeed = register_cvar("zombie_speed", "300")
  329. cvar_zombiegravity = register_cvar("zombie_gravity","0.875")
  330. cvar_fs = register_cvar("zombie_silent","1")
  331. cvar_night_enable = register_cvar("zombie_nv_enable","1")
  332. cvar_night_radius = register_cvar("zombie_nv_radius","80")
  333. cvar_night_red = register_cvar("zombie_nv_red","0")
  334. cvar_night_green = register_cvar("zombie_nv_green","255")
  335. cvar_night_blue = register_cvar("zombie_nv_blue","0")
  336. dmgamount = register_cvar("zombie_blood_amount","1")
  337. dmgcolor = register_cvar("zombie_blood_color","200")
  338.  
  339. // Human's Character
  340. cvar_h_health = register_cvar("human_health","100")
  341. cvar_h_armor = register_cvar("human_armor", "100")
  342. cvar_h_speed = register_cvar("human_speed", "270")
  343. cvar_h_gravity = register_cvar("human_gravity", "1.0")
  344.  
  345. cvar_zombieextrasound = register_cvar("zombie_custom_sound","1")
  346. cvar_humanextrasound = register_cvar("human_custom_sound","1")
  347.  
  348. cvar_zombie_spawn = register_cvar("zombie_spawn_sound","1")
  349. cvar_human_spawn = register_cvar("human_spawn_sound","1")
  350. cvar_zombieidle = register_cvar("zombie_idle_duration","15")
  351. cvar_humanidle = register_cvar("human_idle_duration","30")
  352.  
  353. if(zm_enabled)
  354. {
  355. new arg[100],iNum;
  356.  
  357. format(arg,99,"models/player/%s/%s.mdl",ZOMBIE_MODEL,ZOMBIE_MODEL)
  358. precache_model(arg)
  359.  
  360. format(arg,99,"models/player/%s/%s.mdl",HUMAN_MODEL,HUMAN_MODEL)
  361. precache_model(arg)
  362.  
  363. for (iNum = 0; iNum < sizeof g_ambience_thunder; iNum++)
  364. engfunc(EngFunc_PrecacheSound, g_ambience_thunder[iNum])
  365.  
  366. if(get_pcvar_num(cvar_zombieextrasound))
  367. {
  368. for (iNum = 0; iNum < sizeof g_zombie_pain_sounds; iNum++)
  369. engfunc(EngFunc_PrecacheSound, g_zombie_pain_sounds[iNum])
  370. for (iNum = 0; iNum < sizeof g_zombie_idle_sounds; iNum++)
  371. engfunc(EngFunc_PrecacheSound, g_zombie_idle_sounds[iNum])
  372. for (iNum = 0; iNum < sizeof g_zombie_die_sounds; iNum++)
  373. engfunc(EngFunc_PrecacheSound, g_zombie_die_sounds[iNum])
  374. for (iNum = 0; iNum < sizeof g_zombie_hitwall_sounds; iNum++)
  375. engfunc(EngFunc_PrecacheSound, g_zombie_hitwall_sounds[iNum])
  376. }
  377. if(get_pcvar_num(cvar_humanextrasound))
  378. {
  379. for (iNum = 0; iNum < sizeof g_human_idle_sounds; iNum++)
  380. engfunc(EngFunc_PrecacheSound, g_human_idle_sounds[iNum])
  381. for (iNum = 0; iNum < sizeof g_human_pain_sounds; iNum++)
  382. engfunc(EngFunc_PrecacheSound, g_human_pain_sounds[iNum])
  383. for (iNum = 0; iNum < sizeof g_human_die_sounds; iNum++)
  384. engfunc(EngFunc_PrecacheSound, g_human_die_sounds[iNum])
  385. }
  386. if(get_pcvar_num(cvar_zombie_spawn))
  387. {
  388. for (iNum = 0; iNum < sizeof g_zombie_spawn_sounds; iNum++)
  389. engfunc(EngFunc_PrecacheSound, g_zombie_spawn_sounds[iNum])
  390. }
  391. if(get_pcvar_num(cvar_human_spawn))
  392. {
  393. for (iNum = 0; iNum < sizeof g_human_spawn_sounds; iNum++)
  394. engfunc(EngFunc_PrecacheSound, g_human_spawn_sounds[iNum])
  395. }
  396.  
  397. precache_model(ZOMBIE_CLAWS)
  398. blood = precache_model("sprites/blood.spr")
  399. blood2 = precache_model("sprites/bloodspray.spr")
  400. }
  401. }
  402. public client_connect(id)
  403. {
  404. if(is_user_connected(id))
  405. {
  406. if(zm_enabled)
  407. {
  408. // Reset all variables
  409. g_spawned[id] = false
  410. g_zombie[id] = false
  411. g_nvisionenabled[id] = 0; }
  412.  
  413. client_cmd(id,"suitvolume 1.0") // Set HEV suit volume to normal
  414. }
  415. }
  416.  
  417. public event_hud_reset(id)
  418. {
  419. if(zm_enabled) {
  420.  
  421. if(!g_spawned[id])
  422. {
  423. set_task(0.01,"Hamspawn",id)
  424. g_spawned[id] = true
  425. }
  426. }
  427. }
  428.  
  429. public gamename()
  430. {
  431. forward_return(FMV_STRING, modname)
  432. return FMRES_SUPERCEDE
  433. }
  434.  
  435. public Hamspawn(id)
  436. {
  437. if(!zm_enabled || !is_user_connected(id)) return HAM_IGNORED;
  438.  
  439. client_print(id,print_chat,"%L", id, "HL_ZM")
  440. if (get_user_team(id) == 2) // Zombie
  441. {
  442. client_cmd(id,"impulse 101")
  443. g_zombie[id] = true
  444. client_cmd(id,"suitvolume 0.0")
  445. if(get_pcvar_num(cvar_zombie_spawn))
  446. emit_sound(id,CHAN_VOICE,g_zombie_spawn_sounds[random_num(0, sizeof g_zombie_spawn_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  447.  
  448. remove_task(TASK_STRIP + id)
  449.  
  450. // Fakemeta
  451. set_pev(id, pev_health, get_pcvar_float(cvar_zombiehealth)) // use decimal number
  452. set_pev(id, pev_armorvalue, get_pcvar_float(cvar_zombiearmor)) // use decimal number
  453. set_task(get_pcvar_float(cvar_zombieidle), "zombie_play_idle", id+TASK_ZIDLE, _, _, "b")
  454. client_print(id,print_chat,"%L", id, "FL_PRESS")
  455. }
  456. else if (get_user_team(id) == 1) // Human
  457. {
  458. g_zombie[id] = false
  459. client_cmd(id,"suitvolume 1.0")
  460. if(get_pcvar_num(cvar_human_spawn))
  461. emit_sound(id,CHAN_VOICE,g_human_spawn_sounds[random_num(0,sizeof g_human_spawn_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  462.  
  463. // Fakemeta
  464. set_pev(id, pev_health, get_pcvar_float(cvar_h_health)) // use decimal number
  465. set_pev(id, pev_armorvalue, get_pcvar_float(cvar_h_armor)) // use decimal number
  466. set_task(get_pcvar_float(cvar_humanidle), "human_play_idle", id+TASK_HIDLE, _, _, "b")
  467. client_print(id,print_chat,"%L", id, "FL_HM_PRESS")
  468. }
  469. return HAM_IGNORED
  470. }
  471.  
  472. public Hamtakedamage(victim, inflictor, attacker, Float:damage, damagetype)
  473. {
  474. if(!zm_enabled) return HAM_IGNORED
  475. if(victim == attacker || !is_user_connected(victim)) return HAM_IGNORED
  476.  
  477. if(g_zombie[victim])
  478. {
  479. if(get_pcvar_num(cvar_zombieextrasound))
  480. emit_sound(victim,CHAN_VOICE,g_zombie_pain_sounds[random_num(0,sizeof g_zombie_pain_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  481.  
  482. if(get_pcvar_num(dmgamount))
  483. {
  484. new origin[3]
  485. get_user_origin(victim,origin)
  486. new hitpoint, weapon
  487. get_user_attacker(victim,weapon,hitpoint)
  488. switch(hitpoint)
  489. {
  490. case 1:get_user_origin(victim,origin,1)
  491. case 2:origin[2] += 25
  492. case 3:origin[2] += 10
  493. case 4:{origin[2] += 10;origin[0] += 5;origin[1] += 5;}
  494. case 5:{origin[2] += 10;origin[0] -= 5;origin[1] -= 5;}
  495. case 6:{origin[2] -= 10;origin[0] += 5;origin[1] += 5;}
  496. case 7:{origin[2] -= 10;origin[0] -= 5;origin[1] -= 5;}
  497. }
  498. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  499. write_byte(TE_BLOODSPRITE)
  500. write_coord(origin[0])
  501. write_coord(origin[1])
  502. write_coord(origin[2])
  503. switch(get_pcvar_num(dmgamount))
  504. {
  505. case 1:{write_short(blood);write_short(blood);}
  506. case 2:{write_short(blood2);write_short(blood);}
  507. default:{write_short(blood2);write_short(blood2);}
  508. }
  509. write_byte(get_pcvar_num(dmgcolor))
  510. write_byte(10)
  511. message_end()
  512. }
  513. }
  514. if(!g_zombie[victim] && get_pcvar_num(cvar_humanextrasound))
  515. emit_sound(victim,CHAN_VOICE,g_human_pain_sounds[random_num(0,sizeof g_human_pain_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  516.  
  517. return HAM_IGNORED
  518. }
  519.  
  520. public FMPlayerPreThink(id)
  521. {
  522. if(!zm_enabled) return FMRES_IGNORED
  523. if(!is_user_connected(id)) return FMRES_IGNORED
  524.  
  525. if (g_zombie[id] && get_user_team(id) == 2) // zombie in zombie team
  526. {
  527. if(!is_user_alive(id))
  528. {
  529. if(get_pcvar_num(cvar_zombieextrasound))
  530. emit_sound(id,CHAN_VOICE,g_zombie_pain_sounds[random_num(0,sizeof g_zombie_pain_sounds - 1)],1.0,ATTN_NORM,SND_STOP,PITCH_NORM)
  531. return FMRES_IGNORED
  532. }
  533.  
  534. if(get_pcvar_num(cvar_fs))
  535. set_pev(id, pev_flTimeStepSound, 999)
  536.  
  537. set_pev(id, pev_gravity, get_pcvar_float(cvar_zombiegravity))
  538. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_zombiespeed))
  539. if(get_user_weapon(id) != HLW_CROWBAR)
  540. {
  541. if(!task_exists(TASK_STRIP + id))
  542. set_task(0.5, "Task_Strip", TASK_STRIP + id)
  543. }
  544. else
  545. {
  546. set_pev(id, pev_viewmodel2, ZOMBIE_CLAWS)
  547. set_pev(id, pev_weaponmodel2, "")
  548. }
  549.  
  550. }
  551. else if(g_zombie[id] && get_user_team(id) == 1 && is_user_alive(id)) // zombie in human team
  552. {
  553. client_print(id,print_chat,"%L", id, "USED_MDL_CMD")
  554. user_slap(id,500000)
  555. g_zombie[id] = false
  556. }
  557. else if(!g_zombie[id] && get_user_team(id) == 1) // human in human team
  558. {
  559. if(!is_user_alive(id))
  560. {
  561. if(get_pcvar_num(cvar_humanextrasound))
  562. emit_sound(id,CHAN_VOICE,g_human_pain_sounds[random_num(0,sizeof g_human_pain_sounds - 1)],1.0,ATTN_NORM,SND_STOP,PITCH_NORM)
  563. return FMRES_IGNORED
  564. }
  565. set_pev(id, pev_gravity, get_pcvar_float(cvar_h_gravity))
  566. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_h_speed))
  567. }
  568.  
  569. return FMRES_IGNORED
  570. }
  571.  
  572. // Ham Player Killed Forward
  573. public HamPlayerKilled(victim, attacker, shouldgib)
  574. {
  575. if(!zm_enabled)return HAM_IGNORED
  576.  
  577. if(g_zombie[victim] && get_pcvar_num(cvar_zombieextrasound))
  578. emit_sound(victim,CHAN_VOICE,g_zombie_die_sounds[random_num(0,sizeof g_zombie_die_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  579. else if(!g_zombie[victim] && get_pcvar_num(cvar_humanextrasound))
  580. emit_sound(victim,CHAN_VOICE,g_human_die_sounds[random_num(0,sizeof g_human_die_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  581.  
  582. return HAM_IGNORED;
  583. }
  584.  
  585. public FMEmitSound(id, channel, sample[], Float:volume, Float:attn, flag, pitch)
  586. {
  587. if(!zm_enabled) return FMRES_IGNORED
  588. if(!is_user_connected(id)) return FMRES_IGNORED
  589.  
  590. if (g_zombie[id] && (equal(sample,"weapons/cbar_hit1.wav") || equal(sample,"weapons/cbar_hit2.wav")))
  591. {
  592. if(get_pcvar_num(cvar_zombieextrasound))
  593. {
  594. emit_sound(id, CHAN_AUTO, g_zombie_hitwall_sounds[random_num(0,sizeof g_zombie_hitwall_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  595.  
  596. new aim[3]
  597. get_user_origin(id, aim, 3)
  598. message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  599. write_byte(TE_WORLDDECAL)
  600. write_coord(aim[0])
  601. write_coord(aim[1])
  602. write_coord(aim[2])
  603. write_byte(blooddecalwad[random_num(0,sizeof blooddecalwad - 1)])
  604. message_end()
  605.  
  606. return FMRES_SUPERCEDE;
  607. }
  608. else return FMRES_SUPERCEDE;
  609. }
  610.  
  611. // disable default pain and death sound
  612. if(sample[0] == 'p' && sample[3] == 'y' && sample[10] == 'p' && sample[11] == 'a')
  613. return FMRES_SUPERCEDE;
  614.  
  615. return FMRES_IGNORED
  616. }
  617.  
  618. // Thank you for your source code, Mercylezz ;)
  619. public FMCmdStart(id, handle)
  620. {
  621. if(!zm_enabled) return FMRES_IGNORED;
  622.  
  623. // Check if it's a flashlight impulse
  624. if (g_zombie[id] && (get_uc(handle, UC_Impulse) & 100))
  625. {
  626. set_uc(handle, UC_Impulse, 0)
  627. // Block it
  628. set_uc(handle, UC_Impulse, 0)
  629. if(get_pcvar_num(cvar_night_enable))
  630. {
  631. g_nvisionenabled[id] = !(g_nvisionenabled[id])
  632.  
  633. remove_task(id+TASK_NVISION)
  634. if (g_nvisionenabled[id]) set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
  635. }
  636. }
  637. return FMRES_IGNORED;
  638. }
  639.  
  640. public Hamtouch(ent, id)
  641. {
  642. if(!zm_enabled || !is_user_connected(id)) return HAM_IGNORED
  643.  
  644. if (g_zombie[id]) return HAM_SUPERCEDE
  645.  
  646. return HAM_IGNORED
  647. }
  648. // Ham Use Stationary Gun Forward, thanks mercylezz
  649. public HamUseStationary(entity, caller, activator, use_type)
  650. {
  651. if(!zm_enabled) return HAM_IGNORED;
  652.  
  653. // Prevent zombies from using stationary guns
  654. if (use_type == 2 && is_user_connected(caller) && g_zombie[caller])
  655. return HAM_SUPERCEDE;
  656.  
  657. return HAM_IGNORED;
  658. }
  659.  
  660. public ham_BloodColor( id )
  661. {
  662. if(!zm_enabled) return HAM_IGNORED;
  663.  
  664. if(is_user_connected(id) && get_user_team(id) == 2)
  665. {
  666. SetHamReturnInteger( get_pcvar_num(dmgcolor) )
  667. return HAM_SUPERCEDE
  668. }
  669.  
  670. return HAM_IGNORED
  671. }
  672. public day_light()
  673. {
  674. static lighting[12],arg[1996];
  675. get_pcvar_string(cvar_lighting, lighting, charsmax(lighting))
  676.  
  677. if(!equal(lighting,""))
  678. engfunc(EngFunc_LightStyle, 0, lighting)
  679.  
  680. // Custom sky
  681. get_pcvar_string(cvar_sky,arg,charsmax(arg))
  682. if(!equal(arg,""))
  683. set_cvar_string("sv_skyname",arg)
  684. else
  685. set_cvar_string("sv_skyname","")
  686. }
  687.  
  688. public thunder_check()
  689. {
  690. static thunders[2]
  691. get_pcvar_string(cvar_lighting, thunders, charsmax(thunders))
  692. strtolower(thunders) // Converts all chars in string to lower case
  693.  
  694. if (thunders[0] == '0')
  695. {
  696. remove_task(THUNDER)
  697. remove_task(THUNDER_PRECHECK)
  698. return;
  699. }
  700.  
  701. new Float:thunder_checkrate = get_pcvar_float(cvar_lt)
  702. if(thunder_checkrate > 0.0 && !task_exists(THUNDER_PRECHECK) && !task_exists(THUNDER)) // if thunder enabled
  703. {
  704. g_lights_reach = 0
  705. g_thunder_randomswitch = random_num(0,1)
  706. set_task(thunder_checkrate, "thundershow", THUNDER_PRECHECK)
  707. if (!task_exists(THUNDER)) engfunc(EngFunc_LightStyle, 0, thunders)
  708. }
  709. }
  710.  
  711. public thundershow()
  712. {
  713. if (!g_lights_reach) emit_sound(0,CHAN_AUTO,g_ambience_thunder[random_num(0, sizeof g_ambience_thunder-1)],1.0,ATTN_NORM,0,PITCH_NORM)
  714.  
  715. // Set lightstyle sequently
  716. switch (g_thunder_randomswitch)
  717. {
  718. case 0: { engfunc(EngFunc_LightStyle, 0, lights_thunder1[g_lights_reach]);}
  719. case 1: { engfunc(EngFunc_LightStyle, 0, lights_thunder2[g_lights_reach]);}
  720. }
  721. g_lights_reach++
  722.  
  723. if (g_lights_reach >= thunderchance()) {
  724. remove_task(THUNDER)
  725. thunder_check()
  726. }
  727. else if (!task_exists(THUNDER))
  728. set_task(0.1, "thundershow", THUNDER, _, _, "b")
  729. }
  730.  
  731. /* Stock */
  732. public Task_Strip(taskman)
  733. {
  734. new id = taskman - TASK_STRIP
  735.  
  736. //Fakemeta
  737. fm_strip_user_weapons(id)
  738. fm_give_item(id, "weapon_crowbar")
  739. set_pev(id, pev_viewmodel2, ZOMBIE_CLAWS)
  740. set_pev(id, pev_weaponmodel2, "")
  741.  
  742. }
  743.  
  744. stock fm_strip_user_weapons(index) {
  745. new ent = fm_create_entity("player_weaponstrip");
  746. if (!pev_valid(ent))
  747. return 0;
  748.  
  749. dllfunc(DLLFunc_Spawn, ent);
  750. dllfunc(DLLFunc_Use, ent, index);
  751. engfunc(EngFunc_RemoveEntity, ent);
  752.  
  753. return 1;
  754. }
  755. stock fm_give_item(index, const item[]) {
  756. new ent = fm_create_entity(item);
  757. if (!pev_valid(ent))
  758. return 0;
  759.  
  760. new Float:origin[3];
  761. pev(index, pev_origin, origin);
  762. set_pev(ent, pev_origin, origin);
  763. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
  764. dllfunc(DLLFunc_Spawn, ent);
  765.  
  766. new save = pev(ent, pev_solid);
  767. dllfunc(DLLFunc_Touch, ent, index);
  768. if (pev(ent, pev_solid) != save)
  769. return ent;
  770.  
  771. engfunc(EngFunc_RemoveEntity, ent);
  772.  
  773. return -1;
  774. }
  775. // Custom Night Vision
  776. public set_user_nvision(taskid)
  777. {
  778. new id = taskid - TASK_NVISION
  779.  
  780. // Zombie
  781. if (get_pcvar_num(cvar_night_enable) && g_zombie[id] && is_user_alive(id))
  782. {
  783. // Get player's origin
  784. static origin[3]
  785. get_user_origin(id, origin)
  786.  
  787. // Nightvision message
  788. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
  789. write_byte(TE_DLIGHT) // TE id
  790. write_coord(origin[0]) // x
  791. write_coord(origin[1]) // y
  792. write_coord(origin[2]) // z
  793. write_byte(get_pcvar_num(cvar_night_radius)) // radius
  794.  
  795. write_byte(get_pcvar_num(cvar_night_red)) // r
  796. write_byte(get_pcvar_num(cvar_night_green)) // g
  797. write_byte(get_pcvar_num(cvar_night_blue)) // b
  798.  
  799. write_byte(2) // life
  800. write_byte(0) // decay rate
  801. message_end()
  802. }
  803. }
  804. // Play idle zombie sounds, created by MercyLezz and edited by me
  805. public zombie_play_idle(taskid)
  806. {
  807. new id = taskid - TASK_ZIDLE
  808. // Not enable or not alive
  809. if (!get_pcvar_num(cvar_zombieextrasound) || !is_user_alive(id))
  810. {
  811. remove_task(TASK_ZIDLE)
  812. return ;
  813. }
  814.  
  815. // Zombie idle
  816. if (g_zombie[id])
  817. emit_sound(id,CHAN_VOICE,g_zombie_idle_sounds[random_num(0,sizeof g_zombie_idle_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  818. }
  819. // Play idle human sounds
  820. public human_play_idle(taskid)
  821. {
  822. new id = taskid - TASK_HIDLE
  823. // Not enable or not alive
  824. if (!get_pcvar_num(cvar_humanextrasound) || !is_user_alive(id))
  825. {
  826. remove_task(TASK_HIDLE)
  827. return ;
  828. }
  829.  
  830. // Human idle
  831. if (!g_zombie[id])
  832. emit_sound(id,CHAN_VOICE,g_human_idle_sounds[random_num(0,sizeof g_human_idle_sounds - 1)],1.0,ATTN_NORM,0,PITCH_NORM)
  833. }
  834.  
  835. stock thunderchance() {
  836. switch (g_thunder_randomswitch)
  837. {
  838. case 0: return charsmax(lights_thunder1)
  839. case 1: return charsmax(lights_thunder2)
  840. }
  841. return false
  842. }
  843.  
  844.