#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
/*================================================================================
[Customizations]
=================================================================================*/
#define HUD_ZM_WIN 0, 255, 0, 0.01, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1
#define HUD_ZM_FAIL 255, 255, 0, 0.01, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1
#define HUD_HM_WIN 0, 255, 0, 0.01, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1
#define HUD_HM_FAIL 255, 255, 0, 0.01, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1
#define HUD_NO_ONE 255, 255, 255, 0.01, 0.25, 1, 0.0, 5.0, 1.0, 1.0, -1
#define BONUS_ZM_WIN 6
#define BONUS_ZM_FAIL 2
#define BONUS_HM_WIN 6
#define BONUS_HM_FAIL 2
#define BONUS_NO_ONE 5
// Hudmessage tag
new const hud_tag[] = "Jelenlegi mod: "
// Name for each Hudmessage Mode
new const mode_names[][] =
{
"Varakozas az uj modra...", // No mode Started
"Normal fertozeses", // Normal Infection, single round
"Nemesis mod", // Nemesis Mode (zombie boss)
"Tulelo mod", // Survivor Mode (human boss)
"Raj mod", // Swarm round (no infections)
"Tobbszoros fertozeses mod", // Multiple Infection (like single round, but, more than 1 zombie)
"Pestis mod", // Plague round (nemesis & zombies vs. survivors & humans)
"Ismeretlen mod" // An unofficial mode (edited/created/modified by user)
}
// RGB Colors for each Hudmessage Mode
new const rgb_hud_colors[sizeof(mode_names)][3] =
{
// R G B
{255, 255, 255}, // No mode Started
{0, 255, 0}, // Normal Infection, single round
{255, 0, 0}, // Nemesis Mode (zombie boss)
{0, 0, 255}, // Survivor Mode (human boss)
{255, 255, 0}, // Swarm round (no infections)
{0, 255, 0}, // Multiple Infection (like single round, but, more than 1 zombie)
{255, 0, 0}, // Plague round (nemesis & zombies vs. survivors & humans)
{255, 255, 255} // An unofficial mode (edited/created/modified by user)
}
// X Hudmessage Position ( --- )
const Float:HUD_MODE_X = 0.65
// Y Hudmessage Position ( ||| )
const Float:HUD_MODE_Y = 0.2
// Time at which the Hudmessage is displayed. (when user is puted into the Server)
const Float:START_TIME = 3.0
/*================================================================================
Customization ends here! Yes, that's it. Editing anything beyond
here is not officially supported. Proceed at your own risk...
=================================================================================*/
// Variables
new g_SyncHud, g_Mode
// Cvar pointers
new cvar_enable, cvar_central
new g_maxplayers
new Float:g_roundstart_time,Float:g_roundtime;
new g_playtime = 1
new pcvar_roundtime, pcvar_freezetime
new gMaxPlayers
new g_status_sync
new const speak[ 10 ][] = {
"ebasound56/one.wav",
"ebasound56/two.wav",
"ebasound56/three.wav",
"ebasound56/four.wav",
"ebasound56/five.wav",
"ebasound56/six.wav",
"ebasound56/seven.wav",
"ebasound56/eight.wav",
"ebasound56/nine.wav",
"ebasound56/ten.wav"
}
new countdown
public plugin_init()
{
// Plugin Info
register_plugin("[ZP] Addon: Display the Current Mode", "0.1.6", "meTaLiCroSS")
// Round Start Event
register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
// Enable Cvar
cvar_enable = register_cvar("zp_display_mode", "1")
// Server Cvar
register_cvar("zp_addon_dtcm", "v0.1.6 by meTaLiCroSS", FCVAR_SERVER|FCVAR_SPONLY)
// Variables
g_SyncHud = CreateHudSyncObj()
// Getting "zp_on" cvar
if(cvar_exists("zp_on"))
cvar_central = get_cvar_pointer("zp_on")
// If Zombie Plague is not running (bugfix)
if(!get_pcvar_num(cvar_central))
pause("a")
register_dictionary ( "zp_bonus_ammopack.txt" )
g_maxplayers = get_maxplayers ( )
register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w")
register_logevent("eRoundEnd", 2, "1=Round_End")
register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
register_logevent("eRoundStart", 2, "1=Round_Start")
gMaxPlayers = get_maxplayers()
pcvar_roundtime = get_cvar_pointer("mp_roundtime")
pcvar_freezetime = get_cvar_pointer("mp_freezetime")
set_task(1.0, "get_informer", 1, "", 0, "b")
register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")
register_dictionary("zp_aim_info.txt")
g_status_sync = CreateHudSyncObj()
}
public plugin_precache() {
precache_sound( "ebasound56/ten.wav" )
precache_sound( "ebasound56/nine.wav" )
precache_sound( "ebasound56/eight.wav" )
precache_sound( "ebasound56/seven.wav" )
precache_sound( "ebasound56/six.wav" )
precache_sound( "ebasound56/five.wav" )
precache_sound( "ebasound56/four.wav" )
precache_sound( "ebasound56/three.wav" )
precache_sound( "ebasound56/two.wav" )
precache_sound( "ebasound56/one.wav" )
}
public client_putinserver(id)
{
// Setting Hud
set_task(START_TIME, "mode_hud", id, _, _, "b")
}
public event_RoundStart()
{
// Update var (no mode started / in delay)
g_Mode = 0
set_task(3.0, "zombie_countdown")
countdown = 9
}
public mode_hud(id)
{
// If the Cvar isn't enabled
if(!get_pcvar_num(cvar_enable))
return;
// Hud Options
set_hudmessage(rgb_hud_colors[g_Mode][0], rgb_hud_colors[g_Mode][1], rgb_hud_colors[g_Mode][2], HUD_MODE_X, HUD_MODE_Y, 0, 6.0, 12.0)
// Now the hud appears
ShowSyncHudMsg(id, g_SyncHud, "%s%s", (g_Mode == 0 ? "" : hud_tag), mode_names[g_Mode])
}
public zp_round_started(mode, id)
{
// Update var with Mode num
g_Mode = mode
// An unofficial mode
if(!(1 <= mode < (sizeof(mode_names) - 1)))
g_Mode = sizeof(mode_names) - 1
}
public zp_round_ended ( Team ) {
if ( Team == WIN_ZOMBIES )
{
for ( new i = 1; i <= g_maxplayers ; i++ )
{
if ( ! is_user_connected ( i ) ) continue;
if ( zp_get_user_zombie ( i ) || zp_get_user_nemesis ( i ) )
{
set_hudmessage ( HUD_ZM_WIN )
show_hudmessage(i, "%L", LANG_PLAYER, "WIN" , BONUS_ZM_WIN)
zp_set_user_ammo_packs ( i , zp_get_user_ammo_packs ( i ) + BONUS_ZM_WIN );
}
else
{
set_hudmessage( HUD_ZM_FAIL )
show_hudmessage(i, "%L", LANG_PLAYER, "FAIL" , BONUS_ZM_FAIL)
zp_set_user_ammo_packs ( i , zp_get_user_ammo_packs ( i ) - BONUS_ZM_FAIL );
}
}
}
else if ( Team == WIN_HUMANS)
{
for ( new i = 1; i <= g_maxplayers ; i++ )
{
if ( ! is_user_connected ( i ) ) continue;
if ( zp_get_user_human ( i ) || zp_get_user_survivor ( i ) )
{
set_hudmessage( HUD_HM_WIN )
show_hudmessage( i, "%L", LANG_PLAYER, "WIN" , BONUS_HM_WIN)
zp_set_user_ammo_packs( i, zp_get_user_ammo_packs( i ) + BONUS_HM_WIN );
}
else
{
set_hudmessage( HUD_HM_FAIL )
show_hudmessage ( i , "%L", LANG_PLAYER, "FAIL" , BONUS_HM_FAIL)
zp_set_user_ammo_packs ( i , zp_get_user_ammo_packs ( i ) - BONUS_HM_FAIL ) ;
}
}
}
else
{
for ( new i = 1; i <= g_maxplayers ; i++ )
{
if ( ! is_user_connected ( i ) ) continue;
set_hudmessage ( HUD_NO_ONE )
show_hudmessage ( i , "%L", LANG_PLAYER, "NO_ONE" , BONUS_NO_ONE )
zp_set_user_ammo_packs ( i , zp_get_user_ammo_packs ( i ) + BONUS_NO_ONE ) ;
}
}
}
stock zp_get_user_human ( id )
return ( ! zp_get_user_survivor ( id ) && ! zp_get_user_nemesis ( id ) && ! zp_get_user_zombie ( id ) )
public eRestart() {
g_playtime = 0
}
public eRoundEnd() {
g_playtime = 0
}
public eNewRound() {
g_playtime = 1
new Float:freezetime = get_pcvar_float(pcvar_freezetime)
if(freezetime)
{
// g_newround_time = get_gametime()
}
g_roundtime = floatmul(get_pcvar_float(pcvar_roundtime), 60.0) - 1.0
}
public eRoundStart() {
g_playtime = 2
g_roundstart_time = get_gametime()
}
public get_remaining_seconds() {
if(g_playtime==2){
return floatround( g_roundtime - ( get_gametime() - g_roundstart_time ) , floatround_ceil )
}else{
return 0
}
return PLUGIN_HANDLED
}
public get_informer()
{
new human, timer
timer = get_remaining_seconds()
human = zp_get_human_count()
for( new id = 1; id <= gMaxPlayers; id++ )
{
if(is_user_alive(id))
{
if(zp_get_user_zombie(id))
{
if(human==0)
{
set_hudmessage(255, 0, 0, 0.01, 0.18, 1, 1.0, 1.0)
}else{
set_hudmessage(255, 0, 0, 0.01, 0.18, 0, 1.0, 1.0)
}
show_hudmessage(id, "[eb@ - Info] Zombi vagy^nElo emberek: %i", human)
}else{
if(timer<10){
set_hudmessage(0, 0, 255, 0.01, 0.18, 1, 1.0, 1.0)
}else{
set_hudmessage(0, 0, 255, 0.01, 0.18, 0, 1.0, 1.0)
}
show_hudmessage(id, "[eb@ - Info] Ember vagy^nKITARTAS!-> Fanmaradotido: %i", timer)
}
}
}
}
public showStatus(id)
{
if(!is_user_bot(id) && is_user_connected(id))
{
new name[32], pid = read_data(2)
get_user_name(pid, name, 31)
new color1 = 0, color2 = 0
new team1 = zp_get_user_zombie(id), team2 = zp_get_user_zombie(pid)
if (team2 == 1)
color1 = 255
else
color2 = 255
if (team1 == team2) // friend
{
set_hudmessage(color1, 50, color2, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
ShowSyncHudMsg(id, g_status_sync, "%L", LANG_PLAYER, "AIM_INFO", name, get_user_health(pid), get_user_armor(pid), zp_get_user_ammo_packs(pid))
}
}
}
public hideStatus(id)
{
ClearSyncHud(id, g_status_sync)
}
public zombie_countdown() {
emit_sound( 0, CHAN_VOICE, speak[ countdown ], 1.0, ATTN_NORM, 0, PITCH_NORM )
set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);
show_hudmessage(0, "Fertozesig hatravan: %i masodperc!", countdown);
countdown--
if(countdown > 0) {
set_task(1.0, "zombie_countdown")
}
}