PHP Code:
/*================================================================================
-----------------------------------
-*- [ZP] Class : Invisible Zombie -*-
-----------------------------------
~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
Press the key [E] to be Invisible.
================================================================================*/
#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
new g_activated[33];
new maxplayers;
// Zombie attribute
new g_zclass_izombie, g_invisible_amount;
new const zclass_name[] = { "Invisible Zombie" }
new const zclass_info[] = { "Invisible" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 1500
const zclass_speed = 250
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.0
public plugin_init()
{
maxplayers = get_maxplayers()
static id;
for (id = 1; id <= maxplayers; id++)
g_activated[id] = 0
register_plugin("[ZP] Zombie Classes : Invisible Zombie", "1.0", "zombieplague")
g_invisible_amount = register_cvar("zp_izombie_invisibility", "100")
register_forward(FM_CmdStart, "CmdStart");
g_zclass_izombie = 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_izombie)
{
client_print(player, print_chat, "[ZP] To be Invisible press the key [E].")
}
}
public CmdStart(Client, Handle)
{
if(!is_user_alive(Client) || !is_user_alive(Client))
return FMRES_IGNORED
static Buttons, OldButtons;
Buttons = get_uc(Handle, UC_Buttons);
OldButtons = pev(Client, pev_oldbuttons);
if(zp_get_user_zombie(Client) && zp_get_user_zombie_class(Client) == g_zclass_izombie)
{
if ((Buttons & IN_USE) && !(OldButtons & IN_USE))
{
g_activated[Client] = 1
set_task(get_pcvar_float(g_invisible_amount), "uninvisible", Client)
fm_set_rendering(Client, kRenderFxGlowShell,0,0,0,kRenderTransAlpha, 50)
}
else if(g_activated[Client])
client_print(Client, print_chat, "[ZP] You're already invisible.")
}
return FMRES_IGNORED
}
public uninvisible(taskid)
{
fm_set_rendering(taskid, kRenderFxNone, 0,0,0,kRenderNormal, 255)
g_activated[taskid] = 0
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 255)
{
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);
set_pev(entity, pev_renderfx, fx);
set_pev(entity, pev_rendercolor, RenderColor);
set_pev(entity, pev_rendermode, render);
set_pev(entity, pev_renderamt, float(amount));
return 1;
}