Raised This Month: $ Target: $400
 0% 

[SOLVED] Bump text on hudmessage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-23-2010 , 22:11   [SOLVED] Bump text on hudmessage?
Reply With Quote #1

Anyone know how to bump the text down using format?
Say this function is called twice, I want to display the last text shown below the new text.

I have been playing around with it, but it has been so long since I last did any kind of tricks with format.

Any ideas?


Code:
g_Buffer += format(g_Message,sizeof(g_Message)-g_Buffer,"text^n");
__________________


Last edited by mysticssjgoku4; 05-25-2010 at 01:37.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-23-2010 , 22:13   Re: Bump text on hudmessage?
Reply With Quote #2

afaik it's automatic. When I do 3 tsay messages in a row they who one under the other.
__________________
fysiks is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-23-2010 , 22:30   Re: Bump text on hudmessage?
Reply With Quote #3

Code:
new g_Messages[3][256]; fn() {         new message[256]     format(message,255,"Text!^nCongratulations!, %s^n^n",ANotify,g_Names[id]);         copy(g_Messages[0],255,g_Messages[1]);     copy(g_Messages[1],255,g_Messages[2]);     copy(g_Messages[2],255,message);         new Messages[768];     format(Messages,767,"%s%s%s",g_Messages[2],g_Messages[1],g_Messages[0]); }

Hmm...this is all I could come up with. There's gotta be a better way...no?
__________________


Last edited by mysticssjgoku4; 05-23-2010 at 22:52.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 05-24-2010 , 16:56   Re: Bump text on hudmessage?
Reply With Quote #4

You can check this plugin.I don't know if it's exactly what your looking for, but w/e :-D
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-24-2010 , 17:05   Re: Bump text on hudmessage?
Reply With Quote #5

Code:
#define MAX_MESSAGES 3 new g_szMessages[ MAX_MESSAGES ][ 256 ]; new g_iMessageOffset; AddMessage( const szMessageFmt[ ], any:... ) {     vformat( g_szMessages[ g_iMessageOffset ], charsmax( g_szMessages[ ] ), szMessageFmt, 2 );         g_iMessageOffset = ++g_iMessageOffset % MAX_MESSAGES; } GetMessages( szOutput[ ], const iLen ) {     setc( szOutput, iLen, 0 );         for( new i = MAX_MESSAGES - 1; i >= 0; i-- )     {         add( szOutput, iLen, g_szMessages[ ( i + g_iMessageOffset ) % MAX_MESSAGES ] );     } }

Code:
YourFunction( ) {     AddMessage( "Text!^nCongratulations!, %s^n^n", ANotify, g_Names[ id ] );         new szMessages[ 768 ];     GetMessages( szMessages, charsmax( szMessages ) );         // .. }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-25-2010 at 17:35.
Exolent[jNr] is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-24-2010 , 21:07   Re: Bump text on hudmessage?
Reply With Quote #6

Are you using an array of strings or just one string with a new-line between lines?

PHP Code:
#define AddText(%1,%2,%3)    (format(%1,%2,"%s^n%s",%3,%1))

//Usage:
AddTextszDestString charsmaxszDestString ) , "Add_to_Top" ); 
Example output when called 10 times with a number incrementing + 1 each pass:
Code:
10
9
8
7
6
5
4
3
2
1
__________________

Last edited by Bugsy; 05-24-2010 at 23:01.
Bugsy is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-25-2010 , 01:36   Re: Bump text on hudmessage?
Reply With Quote #7

Thank you exolent! Great code, had to change one line of your code, but implemented works exactly as I wanted. Strange that I could not do that with format. Hmm could've sworn I had done that before, but that is alright.
Thank you all!

----
PS change
Code:
copyc( szOutput, iLen, 0 );

to

Code:
copyc( szOutput, iLen, "", 0 );
__________________


Last edited by mysticssjgoku4; 05-25-2010 at 01:38.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-25-2010 , 17:35   Re: Bump text on hudmessage?
Reply With Quote #8

Quote:
Originally Posted by mysticssjgoku4 View Post
PS change
Code:
copyc( szOutput, iLen, 0 );

to

Code:
copyc( szOutput, iLen, "", 0 );
I meant to use setc() instead of copyc().
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 05:19.


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