Raised This Month: $32 Target: $400
 8% 

How to use Hud Instead of Print.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NTARIS
Member
Join Date: Dec 2020
Location: Greece
Old 10-10-2021 , 10:28   How to use Hud Instead of Print.
Reply With Quote #1

Guys i have this code in zp extra item bazooka


Code:
public rk_sound(player) {

	if (!rksound[player])
	{
		engfunc(EngFunc_EmitSound, player, CHAN_WEAPON, getrocket, 1.0, ATTN_NORM, 0, PITCH_NORM)
		client_print(player, print_center, "[Bazooka] Reloaded")
		rksound[player] = true
	}
	else if (rksound[player])
	{
		
	}
	
}

How to convert that into hud message instead of a printed message.But the hud to be alligned in
center too.




Thanks in advance.

Last edited by NTARIS; 10-10-2021 at 10:28.
NTARIS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-10-2021 , 18:03   Re: How to use Hud Instead of Print.
Reply With Quote #2

set_hudmessage() and show_hudmessage(). Look at how other plugins do it if you're unsure of how to use them.
__________________
fysiks is offline
NTARIS
Member
Join Date: Dec 2020
Location: Greece
Old 10-11-2021 , 04:20   Re: How to use Hud Instead of Print.
Reply With Quote #3

Fysiks i know these commands.But i dont know how to replace the above structure with hud message.Because the hud message must appear when the bazooka is reloaded along with the sound.I have tried but i cant figure it out.Would you mind if you know,which part i should remove from the code above and which part of hud message to add so it can work.To help you i just want the hud to be centered and have a visible color hud message.
NTARIS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-11-2021 , 22:36   Re: How to use Hud Instead of Print.
Reply With Quote #4

It's quite simple. Replace the client_print() function with both of the aforementioned functions with the arguments filled in. If you read the documentation, you'll notice that you use a -1.0 for x and y to set the text position to center. In fact, it looks like all arguments have a default value so you don't even need to supply any arguments as a quick test. If you're unsure how to use those functions, look up how other plugins use them. If you tried to write code, post it here and we can help you with it.
__________________

Last edited by fysiks; 10-11-2021 at 22:52.
fysiks is offline
NTARIS
Member
Join Date: Dec 2020
Location: Greece
Old 10-12-2021 , 07:52   Re: How to use Hud Instead of Print.
Reply With Quote #5

Ok,I Figured it out.

I just replaced the below code:

Code:
public rk_sound(player) {

	if (!rksound[player])
	{
		engfunc(EngFunc_EmitSound, player, CHAN_WEAPON, getrocket, 1.0, ATTN_NORM, 0, PITCH_NORM)
		client_print(player, print_center, "[Bazooka] Reloaded")
		rksound[player] = true
	}
	else if (rksound[player])
	{
		
	}
	
}

With this code:

Code:
public rk_sound(player) {

	if (!rksound[player])
	{
		engfunc(EngFunc_EmitSound, player, CHAN_WEAPON, getrocket, 1.0, ATTN_NORM, 0, PITCH_NORM)
		{
set_dhudmessage( 0, 160, 0, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5 );
show_dhudmessage( player, "[BAZOOKA], Reloaded Shoot!!!");
}
		rksound[player] = true
	}
	else if (rksound[player])
	{
	
	}
	
}
Also...
1)I downloaded the dhudmessage include file and placed it under scripting/include folder.
2)Then added at top of .sma file the below code:

Code:
#include <dhudmessage>

Thats all,thanks for giving me ideas.

Last edited by NTARIS; 10-12-2021 at 07:58.
NTARIS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-12-2021 , 09:03   Re: How to use Hud Instead of Print.
Reply With Quote #6

You can use regular hud messages, just saying.
__________________
HamletEagle is offline
NTARIS
Member
Join Date: Dec 2020
Location: Greece
Old 10-12-2021 , 11:48   Re: How to use Hud Instead of Print.
Reply With Quote #7

Thanks for that too.Because the one i make was like Titan Message Size.
NTARIS 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 04:54.


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