Kód: #include <amxmodx> #include <zombieplague>
#define PLUGIN "[ZP] Addon: Display the Current Mode" #define VERSION "0.1.4" #define AUTHOR "meTaLiCroSS"
/* enum { MODE_INFECTION = 1, MODE_NEMESIS, MODE_SURVIVOR, MODE_SWARM, MODE_MULTI, MODE_PLAGUE } */
new const g_ModeNames[][] = { "Waiting for New Mode...", "Single Mode" , "Nemesis Mode", "Survivor Mode", "Swarm Mode", "Multi-Infection Mode", "Plague Mode", "Undefined Mode" }
new const g_Colors[sizeof(g_ModeNames)][3] = { {255, 255, 255}, {0, 255, 0}, {255, 0, 0}, {0, 0, 255}, {255, 255, 0}, {0, 255, 0}, {255, 0, 0}, {255, 255, 255} }
// X Hudmessage Position ( ||| ) const Float:HUD_MODE_X = 0.65
// Y Hudmessage Position ( --- ) const Float:HUD_MODE_Y = 0.10
// Variables new g_SyncHud, g_Mode, g_EnableCvar, g_CentralCvar
public plugin_init() { // Plugin Info register_plugin(PLUGIN, VERSION, AUTHOR) // Round Start Event register_event("HLTV", "event_round_start", "a", "1=0", "2=0") // Enable Cvar g_EnableCvar = register_cvar("zp_display_mode", "1") // Server Cvar register_cvar("zp_addon_dtcm", VERSION, FCVAR_SERVER|FCVAR_SPONLY) set_cvar_string("zp_addon_dtcm", VERSION) // Variables g_SyncHud = CreateHudSyncObj() // Getting "zp_on" cvar if(cvar_exists("zp_on")) g_CentralCvar = get_cvar_pointer("zp_on") // If Zombie Plague is not running (bugfix) if(!get_pcvar_num(g_CentralCvar)) pause("a") }
public client_putinserver(id) { // Setting Hud set_task(1.5, "mode_hud", id, _, _, "b") }
public event_round_start() { g_Mode = 0 }
public mode_hud(id) { // If the Cvar isn't enabled if(!get_pcvar_num(g_EnableCvar)) return; // Hud Options set_hudmessage(g_Colors[g_Mode][0], g_Colors[g_Mode][1], g_Colors[g_Mode][2], HUD_MODE_X, HUD_MODE_Y, 0, 6.0, 12.0) // Little Bug Fix ("Current Mode: Waiting for New Mode" ---> "Waiting for New Mode") if(g_Mode == 0) ShowSyncHudMsg(id, g_SyncHud, "%s", g_ModeNames[g_Mode]) else ShowSyncHudMsg(id, g_SyncHud, "Current Mode: %s", g_ModeNames[g_Mode]) }
public zp_round_started(mode, id) { g_Mode = mode if( !(1 <= mode < (sizeof(g_ModeNames) - 1)) ) { g_Mode = sizeof(g_ModeNames) - 1 } }
|