#include <amxmodx>
#include <zombieplague>
#include <cstrike>
#include <engine>
/*================================================================================
 [Customizations]
=================================================================================*/
 
// Hudmessage tag
new const hud_tag[] = "Jelenlegi játék mód : "
#define INFORMERTID 100503
new g_MaxClients;
new g_HudText;
// Name for each Hudmessage Mode
new const mode_names[][] =
{
   "Várakozás az új játék módra...",   // No mode Started
   "Normál fertőzés",      // Normal Infection, single round
   "Nemesis",         // Nemesis Mode (zombie boss)
   "Túlélő",      // Survivor Mode (human boss)
   "Raj MĂłd",         // Swarm round (no infections)
   "Többszörös fertőzés",      // Multiple Infection (like single round, but, more than 1 zombie)
   "Pestis MĂłd",         // Plague round (nemesis & zombies vs. survivors & humans)
   "Sniper",         // Sniper Mode (human boss)
   "Assassin",         // Assasin Mode (zombie boss)
   "Armageddon MĂłd"         // LNJ round (nemesis & zombies vs. survivors & humans)
}
 
// RGB Colors for each Hudmessage Mode
new const rgb_hud_colors[sizeof(mode_names)][3] =
{
//   R   G   B
   {255,    240,    245},   // No mode Started
   {30,    144,  255  },      // Normal Infection, single round
   {255,    0,    0},         // Nemesis Mode (zombie boss)
   {0,    191,    255},      // Survivor Mode (human boss)
   {255,    255,    0},         // Swarm round (no infections)
   {104,    34,    139},       // Multiple Infection (like single round, but, more than 1 zombie)
   {0,    0,    128},         // Plague round (nemesis & zombies vs. survivors & humans)
   {0,    139,    0},         // Sniper Mode (human boss)
   {255,    69,    0},         // Assasin Mode (zombie boss)
   {255,    18,    137}         // LNJ round (nemesis & zombies vs. survivors & humans)
}
 
// X Hudmessage Position ( --- )
const Float:HUD_MODE_X = 0.70
 
// 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
 
public plugin_init() 
{
   // Plugin Info
   register_plugin("[ZP] Addon: Display the Current Mode", "0.1.7", "meTaLiCroSS & SeniorRamos")
 
   // Round Start Event
   register_event("HLTV", "event_RoundStart", "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)
   set_task(0.1, "Informer", INFORMERTID, "", 0, "b");
   // Variables
   g_SyncHud = CreateHudSyncObj()
   g_MaxClients = get_global_int(GL_maxClients);
   g_HudText = 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") 
}
 
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
}
 
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, 0.90, 0.2)
 
   // 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
}