public plugin_init() { register_plugin("[ZP] HUD Information", ZP_VERSION_STRING, "ZP Dev Team")
g_MsgSync = CreateHudSyncObj() }
public plugin_natives() { set_module_filter("module_filter") set_native_filter("native_filter") } public module_filter(const module[]) { if (equal(module, LIBRARY_NEMESIS) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_AMMOPACKS)) return PLUGIN_HANDLED;
return PLUGIN_CONTINUE; } public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED;
return PLUGIN_CONTINUE; }
public client_putinserver(id) { if (!is_user_bot(id)) { // Set the custom HUD display task set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b") } }
public client_disconnect(id) { remove_task(id+TASK_SHOWHUD) }
// Show HUD Task public ShowHUD(taskid) { new player = ID_SHOWHUD
// Player dead? if (!is_user_alive(player)) { // Get spectating target player = pev(player, PEV_SPEC_TARGET)
// Target not alive if (!is_user_alive(player)) return; }
// Format classname static class_name[32], transkey[64] new red, green, blue
if (zp_core_is_zombie(player)) // zombies { red = HUD_STATS_ZOMBIE_R green = HUD_STATS_ZOMBIE_G blue = HUD_STATS_ZOMBIE_B
// Nemesis Class loaded? if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_nemesis_get(player)) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_NEMESIS") else { zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_name, charsmax(class_name))
// ML support for class name formatex(transkey, charsmax(transkey), "ZOMBIENAME %s", class_name) if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey) } } else // humans { red = HUD_STATS_HUMAN_R green = HUD_STATS_HUMAN_G blue = HUD_STATS_HUMAN_B
// Survivor Class loaded? if (LibraryExists(LIBRARY_NEMESIS, LibType_Library) && zp_class_survivor_get(player)) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SURVIVOR") else { zp_class_human_get_name(zp_class_human_get_current(player), class_name, charsmax(class_name))
// ML support for class name formatex(transkey, charsmax(transkey), "HUMANNAME %s", class_name) if (GetLangTransKey(transkey) != TransKey_Bad) formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, transkey) } }
// Spectating someone else? if (player != ID_SHOWHUD) { new player_name[32] get_user_name(player, player_name, charsmax(player_name))