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

Hud message text align


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 05-26-2012 , 12:41   Hud message text align
Reply With Quote #1

Is it possible to align the text in the hud message to the right?

I want to make a hud message that displays text from a variable (the text can vary from 1 to 20+ chars) but keep it on the left side of the screen.

I've tried putting negative values for the X coordinates but it's the same.
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	442
Size:	20.8 KB
ID:	104262  

Last edited by Desikac; 05-26-2012 at 12:41.
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-26-2012 , 22:30   Re: Hud message text align
Reply With Quote #2

You can use Generators > Hudmessage Generator for that...
Using a variable will make it a must to use format or formatex.

new VARIABLE
formatex(szTemp, charsmax(szTemp), "YOUR TEXT HERE", VARIABLE)
set_hudmessage(...)
show_hudmessage(id, VARIABLE)
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-27-2012 , 06:48   Re: Hud message text align
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
You can use Generators > Hudmessage Generator for that...
Using a variable will make it a must to use format or formatex.

new VARIABLE
formatex(szTemp, charsmax(szTemp), "YOUR TEXT HERE", VARIABLE)
set_hudmessage(...)
show_hudmessage(id, VARIABLE)
No.

@OP: I don't think it's possible. You could try counting the characters in the message string and somehow set the position from that, though it will probably not work on different resolutions and will cause problems if the characters width isn't the same (Courier font has this for example), which probably is not.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 05-27-2012 at 06:48.
Backstabnoob is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 05-27-2012 , 09:02   Re: Hud message text align
Reply With Quote #4

Quote:
Originally Posted by Backstabnoob View Post
No.

@OP: I don't think it's possible. You could try counting the characters in the message string and somehow set the position from that, though it will probably not work on different resolutions and will cause problems if the characters width isn't the same (Courier font has this for example), which probably is not.
Thanks for your answer. I did that and like you said, the characters' width, resolutions, fonts do have an effect on the position but I think it worked out quite well:

PHP Code:
    new Float:xcord
    
new len strlen(text0)
    for(new 
0lenb++) {
        
xcord+= 0.0155
        
if(xcord 0.45)
            break
    }
    
xcord 0.46 xcord 
It's not perfect but it does the job.
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
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 08:33.


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