/*
[ZP] Addon: First Zombie Translucent/Invisible
Version: 0.4
Author: Arseny aka Without Soul (ICQ 2453579)
--- Description ---
Gives to the first zombie or translucent, or invisibility on certain quantity of seconds (set CVars).
Also the warning message is shown to all people, depending from chosen mode.
PS It is my first plugin, don't judge strictly... and sorry for my bad English
--- Install ---
1) Extract archive.
2) Next modules and includes may be enabled/present: Zombie Plague, Fun.
3) File "zp_fz_translucent.amxx" place in amxmodx/plugins.
4) File "zp_fz_translucent.txt" place in amxmodx/data/lang.
5) File "zp_fz_translucent.sma" place in amxmodx/scripting.
6) Write "zp_fz_translucent.amxx" in plugins.ini.
7) Restart server.
--- CVars ---
zp_fz_mode <1|0> // Mode: 0 - translucent, 1 - invisibility. Default - 0.
zp_fz_amount <0-100> // Percent of visibility of first zombie, from 0 to 100 % (if zp_fz_mode = 0). Default - 50%.
zp_fz_duration <1-30> // Time on which invisibility is given (if zp_fz_mode = 1). Default - 10 seconds.
zp_fz_warn_humans <1|0> // Warn or not humans. Default - 1.
--- Credits ---
Weltgericht
Excalibur.007
Vesion Comment
===============================
0.1 First release.
0.2 Added new mode: or translucent for all round, or full invisibility for certain number of seconds (setting by CVar).
Added three CVars.
Added Multi-Language support.
0.3 Fixed invisibility for Nemesis.
Added warn for all humans (setting by CVar).
0.4 CVar "zp_fz_amount" now depending from 0 to 100 %.
Fixed shadow under invisible & translucent zombie.
*/
#include <amxmodx>
#include <zombieplague>
#include <fun>
#define PLUGIN_NAME "[ZP] Addon: First Zombie Translucent/Invisible"
#define PLUGIN_VERSION "0.4"
#define PLUGIN_AUTHOR "Arseny aka Without Soul"
new Timer[33];
new g_HudSync;
new cvar_Mode, cvar_Amount, cvar_Duration, cvar_WarnHumans;
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_dictionary("zp_fz_translucent.txt");
cvar_Mode = register_cvar("zp_fz_mode", "0");
cvar_Amount = register_cvar("zp_fz_amount", "50");
cvar_Duration = register_cvar("zp_fz_duration", "10");
cvar_WarnHumans = register_cvar("zp_fz_warn_humans", "1");
g_HudSync = CreateHudSyncObj();
}
public zp_user_infected_post(id, infector) {
if(!is_user_connected(id)) {
return;
}
if(zp_get_user_first_zombie(id)) {
if(zp_get_user_zombie(id) && !zp_get_user_nemesis(id)) {
if(get_pcvar_num(cvar_Mode) <= 0) {
if(get_pcvar_num(cvar_Amount) < 0) {
set_pcvar_num(cvar_Amount, 0);
}
if(get_pcvar_num(cvar_Amount) > 100) {
set_pcvar_num(cvar_Amount, 100);
}
// thnx Excalibur.007
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(cvar_Amount));
set_hudmessage(255, 255, 0, -1.0, 0.3, 1, 1.0, 5.0, 1.0, 1.0, -1);
ShowSyncHudMsg(id, g_HudSync, "%L", id, "TRANSLUCENT", get_pcvar_num(cvar_Amount));
}
if(get_pcvar_num(cvar_Mode) >= 1) {
Timer[id] = get_pcvar_num(cvar_Duration);
invisibility(id);
}
warn_humans();
}
}
else {
set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderNormal, 255);
}
}
public invisibility(id) {
if(!is_user_connected(id)) {
return;
}
if(is_user_alive(id) && !zp_get_user_nemesis(id)) {
if(Timer[id] <= 0) {
set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderNormal, 255);
set_hudmessage(255, 0, 0, -1.0, 0.3, 1, 2.0, 2.0, 1.0, 1.0, -1);
ShowSyncHudMsg(id, g_HudSync, "%L", id, "INVISIBILITY_OFF");
return;
}
// thnx Excalibur.007
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
Timer[id]--;
set_hudmessage(255, 255, 0, -1.0, 0.3, 1, 0.99, 3.0, 0.05, 0.05, -1);
ShowSyncHudMsg(id, g_HudSync, "%L", id, "INVISIBILITY_REMAINING", Timer[id]);
set_task(1.0, "invisibility", id);
}
}
public warn_humans() {
// thnx Weltgericht
new maxplayers = get_maxplayers();
for(new i = 0; i <= maxplayers; i++) {
if(is_user_alive(i) && !zp_get_user_zombie(i) && get_pcvar_num(cvar_WarnHumans) >= 1) {
set_hudmessage(255, 255, 0, -1.0, 0.3, 1, 1.0, 5.0, 1.0, 1.0, -1);
if(get_pcvar_num(cvar_Mode) <= 0) {
ShowSyncHudMsg(i, g_HudSync, "%L", i, "WARN_TRANSLUCENT", get_pcvar_num(cvar_Amount));
}
else {
ShowSyncHudMsg(i, g_HudSync, "%L", i, "WARN_INVISIBILITY", get_pcvar_num(cvar_Duration));
}
}
}
}
public zp_user_humanized_post(id) {
set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderNormal, 255);
}