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

dhud messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luciaus18
Senior Member
Join Date: Dec 2014
Old 12-02-2020 , 16:35   dhud messages
Reply With Quote #1

Hello! I want to change hud to dhud message. Someone told me here how to do but I don't wana do it wrong.. If someone can spend some time to help me, I will be thankful

Code:
/* 
 Bomb Countdown HUD Timer v0.2 by SAMURAI

	* Plugin Details
 With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
  Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.

	* Required Modules:
 - CSX
 
        * Credits:
- Emp` for various indicates
- Alka for full tests 

	* Changelog
 - Fixed Events problems
 - Pcvars
 - Fixed any bug on plugin

*/


#include <amxmodx>
#include <csx>
 
#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.2"
#define AUTHOR "SAMURAI" 
 
new g_c4timer, pointnum;
new bool:b_planted = false;

new g_msgsync;
 
 
public plugin_init()
{
	register_plugin(PLUGIN,VERSION,AUTHOR);
 
	pointnum = get_cvar_pointer("mp_c4timer");
 
	register_logevent("newRound", 2, "1=Round_Start");
	register_logevent("endRound", 2, "1=Round_End");
	register_logevent("endRound", 2, "1&Restart_Round_");
 
	g_msgsync = CreateHudSyncObj();
}
 
public newRound()
{
	g_c4timer = -1;
	remove_task(652450);
	b_planted = false;
}
 
public endRound()
{
	g_c4timer = -1;
	remove_task(652450);
}
 
public bomb_planted()
{
	b_planted = true;
	g_c4timer = get_pcvar_num(pointnum);
	dispTime()
	set_task(1.0, "dispTime", 652450, "", 0, "b");
}
 
public bomb_defused()
{
	if(b_planted)
	{
		remove_task(652450);
		b_planted = false;
	}
    
}
 
public bomb_explode()
{
	if(b_planted)
	{
		remove_task(652450);
		b_planted = false;
	}
	
}
 
public dispTime()
{   
	if(!b_planted)
	{
		remove_task(652450);
		return;
	}
        
 
	if(g_c4timer >= 0)
	{
		if(g_c4timer > 13) set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
		else if(g_c4timer > 7) set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
		else set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
 
		ShowSyncHudMsg(0, g_msgsync, "Villains will destroy the world in: %d seconds", g_c4timer);
 
		--g_c4timer;
	}
  
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
luciaus18 is offline
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 12-23-2020 , 08:18   Re: dhud messages
Reply With Quote #2

Quote:
Originally Posted by luciaus18 View Post
Hello! I want to change hud to dhud message. Someone told me here how to do but I don't wana do it wrong.. If someone can spend some time to help me, I will be thankful

Code:
/* 
 Bomb Countdown HUD Timer v0.2 by SAMURAI

	* Plugin Details
 With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
  Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.

	* Required Modules:
 - CSX
 
        * Credits:
- Emp` for various indicates
- Alka for full tests 

	* Changelog
 - Fixed Events problems
 - Pcvars
 - Fixed any bug on plugin

*/


#include <amxmodx>
#include <csx>
 
#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.2"
#define AUTHOR "SAMURAI" 
 
new g_c4timer, pointnum;
new bool:b_planted = false;

new g_msgsync;
 
 
public plugin_init()
{
	register_plugin(PLUGIN,VERSION,AUTHOR);
 
	pointnum = get_cvar_pointer("mp_c4timer");
 
	register_logevent("newRound", 2, "1=Round_Start");
	register_logevent("endRound", 2, "1=Round_End");
	register_logevent("endRound", 2, "1&Restart_Round_");
 
	g_msgsync = CreateHudSyncObj();
}
 
public newRound()
{
	g_c4timer = -1;
	remove_task(652450);
	b_planted = false;
}
 
public endRound()
{
	g_c4timer = -1;
	remove_task(652450);
}
 
public bomb_planted()
{
	b_planted = true;
	g_c4timer = get_pcvar_num(pointnum);
	dispTime()
	set_task(1.0, "dispTime", 652450, "", 0, "b");
}
 
public bomb_defused()
{
	if(b_planted)
	{
		remove_task(652450);
		b_planted = false;
	}
    
}
 
public bomb_explode()
{
	if(b_planted)
	{
		remove_task(652450);
		b_planted = false;
	}
	
}
 
public dispTime()
{   
	if(!b_planted)
	{
		remove_task(652450);
		return;
	}
        
 
	if(g_c4timer >= 0)
	{
		if(g_c4timer > 13) set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
		else if(g_c4timer > 7) set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
		else set_hudmessage(127, 0, 255, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);
 
		ShowSyncHudMsg(0, g_msgsync, "Villains will destroy the world in: %d seconds", g_c4timer);
 
		--g_c4timer;
	}
  
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Still need this?

Adding the dhudmessage include and modifying "hud" for "dhud" and removing the last "-1" won't do the trick in this code as it requires more modifications.

I recommend you use Style C4 Timer by Ocixcrom:

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

It has a ".ini" configurator that let you change the hud for DHUD.

it's a tested mod and works perfectly with 1.8.2 +.

Last edited by Ark_Procession; 12-23-2020 at 09:13.
Ark_Procession is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-23-2020 , 08:49   Re: dhud messages
Reply With Quote #3

Quote:
You can also use a plugin that doesn't rely on a hud message for the bomb timer like :

https://forums.alliedmods.net/showthread.php?p=483666
My plugin also has such an option.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Ark_Procession
Senior Member
Join Date: Jun 2020
Location: Argentina
Old 12-23-2020 , 09:12   Re: dhud messages
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
My plugin also has such an option.
my bad. thats true.

edited the post
Ark_Procession is offline
Reply


Thread Tools
Display Modes

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 11:05.


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