/* Plugin generated by AMXX Compiler
Credits: --- Mercylezz, for his some useful codes...
--- Mini_midget, for his idea and some codes :)
--- GHW_Chronic, custom blood color for zombie
--- crazyeffect, helped me about ML
--- kmlkz, fix my mistake :)
--- www.PartnersInRhyme.com , provide free SFX sounds (thunder sounds)
--- All translators that help me completing MultiLang
--- People that use this plugin
--- All bug reporters
*/
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <hlsdk_const>
#define PLUGIN "Half-Life : Zombie Mod"
#define VERSION "001"
#define AUTHOR "Anggara_nothing"
// Uncomment this line for let this plug-in support Opposing Force
//#define Opposing_Force
new const ZOMBIE_CLAWS[] = "models/v_knife_zombie.mdl"; // Edit this line for custom claw model
new const ZOMBIE_MODEL[] = "hlzmzombie"; // Edit this line for custom zombie model (short name only)
new const HUMAN_MODEL[] = "hlzmhecu"; // Edit this line for custom human model (short name only)
new const g_ambience_thunder[][] = // Thunder sounds
{
"ambience_thunder/thunder.wav",
"ambience_thunder/thunder3.wav"
}
new const g_zombie_hitwall_sounds[][] = // Zombie "hitwall" sounds
{
"zombie/claw_strike1.wav",
"zombie/claw_strike2.wav",
"zombie/claw_strike3.wav"
}
new const g_zombie_pain_sounds[][] = // Zombie pain sounds
{
"zombie/zo_pain1.wav",
"zombie/zo_pain2.wav"
}
new const g_zombie_die_sounds[][] = // Zombie dead sounds
{
"bullchicken/bc_die3.wav",
"headcrab/hc_die2.wav",
"bullchicken/bc_die1.wav",
"aslave/slv_die2.wav"
}
new const g_zombie_idle_sounds[][] = // Zombie idle sounds
{
"zombie/zo_idle1.wav",
"zombie/zo_idle2.wav",
"zombie/zo_idle3.wav",
"zombie/zo_idle4.wav",
"headcrab/hc_idle3.wav",
"nihilanth/nil_die.wav",
"nihilanth/nil_now_die.wav",
"nihilanth/nil_win.wav"
}
new const g_zombie_spawn_sounds[][] = // Zombie spawn sounds
{
"scientist/c1a0_sci_catscream.wav",
"scientist/scream01.wav",
"scientist/scream04.wav",
"scientist/scream05.wav",
"scientist/scream1.wav"
}
new const g_human_idle_sounds[][] = // Human idle sounds
{
"hgrunt/gr_idle1.wav",
"hgrunt/gr_idle2.wav",
"hgrunt/gr_idle3.wav",
"hgrunt/gr_alert1.wav",
"hgrunt/gr_loadtalk.wav"
}
new const g_human_pain_sounds[][] = // Human pain sounds
{
"hgrunt/gr_pain1.wav",
"hgrunt/gr_pain2.wav",
"hgrunt/gr_pain3.wav",
"hgrunt/gr_pain4.wav",
"hgrunt/gr_pain5.wav"
}
new const g_human_die_sounds[][] = // Human death sounds
{
"hgrunt/gr_die1.wav",
"hgrunt/gr_die2.wav",
"hgrunt/gr_die3.wav"
}
new const g_human_spawn_sounds[][] = // Human spawn sound
{
"barney/letsgo.wav",
"scientist/letsgo.wav",
"scientist/yesletsgo.wav"
}
//----------------------------------------------------------------------------------------
//-- Don't edit below this line...
//----------------------------------------------------------------------------------------
new blooddecalwad[14] = {27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}
// Custom blood color by GHW_Chronic
#define TE_BLOODSPRITE 115
#define TASK_STRIP 9991
#define TASK_NVISION 9992
#define TASK_ZIDLE 9993
#define TASK_HIDLE 9994
#define THUNDER_PRECHECK 9995
#define THUNDER 9996
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
new blood,blood2,dmgamount,dmgcolor;
new bool:g_zombie[33] // is user zombie ???
new bool:g_spawned[33] = false// is user has spawned ???
new g_nvisionenabled[33] // is user turn on nightvision ???
new cvar_hlzm_enable,cvar_zombiehealth,cvar_zombiearmor,cvar_zombiespeed,cvar_zombiegravity,cvar_fs,cvar_night_enable,
cvar_night_radius,cvar_night_red,cvar_night_green,cvar_night_blue,cvar_h_health,cvar_h_speed,cvar_h_gravity,
cvar_h_armor,cvar_lighting,cvar_sky,cvar_zombieextrasound,cvar_zombieidle, cvar_lt,
cvar_humanextrasound,cvar_humanidle,cvar_zombie_spawn,cvar_human_spawn;
new modname[1996];
new zm_enabled = 1
new g_lights_reach;
new g_thunder_randomswitch;
// Awesome mercylezz thunder effects =0
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"}
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"}
// Weapon entities
new const g_weapon_ents[][] =
{
"weapon_357",
"weapon_9mmAR",
"weapon_9mmhandgun",
"weapon_crossbow",
"weapon_egon",
"weapon_gauss",
"weapon_glock",
"weapon_handgrenade",
"weapon_hornetgun",
"weapon_mp5",
"weapon_python",
"weapon_rpg",
"weapon_satchel",
"weapon_shotgun",
"weapon_snark",
"weapon_tripmine",
"item_longjump",
"item_suit",
"item_battery",
"item_healthkit",
"weaponbox"
}
// Item entities
new const g_item_ents[][] =
{
"ammo_357",
//"ammo_556",
"ammo_9mmAR",
"ammo_9mmbox",
"ammo_9mmclip",
"ammo_ARgrenades",
"ammo_buckshot",
"ammo_crossbow",
"ammo_egonclip",
"ammo_gaussclip",
"ammo_glockclip",
"ammo_mp5clip",
"ammo_mp5grenades",
"ammo_rpgclip",
"item_longjump",
"item_suit",
"item_battery",
"item_healthkit",
"weaponbox"
}
// "Func" entities
new const g_func_ents[][] =
{
"func_recharge",
"func_healthcharger",
"func_tank",
"func_tankcontrols",
"func_tanklaser",
"func_tankmortar",
"func_tankrocket",
"monster_barney",
"monster_scientist"
}
#if defined Opposing_Force
// Weapon entities
new const op4_weapon_ents[][] =
{
"weapon_displacer", // Opposing Force stuff
"weapon_eagle", // Opposing Force stuff
"weapon_grapple", // Opposing Force stuff
"weapon_knife", // Opposing Force stuff
"weapon_m249", // Opposing Force stuff
"weapon_penguin", // Opposing Force stuff
"weapon_pipewrench", // Opposing Force stuff
"weapon_shockrifle", // Opposing Force stuff
"weapon_shockroach", // Opposing Force stuff
"weapon_sniperrifle", // Opposing Force stuff
"weapon_sporelauncher" // Opposing Force stuff
}
// Item entities
new const op4_item_ents[][] =
{
"ammo_762", // Opposing Force stuff
"ammo_eagleclip", // Opposing Force stuff
"ammo_spore", // Opposing Force stuff
"item_vest" // Opposing Force stuff
}
// "Func" entities
new const op4_func_ents[][] =
{
"monster_cleansuit_scientist", // Opposing Force stuff
"monster_drillsergeant", // Opposing Force stuff
"monster_grunt_ally_repel", // Opposing Force stuff
"monster_medic_ally_repel", // Opposing Force stuff
"monster_human_friendly_grunt", // Opposing Force stuff
"monster_human_grunt_ally", // Opposing Force stuff
"monster_human_medic_ally", // Opposing Force stuff
"monster_human_torch_ally", // Opposing Force stuff
"monster_otis" // Opposing Force stuff
}
#endif
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("hlzm_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
set_cvar_string("hlzm_version", VERSION)
static i;
RegisterHam(Ham_Spawn,"player","Hamspawn",1)
RegisterHam(Ham_TakeDamage,"player","Hamtakedamage")
RegisterHam(Ham_Killed, "player", "HamPlayerKilled")
RegisterHam(Ham_BloodColor, "player", "ham_BloodColor")
for(i=0;i<sizeof(g_func_ents);i++)
RegisterHam(Ham_Use, g_func_ents[i], "HamUseStationary") // Register func entities
for(i=0;i<sizeof(g_item_ents);i++)
RegisterHam(Ham_Touch,g_item_ents[i],"Hamtouch") // Register item entities
for(i=0;i<sizeof(g_weapon_ents);i++)
RegisterHam(Ham_Item_AddToPlayer,g_weapon_ents[i],"Hamtouch") // Register weapon entities
#if defined Opposing_Force
for(i=0;i<sizeof(op4_func_ents);i++)
RegisterHam(Ham_Use, op4_func_ents[i], "HamUseStationary")
for(i=0;i<sizeof(op4_item_ents);i++)
RegisterHam(Ham_Touch,op4_item_ents[i],"Hamtouch")
for(i=0;i<sizeof(op4_weapon_ents);i++)
RegisterHam(Ham_Item_AddToPlayer,op4_weapon_ents[i],"Hamtouch")
#endif
register_forward(FM_PlayerPreThink,"FMPlayerPreThink", 1) // Set player speed,and gravity
register_forward(FM_EmitSound,"FMEmitSound") // Block crowbar sound
register_forward(FM_CmdStart, "FMCmdStart") // Toggle nightvision
register_forward(FM_GetGameDescription,"gamename")
register_event("ResetHUD","event_hud_reset", "be") // Fix zombie-spawn-first-time bug
// MultiLangual File
register_dictionary("zsm_hl.txt")
// Team list
static string[100];
format(string,99,"%s;%s",HUMAN_MODEL,ZOMBIE_MODEL)
set_cvar_num("mp_teamplay",21)
set_cvar_num("mp_flashlight",1)
set_cvar_string("mp_teamlist",string)
// Prevent HL engine light
set_cvar_num("sv_skycolor_r", 0)
set_cvar_num("sv_skycolor_g", 0)
set_cvar_num("sv_skycolor_b", 0)
if(!get_pcvar_num(cvar_hlzm_enable)) zm_enabled = 0
else set_task(3.0,"day_light", _, _, _, "b")
formatex(modname, charsmax(modname), "%s %s",PLUGIN,VERSION)
}
public plugin_cfg()
{
if(!get_pcvar_num(cvar_hlzm_enable)) zm_enabled = 0
else
{
new cfg_dir[64]
get_configsdir(cfg_dir,charsmax(cfg_dir))
server_cmd("exec %s/hlzm.cfg",cfg_dir)
set_task(10.0, "thunder_check", _, _, _, "b")
}
}
public plugin_precache()
{
// Gameplay
cvar_hlzm_enable = register_cvar("zm_enable","1")
cvar_lighting = register_cvar("zm_light","a")
cvar_sky = register_cvar("zm_sky","space")
cvar_lt = register_cvar("zm_thunderrate", "90")
// Zombie's Character
cvar_zombiehealth = register_cvar("zombie_health","200")
cvar_zombiearmor = register_cvar("zombie_armor", "0")
cvar_zombiespeed = register_cvar("zombie_speed", "300")
cvar_zombiegravity = register_cvar("zombie_gravity","0.875")
cvar_fs = register_cvar("zombie_silent","1")
cvar_night_enable = register_cvar("zombie_nv_enable","1")
cvar_night_radius = register_cvar("zombie_nv_radius","80")
cvar_night_red = register_cvar("zombie_nv_red","0")
cvar_night_green = register_cvar("zombie_nv_green","255")
cvar_night_blue = register_cvar("zombie_nv_blue","0")
dmgamount = register_cvar("zombie_blood_amount","1")
dmgcolor = register_cvar("zombie_blood_color","200")
// Human's Character
cvar_h_health = register_cvar("human_health","100")
cvar_h_armor = register_cvar("human_armor", "100")
cvar_h_speed = register_cvar("human_speed", "270")
cvar_h_gravity = register_cvar("human_gravity", "1.0")
cvar_zombieextrasound = register_cvar("zombie_custom_sound","1")
cvar_humanextrasound = register_cvar("human_custom_sound","1")
cvar_zombie_spawn = register_cvar("zombie_spawn_sound","1")
cvar_human_spawn = register_cvar("human_spawn_sound","1")
cvar_zombieidle = register_cvar("zombie_idle_duration","15")
cvar_humanidle = register_cvar("human_idle_duration","30")
if(zm_enabled)
{
new arg[100],iNum;
format(arg,99,"models/player/%s/%s.mdl",ZOMBIE_MODEL,ZOMBIE_MODEL)
precache_model(arg)
format(arg,99,"models/player/%s/%s.mdl",HUMAN_MODEL,HUMAN_MODEL)
precache_model(arg)
for (iNum = 0; iNum < sizeof g_ambience_thunder; iNum++)
engfunc(EngFunc_PrecacheSound, g_ambience_thunder[iNum])
if(get_pcvar_num(cvar_zombieextrasound))
{
for (iNum = 0; iNum < sizeof g_zombie_pain_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_zombie_pain_sounds[iNum])
for (iNum = 0; iNum < sizeof g_zombie_idle_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_zombie_idle_sounds[iNum])
for (iNum = 0; iNum < sizeof g_zombie_die_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_zombie_die_sounds[iNum])
for (iNum = 0; iNum < sizeof g_zombie_hitwall_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_zombie_hitwall_sounds[iNum])
}
if(get_pcvar_num(cvar_humanextrasound))
{
for (iNum = 0; iNum < sizeof g_human_idle_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_human_idle_sounds[iNum])
for (iNum = 0; iNum < sizeof g_human_pain_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_human_pain_sounds[iNum])
for (iNum = 0; iNum < sizeof g_human_die_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_human_die_sounds[iNum])
}
if(get_pcvar_num(cvar_zombie_spawn))
{
for (iNum = 0; iNum < sizeof g_zombie_spawn_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_zombie_spawn_sounds[iNum])
}
if(get_pcvar_num(cvar_human_spawn))
{
for (iNum = 0; iNum < sizeof g_human_spawn_sounds; iNum++)
engfunc(EngFunc_PrecacheSound, g_human_spawn_sounds[iNum])
}
precache_model(ZOMBIE_CLAWS)
blood = precache_model("sprites/blood.spr")
blood2 = precache_model("sprites/bloodspray.spr")
}
}
public client_connect(id)
{
if(is_user_connected(id))
{
if(zm_enabled)
{
// Reset all variables
g_spawned[id] = false
g_zombie[id] = false
g_nvisionenabled[id] = 0; }
client_cmd(id,"suitvolume 1.0") // Set HEV suit volume to normal
}
}
public event_hud_reset(id)
{
if(zm_enabled) {
if(!g_spawned[id])
{
set_task(0.01,"Hamspawn",id)
g_spawned[id] = true
}
}
}
public gamename()
{
forward_return(FMV_STRING, modname)
return FMRES_SUPERCEDE
}
public Hamspawn(id)
{
if(!zm_enabled || !is_user_connected(id)) return HAM_IGNORED;
client_print(id,print_chat,"%L", id, "HL_ZM")
if (get_user_team(id) == 2) // Zombie
{
client_cmd(id,"impulse 101")
g_zombie[id] = true
client_cmd(id,"suitvolume 0.0")
if(get_pcvar_num(cvar_zombie_spawn))
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)
remove_task(TASK_STRIP + id)
// Fakemeta
set_pev(id, pev_health, get_pcvar_float(cvar_zombiehealth)) // use decimal number
set_pev(id, pev_armorvalue, get_pcvar_float(cvar_zombiearmor)) // use decimal number
set_task(get_pcvar_float(cvar_zombieidle), "zombie_play_idle", id+TASK_ZIDLE, _, _, "b")
client_print(id,print_chat,"%L", id, "FL_PRESS")
}
else if (get_user_team(id) == 1) // Human
{
g_zombie[id] = false
client_cmd(id,"suitvolume 1.0")
if(get_pcvar_num(cvar_human_spawn))
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)
// Fakemeta
set_pev(id, pev_health, get_pcvar_float(cvar_h_health)) // use decimal number
set_pev(id, pev_armorvalue, get_pcvar_float(cvar_h_armor)) // use decimal number
set_task(get_pcvar_float(cvar_humanidle), "human_play_idle", id+TASK_HIDLE, _, _, "b")
client_print(id,print_chat,"%L", id, "FL_HM_PRESS")
}
return HAM_IGNORED
}
public Hamtakedamage(victim, inflictor, attacker, Float:damage, damagetype)
{
if(!zm_enabled) return HAM_IGNORED
if(victim == attacker || !is_user_connected(victim)) return HAM_IGNORED
if(g_zombie[victim])
{
if(get_pcvar_num(cvar_zombieextrasound))
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)
if(get_pcvar_num(dmgamount))
{
new origin[3]
get_user_origin(victim,origin)
new hitpoint, weapon
get_user_attacker(victim,weapon,hitpoint)
switch(hitpoint)
{
case 1:get_user_origin(victim,origin,1)
case 2:origin[2] += 25
case 3:origin[2] += 10
case 4:{origin[2] += 10;origin[0] += 5;origin[1] += 5;}
case 5:{origin[2] += 10;origin[0] -= 5;origin[1] -= 5;}
case 6:{origin[2] -= 10;origin[0] += 5;origin[1] += 5;}
case 7:{origin[2] -= 10;origin[0] -= 5;origin[1] -= 5;}
}
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_BLOODSPRITE)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
switch(get_pcvar_num(dmgamount))
{
case 1:{write_short(blood);write_short(blood);}
case 2:{write_short(blood2);write_short(blood);}
default:{write_short(blood2);write_short(blood2);}
}
write_byte(get_pcvar_num(dmgcolor))
write_byte(10)
message_end()
}
}
if(!g_zombie[victim] && get_pcvar_num(cvar_humanextrasound))
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)
return HAM_IGNORED
}
public FMPlayerPreThink(id)
{
if(!zm_enabled) return FMRES_IGNORED
if(!is_user_connected(id)) return FMRES_IGNORED
if (g_zombie[id] && get_user_team(id) == 2) // zombie in zombie team
{
if(!is_user_alive(id))
{
if(get_pcvar_num(cvar_zombieextrasound))
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)
return FMRES_IGNORED
}
if(get_pcvar_num(cvar_fs))
set_pev(id, pev_flTimeStepSound, 999)
set_pev(id, pev_gravity, get_pcvar_float(cvar_zombiegravity))
set_pev(id, pev_maxspeed, get_pcvar_float(cvar_zombiespeed))
if(get_user_weapon(id) != HLW_CROWBAR)
{
if(!task_exists(TASK_STRIP + id))
set_task(0.5, "Task_Strip", TASK_STRIP + id)
}
else
{
set_pev(id, pev_viewmodel2, ZOMBIE_CLAWS)
set_pev(id, pev_weaponmodel2, "")
}
}
else if(g_zombie[id] && get_user_team(id) == 1 && is_user_alive(id)) // zombie in human team
{
client_print(id,print_chat,"%L", id, "USED_MDL_CMD")
user_slap(id,500000)
g_zombie[id] = false
}
else if(!g_zombie[id] && get_user_team(id) == 1) // human in human team
{
if(!is_user_alive(id))
{
if(get_pcvar_num(cvar_humanextrasound))
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)
return FMRES_IGNORED
}
set_pev(id, pev_gravity, get_pcvar_float(cvar_h_gravity))
set_pev(id, pev_maxspeed, get_pcvar_float(cvar_h_speed))
}
return FMRES_IGNORED
}
// Ham Player Killed Forward
public HamPlayerKilled(victim, attacker, shouldgib)
{
if(!zm_enabled)return HAM_IGNORED
if(g_zombie[victim] && get_pcvar_num(cvar_zombieextrasound))
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)
else if(!g_zombie[victim] && get_pcvar_num(cvar_humanextrasound))
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)
return HAM_IGNORED;
}
public FMEmitSound(id, channel, sample[], Float:volume, Float:attn, flag, pitch)
{
if(!zm_enabled) return FMRES_IGNORED
if(!is_user_connected(id)) return FMRES_IGNORED
if (g_zombie[id] && (equal(sample,"weapons/cbar_hit1.wav") || equal(sample,"weapons/cbar_hit2.wav")))
{
if(get_pcvar_num(cvar_zombieextrasound))
{
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)
new aim[3]
get_user_origin(id, aim, 3)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
write_coord(aim[0])
write_coord(aim[1])
write_coord(aim[2])
write_byte(blooddecalwad[random_num(0,sizeof blooddecalwad - 1)])
message_end()
return FMRES_SUPERCEDE;
}
else return FMRES_SUPERCEDE;
}
// disable default pain and death sound
if(sample[0] == 'p' && sample[3] == 'y' && sample[10] == 'p' && sample[11] == 'a')
return FMRES_SUPERCEDE;
return FMRES_IGNORED
}
// Thank you for your source code, Mercylezz ;)
public FMCmdStart(id, handle)
{
if(!zm_enabled) return FMRES_IGNORED;
// Check if it's a flashlight impulse
if (g_zombie[id] && (get_uc(handle, UC_Impulse) & 100))
{
set_uc(handle, UC_Impulse, 0)
// Block it
set_uc(handle, UC_Impulse, 0)
if(get_pcvar_num(cvar_night_enable))
{
g_nvisionenabled[id] = !(g_nvisionenabled[id])
remove_task(id+TASK_NVISION)
if (g_nvisionenabled[id]) set_task(0.1, "set_user_nvision", id+TASK_NVISION, _, _, "b")
}
}
return FMRES_IGNORED;
}
public Hamtouch(ent, id)
{
if(!zm_enabled || !is_user_connected(id)) return HAM_IGNORED
if (g_zombie[id]) return HAM_SUPERCEDE
return HAM_IGNORED
}
// Ham Use Stationary Gun Forward, thanks mercylezz
public HamUseStationary(entity, caller, activator, use_type)
{
if(!zm_enabled) return HAM_IGNORED;
// Prevent zombies from using stationary guns
if (use_type == 2 && is_user_connected(caller) && g_zombie[caller])
return HAM_SUPERCEDE;
return HAM_IGNORED;
}
public ham_BloodColor( id )
{
if(!zm_enabled) return HAM_IGNORED;
if(is_user_connected(id) && get_user_team(id) == 2)
{
SetHamReturnInteger( get_pcvar_num(dmgcolor) )
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public day_light()
{
static lighting[12],arg[1996];
get_pcvar_string(cvar_lighting, lighting, charsmax(lighting))
if(!equal(lighting,""))
engfunc(EngFunc_LightStyle, 0, lighting)
// Custom sky
get_pcvar_string(cvar_sky,arg,charsmax(arg))
if(!equal(arg,""))
set_cvar_string("sv_skyname",arg)
else
set_cvar_string("sv_skyname","")
}
public thunder_check()
{
static thunders[2]
get_pcvar_string(cvar_lighting, thunders, charsmax(thunders))
strtolower(thunders) // Converts all chars in string to lower case
if (thunders[0] == '0')
{
remove_task(THUNDER)
remove_task(THUNDER_PRECHECK)
return;
}
new Float:thunder_checkrate = get_pcvar_float(cvar_lt)
if(thunder_checkrate > 0.0 && !task_exists(THUNDER_PRECHECK) && !task_exists(THUNDER)) // if thunder enabled
{
g_lights_reach = 0
g_thunder_randomswitch = random_num(0,1)
set_task(thunder_checkrate, "thundershow", THUNDER_PRECHECK)
if (!task_exists(THUNDER)) engfunc(EngFunc_LightStyle, 0, thunders)
}
}
public thundershow()
{
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)
// Set lightstyle sequently
switch (g_thunder_randomswitch)
{
case 0: { engfunc(EngFunc_LightStyle, 0, lights_thunder1[g_lights_reach]);}
case 1: { engfunc(EngFunc_LightStyle, 0, lights_thunder2[g_lights_reach]);}
}
g_lights_reach++
if (g_lights_reach >= thunderchance()) {
remove_task(THUNDER)
thunder_check()
}
else if (!task_exists(THUNDER))
set_task(0.1, "thundershow", THUNDER, _, _, "b")
}
/* Stock */
public Task_Strip(taskman)
{
new id = taskman - TASK_STRIP
//Fakemeta
fm_strip_user_weapons(id)
fm_give_item(id, "weapon_crowbar")
set_pev(id, pev_viewmodel2, ZOMBIE_CLAWS)
set_pev(id, pev_weaponmodel2, "")
}
stock fm_strip_user_weapons(index) {
new ent = fm_create_entity("player_weaponstrip");
if (!pev_valid(ent))
return 0;
dllfunc(DLLFunc_Spawn, ent);
dllfunc(DLLFunc_Use, ent, index);
engfunc(EngFunc_RemoveEntity, ent);
return 1;
}
stock fm_give_item(index, const item[]) {
new ent = fm_create_entity(item);
if (!pev_valid(ent))
return 0;
new Float:origin[3];
pev(index, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, index);
if (pev(ent, pev_solid) != save)
return ent;
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
// Custom Night Vision
public set_user_nvision(taskid)
{
new id = taskid - TASK_NVISION
// Zombie
if (get_pcvar_num(cvar_night_enable) && g_zombie[id] && is_user_alive(id))
{
// Get player's origin
static origin[3]
get_user_origin(id, origin)
// Nightvision message
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
write_byte(TE_DLIGHT) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]) // z
write_byte(get_pcvar_num(cvar_night_radius)) // radius
write_byte(get_pcvar_num(cvar_night_red)) // r
write_byte(get_pcvar_num(cvar_night_green)) // g
write_byte(get_pcvar_num(cvar_night_blue)) // b
write_byte(2) // life
write_byte(0) // decay rate
message_end()
}
}
// Play idle zombie sounds, created by MercyLezz and edited by me
public zombie_play_idle(taskid)
{
new id = taskid - TASK_ZIDLE
// Not enable or not alive
if (!get_pcvar_num(cvar_zombieextrasound) || !is_user_alive(id))
{
remove_task(TASK_ZIDLE)
return ;
}
// Zombie idle
if (g_zombie[id])
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)
}
// Play idle human sounds
public human_play_idle(taskid)
{
new id = taskid - TASK_HIDLE
// Not enable or not alive
if (!get_pcvar_num(cvar_humanextrasound) || !is_user_alive(id))
{
remove_task(TASK_HIDLE)
return ;
}
// Human idle
if (!g_zombie[id])
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)
}
stock thunderchance() {
switch (g_thunder_randomswitch)
{
case 0: return charsmax(lights_thunder1)
case 1: return charsmax(lights_thunder2)
}
return false
}