/*
[ZP] Extra Item : Invisible
( For Humans and Zombies )
by Fry!
Description :
Have You ever wanted that if there are so many zombies around You and then You can't escape from them?
Now You can just buy this ability and You will be invisible until invisible will end or till Death.
Same for zombies. If there are so many Humans around You and can't hide from them then now You can, just buy this ability.
Cvars :
// Medium Invisible
zp_medium_invisble_amount "30" - Amount of invisible
zp_medium_invisible_cost "40" - How much this ability will cost to You
zp_medium_invisible_long "25.0" - How long you will have invisibility
// Max Invisible
zp_max_invisible_amount "5" - Amount of invisible
zp_max_invisible_cost "60" - How much it will cost
zp_max_invisible_long "15.0" - How long you will have invisibility
Credits :
Antibots - For little helping
Dores - For correcting me ^^
Changelog :
19/10/2008 - v1.0 - First release
19/10/2008 - v1.1 - fixed invisibility and removed unnecessary cvar.
19/10/2008 - v1.1.1 - changed to lower render that at least someone could notice invisible person.
19/10/2008 - v1.1.2 - changed plugin name
19/10/2008 - v1.2 - removed unnecessary code and fun module, added some new one and using fakemeta instead. (Thanks for Antibots)
19/10/2008 - v1.2.1 - changed render stuff
24/10/2008 - v1.3 - rewrited plugin, added some cvars and commands.
25/10/2008 - v1.3.1 - fixed small typo. (Thanks to Mlk27)
22/11/2008 - v1.3.2 - added cvar for invisible amount
04/12/2008 - v1.3.4 - fixed invisible was working all the time, added cvar for after how long time invisibility will end.
05/12/2008 - v1.3.6 - corrected chat messages, added message when invisibility are over, changed glow shell cuz that was possibly for player glowing.
05/02/2009 - v1.4.1 - Added 1 more invisibility feature, removed chat commands, fixed round start invisible, removed toggle cvar, fixed small typo caused debug.
05/02/2009 - v1.4.2 - fixed some minor stuff.
*/
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "[ZP] Extra Item : Invisible"
#define VERSION "1.4.2"
#define AUTHOR "Fry!"
new g_item_name[] = "Medium Invisible"
new g_item_name2[] = "Max Invisible"
new g_itemid_invisible, invisible_amount, invisible_cost, invisible_long
new g_itemid_invisible2, invisible_amount2, invisible_cost2, invisible_long2
new bool:g_hasInvisible[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("zp_extra_invisible",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
invisible_amount = register_cvar("zp_medium_invisble_amount", "30")
invisible_cost = register_cvar("zp_medium_invisible_cost", "40")
invisible_long = register_cvar("zp_medium_invisible_long", "25.0")
invisible_amount2 = register_cvar("zp_max_invisible_amount", "5")
invisible_cost2 = register_cvar("zp_max_invisible_cost", "60")
invisible_long2 = register_cvar("zp_max_invisible_long", "15.0")
register_event("DeathMsg", "Death", "a")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_itemid_invisible = zp_register_extra_item(g_item_name, get_pcvar_num(invisible_cost), ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
g_itemid_invisible2 = zp_register_extra_item(g_item_name2, get_pcvar_num(invisible_cost2), ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
}
public client_connect(id)
{
g_hasInvisible[id] = false
fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
}
public client_disconnect(id)
{
g_hasInvisible[id] = false
fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
}
public Death()
{
g_hasInvisible[read_data(2)] = false
}
public event_round_start()
{
for (new i = 1; i <= 32; i++)
{
g_hasInvisible[i] = false
if (is_user_alive(i))
{
set_pev(i, pev_renderfx, kRenderFxNone)
set_pev(i, pev_renderamt, 255.0)
}
}
}
public zp_extra_item_selected(player, itemid)
{
if ( g_hasInvisible[player] )
{
client_print(player, print_chat, "[ZP] Mar megvasaroltad ezt a kepesseget")
return PLUGIN_HANDLED
}
if (itemid == g_itemid_invisible)
{
g_hasInvisible[player] = true
fm_set_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(invisible_amount))
set_task(get_pcvar_float(invisible_long), "invisible_over", player)
client_print(player, print_chat, "[ZP] Vettel egy kozepes lathatatlansagot.")
}
if (itemid == g_itemid_invisible2)
{
g_hasInvisible[player] = true
fm_set_rendering(player, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(invisible_amount2))
set_task(get_pcvar_float(invisible_long2), "invisible_over2", player)
client_print(player, print_chat, "[ZP] Vettel egy teljes lathatatlansagot.")
}
return PLUGIN_CONTINUE
}
public invisible_over(id)
{
g_hasInvisible[id] = false
fm_set_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)
client_print(id, print_chat, "[ZP] Kozepes lathatatlansag kikapcsolva lejart az ido!!!")
}
public invisible_over2(id)
{
g_hasInvisible[id] = false
fm_set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
client_print(id, print_chat, "[ZP] Teljes lathatatlansag kikapcsolva lejart az ido!!!")
}
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
}