/*
[ZP] Class : Noclip Zombie
( Powerful zombie class )
by Fry!
Description :
Another zombie class is made, but this zombie can walk through walls every time you want.
How to use noclip? It's easy just bind [key] +noclip. There is small amount of time given to you before noclip will end, however you will lose
HP like (50
HP in 1 second),
but this negative ability is limited. This means that while using noclip you will lose your health but maximum
HP what will be wasted 750
HP and after loosing 750
HP this "negative" ability won't work on you anymore.
Example if you have 1500 health and nobody is shooting at you and you start to use noclip about in 15 seconds you will lose 1500 - 750(lost health) = 750(remaining health). But these numbers you can easy change by cvars.
Note :
If You want to use this zombie class for admins only just uncomment //#define FOR_ADMINS
Class only available for flag A admins.
Cvars :
zp_noclip_cooldown "10.0" - How long cooldown you will need to wait to use it again.
zp_noclip_long "15.0" - How long you can use noclip before cooldown.
zp_noclip_start_lose_hp "1.0" - After how much seconds you will start to lose hp.
zp_noclip_lost_hp "50" - How much
HP you will lose, in 1 second.
zp_noclip_max_lost_hp "750" - Zombie will lose maximum health while using noclip from his total health.
Credits :
GHW_Chronic - for his Toggleable Noclip plugin
Changelog :
09/11/2008 - v1.0 - First release
09/11/2008 - v1.0.1 - added command to turn noclip off.
09/11/2008 - v1.2 - fixed that noclip was working without pressing binded key, added cooldown, added how long you can walk through walls.
01/01/2009 - v1.2.4 - removed fun module, added cvar, corrected code, added possibility if class want to use admins only.
26/06/2009 - v1.2.8 - addded negative ability for noclip zombie when you will use noclip to long you will start to lose hp, added max lost
HP (with cvar) cleaned code, optimized code.
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "[ZP] Class : Noclip Zombie"
#define VERSION "1.2.8"
#define AUTHOR "Fry!"
//#define FOR_ADMINS
#if defined FOR_ADMINS
#define ADMINACCESS ADMIN_LEVEL_A
#endif
new const zclass_name[] = { "Noclip Zombie" }
new const zclass_info[] = { "HP-- Speed+++ Knockback++" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 1500
const zclass_speed = 270
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.50
new g_zclass_noclip, g_noclip_start_lose_hp, g_noclip_lost_hp, g_noclip_cooldown, g_noclip_long, g_noclip_max_lost_hp
new Float:g_noclip_time[33]
new bool:g_hasNoclip[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("zp_zclass_noclip_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
g_noclip_cooldown = register_cvar("zp_noclip_cooldown", "10.0")
g_noclip_long = register_cvar("zp_noclip_long", "15.0")
g_noclip_start_lose_hp = register_cvar("zp_noclip_start_lose_hp", "1.0")
g_noclip_lost_hp = register_cvar("zp_noclip_lost_hp", "50")
g_noclip_max_lost_hp = register_cvar("zp_noclip_max_lost_hp", "750")
register_concmd("+noclip","cmd_noclip", ADMIN_USER, "bind [key] +noclip")
register_clcmd("-noclip","cmd_off")
}
public plugin_precache()
{
g_zclass_noclip = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public zp_user_infected_post(player, infector)
{
if (zp_get_user_zombie_class(player) == g_zclass_noclip)
{
if (cmd_noclip(player))
{
lose_hp(player)
}
g_hasNoclip[player] = true
g_noclip_time[player] = get_gametime()
client_print(player, print_chat, "[ZP] To use noclip (bind [key] +noclip)")
}
}
public cmd_noclip(id)
{
if (!is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_HANDLED
if (zp_get_user_zombie_class(id) != g_zclass_noclip)
return PLUGIN_CONTINUE
#if defined FOR_ADMINS
if (!( get_user_flags(id) & ADMINACCESS))
{
client_print(id, print_chat, "[ZP] Sorry, Noclip Zombie is only for admins available.")
return PLUGIN_CONTINUE
}
#endif
g_hasNoclip[id] = true
fm_set_user_noclip(id, 1)
g_noclip_time[id] = get_gametime()
set_task(get_pcvar_float(g_noclip_start_lose_hp), "lose_hp", id)
if (get_gametime() - g_noclip_time[id] < get_pcvar_float(g_noclip_cooldown))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public cmd_off(id)
{
if (!is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_HANDLED
if (zp_get_user_zombie_class(id) != g_zclass_noclip)
return PLUGIN_CONTINUE
#if defined FOR_ADMINS
if (!( get_user_flags(id) & ADMINACCESS) )
{
client_print(id, print_chat, "[ZP] Sorry, Noclip Zombie is only for admins available.")
return PLUGIN_CONTINUE
}
#endif
fm_set_user_noclip(id, 0)
set_task(get_pcvar_float(g_noclip_long), "cmd_off", id)
if (get_gametime() - g_noclip_time[id] < get_pcvar_float(g_noclip_cooldown))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public lose_hp(id)
{
new lost_hp = get_user_health(id)
new max_hp = zp_get_zombie_maxhealth(id) - lost_hp
if (max_hp <= get_pcvar_num(g_noclip_lost_hp))
{
set_pev(id, pev_health, lost_hp - float(max_hp))
}
if (max_hp == get_pcvar_float(g_noclip_max_lost_hp))
{
remove_task(id)
return PLUGIN_CONTINUE
}
if (cmd_noclip(id))
{
set_pev(id, pev_health, lost_hp - get_pcvar_float(g_noclip_lost_hp))
}
if (cmd_off(id))
{
remove_task(id)
}
return PLUGIN_HANDLED
}
stock fm_set_user_noclip(index, noclip = 0)
{
set_pev(index, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK)
return 1
}