Raised This Month: $12 Target: $400
 3% 

Help / Support Help hud info zp 5.0.8


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NxLAxcall
Junior Member
Join Date: Dec 2015
Old 10-14-2016 , 05:08   Help hud info zp 5.0.8
Reply With Quote #1

Can someone fix my zp 5.0.8 hud info
Im trying to add armor info but there was a problem
The hud is not showing armor info

Im newbie hehe

here the code:

Code:
/*================================================================================
	
	----------------------------
	-*- [ZP] HUD Information -*-
	----------------------------
	
	This plugin is part of Zombie Plague Mod and is distributed under the
	terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
	
================================================================================*/

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <zp50_class_human>
#include <zp50_class_zombie>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
#define LIBRARY_ASSASSIN "zp50_class_assassin"
#include <zp50_class_assassin>
#define LIBRARY_SURVIVOR "zp50_class_survivor"
#include <zp50_class_survivor>
#define LIBRARY_SNIPER "zp50_class_sniper"
#include <zp50_class_sniper>
#define LIBRARY_AMMOPACKS "zp50_ammopacks"
#include <zp50_ammopacks>

const Float:HUD_SPECT_X = 0.6
const Float:HUD_SPECT_Y = 0.8
const Float:HUD_STATS_X = 0.01
const Float:HUD_STATS_Y = 0.28

const HUD_STATS_ZOMBIE_R = 200
const HUD_STATS_ZOMBIE_G = 250
const HUD_STATS_ZOMBIE_B = 0

const HUD_STATS_HUMAN_R = 0
const HUD_STATS_HUMAN_G = 200
const HUD_STATS_HUMAN_B = 250

const HUD_STATS_SPEC_R = 255
const HUD_STATS_SPEC_G = 255
const HUD_STATS_SPEC_B = 255

#define TASK_SHOWHUD 100
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)

const PEV_SPEC_TARGET = pev_iuser2

new g_MsgSync

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_ASSASSIN) || equal(module, LIBRARY_SURVIVOR) || equal(module, LIBRARY_SNIPER) || 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")
			
		// Assassin Class loaded?
		else if (LibraryExists(LIBRARY_ASSASSIN, LibType_Library) && zp_class_assassin_get(player))
			formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_ASSASSIN")
		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_SURVIVOR, LibType_Library) && zp_class_survivor_get(player))
			formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SURVIVOR")

		// Sniper Class loaded?
		else if (LibraryExists(LIBRARY_SNIPER, LibType_Library) && zp_class_sniper_get(player))
			formatex(class_name, charsmax(class_name), "%L", ID_SHOWHUD, "CLASS_SNIPER")
		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))

// Show name, health, class, and money
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(player))
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "%L: %s^nHP: %d - %L %s - %L $ %d", ID_SHOWHUD, "SPECTATING", player_name, get_user_health(player), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "MONEY1", cs_get_user_money(player))
}
else
{
// Show health, class
set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)

if (LibraryExists(LIBRARY_AMMOPACKS, LibType_Library))
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "[Health: %d]^n[%L %s]^n[%L %d]^n[%d]", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name, ID_SHOWHUD, "AMMO_PACKS1", zp_ammopacks_get(ID_SHOWHUD)), get_user_armor(ID_SHOWHUD)
else
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "[Health: %d]^n[%L %s]", get_user_health(ID_SHOWHUD), ID_SHOWHUD, "CLASS_CLASS", class_name)
}
}

Last edited by NxLAxcall; 10-14-2016 at 05:08.
NxLAxcall is offline
NxLAxcall
Junior Member
Join Date: Dec 2015
Old 10-17-2016 , 02:36   Re: Help hud info zp 5.0.8
Reply With Quote #2

Annyone? Help
NxLAxcall is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 10-17-2016 , 10:46   Re: Help hud info zp 5.0.8
Reply With Quote #3

This is from my main ZPNM plugin. Read it carefully and implement what you need into your own.
Code:
    // Spectating someone else?     if (id != ID_SHOWHUD)     {         // Show name, health, class, and ammo packs         set_dhudmessage(255, 255, 255, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0) // | , -1)         //ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L^n[%s]^n[%L: %d]^n[%L: %d]^n[%L %s]^n[%L %d]", ID_SHOWHUD, "SPECTATING", g_playername[id], ID_SHOWHUD, "ZOMBIE_ATTRIB1", pev(id, pev_health), ID_SHOWHUD, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id])         show_dhudmessage(ID_SHOWHUD, "%L^n[%s]^n[%L: %d]^n[%L: %d]^n[%L %s]^n[%L %d]", ID_SHOWHUD, "SPECTATING", g_playername[id], ID_SHOWHUD, "ZOMBIE_ATTRIB1", pev(id, pev_health), ID_SHOWHUD, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id])     }     else     {         // Show health, class and ammo packs         set_dhudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0) // | , -1)         //ShowSyncHudMsg(id, g_MsgSync2, "[%L: %d][%L: %d][%L %s][%L %d]", id, "ZOMBIE_ATTRIB1", pev(id, pev_health), id, "CLASS_CLASS", class, id, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), id, "AMMO_PACKS1", g_ammopacks[id])         show_dhudmessage(id, "[%L: %d][%L: %d][%L %s][%L %d]", id, "ZOMBIE_ATTRIB1", pev(id, pev_health), id, "ZOMBIE_ATTRIB5", pev(id, pev_armorvalue), id, "CLASS_CLASS", class, id, "AMMO_PACKS1", g_ammopacks[id])     }
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
NxLAxcall
Junior Member
Join Date: Dec 2015
Old 10-18-2016 , 07:33   Re: Help hud info zp 5.0.8
Reply With Quote #4

Thanks you for helping me
NxLAxcall is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode