Raised This Month: $ Target: $400
 0% 

how to show translated text in hud?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-30-2021 , 08:40   Re: how to show translated text in hud?
Reply With Quote #2

You would use TextMsg to do that. I implemented the following code based on regamedll source, refer to for more examples. Make sure you to not pass a string with length greater than 190 characters, otherwise the server will probably crash.

Code:
enum
{
	HUD_PRINTNOTIFY = 1,
	HUD_PRINTCONSOLE,
	HUD_PRINTTALK,
	HUD_PRINTCENTER,
	HUD_PRINTRADIO
}

new gmsgTextMsg

...

public plugin_init()
{
	gmsgTextMsg = get_user_msgid("TextMsg")
}

...

// Print to everyone
UTIL_ClientPrintAll(msg_dest, msg_name[], param1[]="", param2[]="", param3[]="", param4[]="")
{
	message_begin(MSG_ALL, gmsgTextMsg)
	write_string(msg_name)
	if (param1[0])
		write_string(param1)
	if (param2[0])
		write_string(param2)
	if (param3[0])
		write_string(param3)
	if (param4[0])
		write_string(param4)
	message_end()
}

// Print to single client
UTIL_ClientPrint(client, msg_dest, msg_name[], param1[]="", param2[]="", param3[]="", param4[]="")
{
	message_begin(MSG_ONE, gmsgTextMsg, _, client)
	write_string(msg_name)
	if (param1[0])
		write_string(param1)
	if (param2[0])
		write_string(param2)
	if (param3[0])
		write_string(param3)
	if (param4[0])
		write_string(param4)
	message_end()
}

// Usage
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Bomb_Defused")
__________________









Last edited by CrazY.; 08-30-2021 at 08:43.
CrazY. is offline
 



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 02:34.


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