Raised This Month: $ Target: $400
 0% 

Say text as a hud


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blackops7799
Senior Member
Join Date: May 2006
Old 10-08-2006 , 15:42   Say text as a hud
Reply With Quote #1

Hey, i was able to make the say text in OOC chat for TSRP a hud. I was wondering if you can get it to stack instead of going over eachother.

Example
[OOC] blackops (( Sup ))

[OOC] DERKA (( hey ))


Code:
public handle_say(id)
{
	new Speech[300], arg[32], arg2[32]

	read_args(Speech, 299)
	remove_quotes(Speech)
	if(equali(Speech,"")) return PLUGIN_HANDLED
	parse(Speech,arg,31,arg2,31) 

	new name[33]
	get_user_name(id,name,sizeof(name))

	if(equali(Speech,"ooc",3))
	{
		if(get_cvar_num("sv_ooc") <= 0) {
			client_print(id,print_chat,"[TalkArea] OOC is currently Disabled!^n")
			return PLUGIN_HANDLED
		}
		replace(Speech,299,"ooc","")
		trim(Speech)
		remove_quotes(Speech)
		set_hudmessage(0, 255, 0, 1.9, 0.60, 0.0, 0.0, 20.0)
		show_hudmessage(0,"^n[OOC] %s: (( %s ))^n",name,Speech)
		client_print(0,print_console,"^n[OOC] %s: (( %s ))^n",name,Speech)

		if( get_cvar_num( "rp_printconsole" ) == 1 ) server_print( Speech )

		return PLUGIN_HANDLED
	}
blackops7799 is offline
blackops7799
Senior Member
Join Date: May 2006
Old 10-08-2006 , 16:31   Re: Say text as a hud
Reply With Quote #2

Anyone have any ideas?

(sorry for double post..)
blackops7799 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-08-2006 , 18:17   Re: Say text as a hud
Reply With Quote #3

Can you not wait one hour. Wait two days, and if nobody replies, then bump. But anyhow, this would be kind of hard to implement. To get you started look in the SDK on how it calcutes chat.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
blackops7799
Senior Member
Join Date: May 2006
Old 10-08-2006 , 18:46   Re: Say text as a hud
Reply With Quote #4

Sry..
blackops7799 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 10-09-2006 , 17:36   Re: Say text as a hud
Reply With Quote #5

Here's my attempt, it compiles but doesn't work. The main problem is getting the hud messages to act like text messages, meaning they stay on screen only for a short period of time, then move up in increments till the max is reached, etc. etc.

Someone more experienced could point out my errors and come up with something better.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Kamil" new g_messagenum = 0 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("say ooc", "ooc_say") } public ooc_say(id) {     new saytext[129]         read_args(saytext, 128)         if(equal(saytext, "ooc", 3))     {         g_messagenum += 1                 new name[33], ooc[4], ooctext[129]         new Float:messagetime = 6.0                 get_user_name(id, name, 32)                 parse(saytext, ooc, 3, ooctext, 128)                 set_hudmessage(255, 255, 0, 0.00, g_messagenum*0.05, 0, messagetime, messagetime, 0.1, 0.1, -1)         show_hudmessage(0, "[OOC] %s (( %s ))", name, ooctext)         set_task(messagetime, "messagereset", 0, "", 0, "b")     } } public messagereset() {     g_messagenum -= 1 }
stupok is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-10-2006 , 00:12   Re: Say text as a hud
Reply With Quote #6

what you could do is:

keep track of a certain ammount of messages, then just put all the messages together to make 1 hud. then after a time period, take away a message.

heres some pseudo code(i think).

player sends a message, message is saved into array[0][]
another player sends a message, message is saved into array[1][]
print array[0]+array[1].
after X seconds, array[0] should be overwritten by array[1] and array[1] should be filled with nothing
print array[0]+array[1]

that should give you a message like hud system. (it made sense in my mind, sorry if it doesn't in yours)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
blackops7799
Senior Member
Join Date: May 2006
Old 10-10-2006 , 16:08   Re: Say text as a hud
Reply With Quote #7

Could you post the code, cause i have no idea what your talking about
blackops7799 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 10-10-2006 , 17:08   Re: Say text as a hud
Reply With Quote #8

Emp` has a clever idea, and I'm sure thats the way the one that you have seen works. I've seen the same plugin in action on a TSRP server.

This is employing a technique like Emp` was describing, but I am no expert on hud_message so someone more experienced will have to point out why it does not work properly. And it's not finished, it's just as far as I'm willing to go right now, because I don't have the time to sit and write a working version.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Kamil" new g_messagenum = 0 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("say ooc", "ooc_say") } public ooc_say(id) {     new saytext[129]         read_args(saytext, 128)         if(equal(saytext, "ooc", 3))     {                 new name[33], ooctext[6][129], i                 get_user_name(id, name, 32)                 replace(ooctext[g_messagenum], 3, "ooc", "")         format(ooctext[g_messagenum], 128, "[OOC] %s (( %s ))", name, ooctext[g_messagenum])                 g_messagenum += 1                 set_task(0.1, "messagedisplay", 0, "", 0, "b")     } } public messagedisplay() {     for(i=0; i<=g_messagenum; i++)     {         set_hudmessage(255, 255, 0, 0.00, i*0.05, 0, 0.1, 0.1, 0.1, 0.1, -1)         show_hudmessage(0, ooctext[g_messagenum])     } }
stupok is offline
blackops7799
Senior Member
Join Date: May 2006
Old 10-11-2006 , 22:16   Re: Say text as a hud
Reply With Quote #9

Well thanks for the help, ill see what i can do. +Karma
blackops7799 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-11-2006 , 23:31   Re: Say text as a hud
Reply With Quote #10

bored and don't want to do hw...

Code:
#include <amxmodx> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Kamil" #define MAX_LINES 6 #define DISPLAY_TIME 1.0 #define REFRESH_TIME 5.0 new ooctext[MAX_LINES][129] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("say ooc", "ooc_say")     set_task(DISPLAY_TIME, "messagedisplay", 0, "", 0, "b")     set_task(REFRESH_TIME, "refreshmessages", 0, "", 0, "b") } public ooc_say(id) {     new saytext[129]         read_args(saytext, 128)         if(equal(saytext, "ooc", 3))     {                 new name[33]                 get_user_name(id, name, 32)                 replace(saytext, 3, "ooc", "")         refreshmessages()         format(ooctext[MAX_LINES-1], 128, "[OOC] %s (( %s ))", name, saytext)     } } public messagedisplay() {     for(new i=0; i<MAX_LINES; i++)     {         set_hudmessage(255, 255, 0, 0.00, i*0.05, 0, 0.1, 0.1, 0.1, 0.1, -1)         show_hudmessage(0, ooctext[i])     } } public refreshmessages() {     for(new i=0; i<MAX_LINES; i++)     {         if(i==MAX_LINES-1)             copy(ooctext[i], 128, "")         else             copy(ooctext[i], 128, ooctext[i+1])     } }
this should work (i think)

Last edited by Emp`; 10-12-2006 at 18:04.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 04:58.


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