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

How to transfrom HUD messages to Dhud messages?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 11-21-2021 , 09:11   How to transfrom HUD messages to Dhud messages?
Reply With Quote #1

Hello. I want to make this HUD message to be Dhud.

The following code is the code that is responsible for the ZP's HUD message that shows health, class, ammo, armor, etc...

Code:
	// Spectating someone else?
	if (id != ID_SHOWHUD)
	{
		// Show name, health, class, and ammo packs and armor
		set_hudmessage(0, 0, 128, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1)
		ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L %s^nHP: %d - %L %s - %L %d - %L %d", ID_SHOWHUD, "SPECTATING", g_playername[id],
		pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
	}
	else
	{
		// Show health, class and ammo packs and armor
		set_hudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
		ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync2, "%L: %d - %L %s - %L %d - %L %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS",
		class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(ID_SHOWHUD, pev_armorvalue))
	}
}
I replaced:
Code:
set_hudmessage
with this:
Code:
set_dhudmessage
and this:
Code:
ShowSyncHudMsg
with this:
Code:
show_dhudmessage
When i tried to compile the plugin, i got the following warning and errors:

// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(10509) : warning 213: tag mismatch
// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(10510) : error 035: argument type mismatch (argument 2)
// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(10516) : warning 213: tag mismatch
// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(10517) : error 035: argument type mismatch (argument 2)
// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(13479) : warning 204: symbol is assigned a value that is never used: "g_MsgSync2"


Then, i opened the main code again, and used Ctrl+F to find all lines that contain "g_MsgSync2", so i can delete "g_MsgSync2".

Then i edited the following codes by removing (deleting) what is marked in red:

In the "// Game vars" section:
Code:
new g_MsgSync, g_MsgSync2 , g_MsgSync3// message sync objects
Then i edited this:

Code:
	// Create the HUD Sync Objects
	g_MsgSync = CreateHudSyncObj()
	g_MsgSync2 = CreateHudSyncObj()
	g_MsgSync3 = CreateHudSyncObj()
This is the main HUD code. In red is marked what I deleted:

Code:
	// Spectating someone else?
	if (id != ID_SHOWHUD)
	{
		// Show name, health, class, and ammo packs and armor
		set_dhudmessage(0, 0, 128, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1)
		show_dhudmessage(ID_SHOWHUD, g_MsgSync2, "%L %s^nHP: %d - %L %s - %L %d - %L %d", ID_SHOWHUD, "SPECTATING", g_playername[id],
		pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
	}
	else
	{
		// Show health, class and ammo packs and armor
		set_dhudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
		show_dhudmessage(ID_SHOWHUD, g_MsgSync2, "%L: %d - %L %s - %L %d - %L %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS",
		class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(ID_SHOWHUD, pev_armorvalue))
	}
}
So, the 2 errors are now fixed. However, the 2 warnings are still here:

// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(1050 : warning 213: tag mismatch
// C:\Mod\cstrike\addons\amxmodx\scripting\zombi e_plague_advance_v1-6-1.sma(10515) : warning 213: tag mismatch


This is line 10508:
Code:
set_dhudmessage(0, 0, 128, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1)
This is line 10515:
Code:
set_dhudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
This is the whole code where the two error-causing lines are contained:

Code:
	// Spectating someone else?
	if (id != ID_SHOWHUD)
	{
		// Show name, health, class, and ammo packs and armor
		set_dhudmessage(0, 0, 128, HUD_SPECT_X, HUD_SPECT_Y, 1, 6.0, 1.1, 0.0, 0.0, -1)
		show_dhudmessage(ID_SHOWHUD, "%L %s^nHP: %d - %L %s - %L %d - %L %d", ID_SHOWHUD, "SPECTATING", g_playername[id],
		pev(id, pev_health), ID_SHOWHUD, "CLASS_CLASS", class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[id], ID_SHOWHUD, "ARMOR", pev(id, pev_armorvalue))
	}
	else
	{
		// Show health, class and ammo packs and armor
		set_dhudmessage(red, green, blue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
		show_dhudmessage(ID_SHOWHUD, "%L: %d - %L %s - %L %d - %L %d", id, "ZOMBIE_ATTRIB1", pev(ID_SHOWHUD, pev_health), ID_SHOWHUD, "CLASS_CLASS",
		class, ID_SHOWHUD, "AMMO_PACKS1", g_ammopacks[ID_SHOWHUD], ID_SHOWHUD, "ARMOR", pev(ID_SHOWHUD, pev_armorvalue))
	}
}
So, what exactly is mismatched? Would you explain me how the code should be like in order to be understood by the compiler?

Also, will the deletion of "g_MsgSync2" cause any problems with the main code of ZPA, or was "g_MsgSync2" intended only for helping the work of the specific HUD message i want to turn into DHUD, meaning the deletion of "g_MsgSync2" won't affect any of the functions of the main ZPA plugin?

There is one more plugin i have problems with when i try to turn its HUD message into DHUD.

This is the warning i get:

