PHP Code:
#include <amxmodx>
#include <zombieplague>
new const zclass_name[] = "Blinding Zombie"
new const zclass_info[] = "Blinding humans"
new const zclass_model[] = "zombie_source"
new const zclass_clawmodel[] = "v_knife_zombie.mdl"
const zclass_health = 1800
const zclass_speed = 200
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.0
new g_blinder, gmsgFade, cvar_fadecolor, cvar_fadealpha, fadealpha
public plugin_init()
{
register_event("StatusValue", "EventStatusValue", "b", "1>0", "2>0" );
// RRR, GGG, BBB format
cvar_fadecolor = register_cvar("zp_blinding_color", "10 150 10")
cvar_fadealpha = register_cvar("zp_blinding_alpha", "250")
gmsgFade = get_user_msgid("ScreenFade")
}
public plugin_precache()
{
register_plugin("[ZP] Extra Class: Blinding Zombie", "0.1", "fiendshard")
g_blinder = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public plugin_cfg()
{
fadealpha = get_pcvar_num(cvar_fadealpha)
}
public EventStatusValue( const id )
{
if(!is_user_bot(id) && is_user_connected(id) && !zp_get_user_zombie(id))
{
new blinder = read_data(2)
if(zp_get_user_zombie_class(blinder) == g_blinder)
blind(id)
}
}
public blind(id)
{
new szColor[12], szRed[4], szGreen[4], szBlue[4]
get_pcvar_string(cvar_fadecolor, szColor, 11)
parse(szColor, szRed, 3, szGreen, 3, szBlue, 4)
new iRed = clamp(str_to_num(szRed), 0, 255)
new iGreen = clamp(str_to_num(szGreen), 0, 255)
new iBlue = clamp(str_to_num(szBlue) , 0, 255)
message_begin(MSG_ONE_UNRELIABLE, gmsgFade, {0, 0, 0}, id)
write_short(1<<2) // fade duration
write_short(1<<11) // fade hold time
write_short(1<<12) // fade type (in / out)
write_byte(iRed) // red
write_byte(iGreen) // green
write_byte(iBlue) // blue
write_byte(fadealpha) // alpha
message_end()
}
???