Code:
// C:\Mod\cstrike\addons\amxmodx\scripting\health_reminder_nem.sma(59) : warning 213: tag mismatch
This is line 59:
Code:
set_dhudmessage(0, 255, 0, HUD_MODE_X, HUD_MODE_Y, 0, 6.0, HOLD_TIME, 0.0, 0.0, -1)
The only change i introduced to line 59, was to add "d" before "hudmessage".

Then i changed line 60 from this:
Code:
ShowSyncHudMsg(0, g_SyncHud, "Nemesis still has %d health points!", get_user_health(id))
To this:
Code:
show_dhudmessage(0, "Nemesis still has %d health points!", get_user_health(id))
I replaced "ShowSyncHudMsg" with "show_dhudmessage", and then i deleted "g_SyncHud,", and "new g_SyncHud" which was added at the top of the code.

In both plugins, the health reminder plugin and the main ZPA code, i added "#include <dhudmessage>" at the top of the code, where the names of includes are added. However, i still get warnings and errors.

Can someone explain to me what I'm doing wrong? I would like someone to explain to me how to turn HUD messages into DHUD.

Here is the original code of the health reminder plugin, in case you need to see the original code before explaining whether or not the changes i introduced are correct:

Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN_NAME "[ZP] Nemesis Health Reminder"
#define PLUGIN_VERS "1.0"
#define PLUGIN_AUTH "zmd94"

#define TASK_HEALTH 95000

#define HOLD_TIME     2.0

const Float:HUD_MODE_X = -1.0
const Float:HUD_MODE_Y = 0.20
const Float:START_TIME = 6.0

new g_SyncHud

public plugin_init() 
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
	
	// Fwd's
	RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
	
	g_SyncHud = CreateHudSyncObj()
}

public Fwd_PlayerSpawn_Post(id)
{
	if (task_exists(id+TASK_HEALTH))
		remove_task(id+TASK_HEALTH)
}

public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
{
	if (task_exists(victim+TASK_HEALTH))
		remove_task(victim+TASK_HEALTH)
}

public zp_round_started(mode, id)
{
	if (mode != MODE_NEMESIS)
		return
		
	if (!zp_get_user_nemesis(id))
		return
		
	set_task(START_TIME, "Task_ShowHealth", id+TASK_HEALTH, _, _, "b") 
}

public Task_ShowHealth(id)
{
	id -= TASK_HEALTH
	
	if (!zp_get_user_nemesis(id))
		remove_task(id+TASK_HEALTH)
	
	set_hudmessage(0, 255, 0, HUD_MODE_X, HUD_MODE_Y, 0, 6.0, HOLD_TIME, 0.0, 0.0, -1)
	ShowSyncHudMsg(0, g_SyncHud, "Nemesis still has %d health points!", get_user_health(id))
}
I use AMXX 1.8.2

Thanks.

Last edited by GlobalPlague; 11-22-2021 at 02:57.
GlobalPlague is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 11-21-2021 , 10:22   Re: How to transfrom HUD messages to Dhud messages?
Reply With Quote #2

Quote:
Originally Posted by GlobalPlague View Post

I use AMXX 1.8.2
Use AMXX 1.9.0.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-21-2021 , 10:59   Re: How to transfrom HUD messages to Dhud messages?
Reply With Quote #3

https://forums.alliedmods.net/showthread.php?t=335242

Why did you open another thread?
__________________

Last edited by HamletEagle; 11-21-2021 at 11:00.
HamletEagle is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 11-22-2021 , 02:59  
Reply With Quote #4

Quote:
Originally Posted by Shadows Adi View Post
Use AMXX 1.9.0.
I will upgrade my server to AMXX 1.9.0, but not now. When I upgrade it, some of the plugins cause errors. When i have enough free time to fix the errors, i will upgrade the server to AMXX 1.9.0.

Quote:
Originally Posted by HamletEagle View Post
The new thread has more details. The old thread didn't get enough helpful answers, and I still don't know how to fix the warnings. The old thread was about specific plugin, while the new thread is intended to get answers about how to make HUD into DHUD in general, not only in a specific plugin.

Also, I included extra questions in the new thread, and if answered, I will obtain a better understanding of the way I should make the codes to work.

Last edited by HamletEagle; 11-22-2021 at 07:40. Reason: merged multiple posts
GlobalPlague is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-22-2021 , 07:39   Re: How to transfrom HUD messages to Dhud messages?
Reply With Quote #5

Quote:
Originally Posted by GlobalPlague View Post
The new thread has more details. The old thread didn't get enough helpful answers, and I still don't know how to fix the warnings. The old thread was about specific plugin, while the new thread is intended to get answers about how to make HUD into DHUD in general, not only in a specific plugin.

Also, I included extra questions in the new thread, and if answered, I will obtain a better understanding of the way I should make the codes to work.
Do not open multiple threads for the same topic.
Do not open a new thread if the old one doesn't get "enough helpful answers". This is against the rules.
You should have edited your old thread and then left a comment saying you updated the original post with more information/questions.

Also, if you want to reply to multiple people please do it in one single post. Don't post multiple replies one after the other.
__________________

Last edited by HamletEagle; 11-22-2021 at 07:41.
HamletEagle 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 17:18.


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