TrapLord Studios™ Posted August 8, 2013 Share Posted August 8, 2013 Goodnight again, I would like to know if there is a way to Center align text when using the outputChatBox function. Link to comment
xXMADEXx Posted August 9, 2013 Share Posted August 9, 2013 I believe you'd need to make a custom chatbox for that... Link to comment
TrapLord Studios™ Posted August 9, 2013 Author Share Posted August 9, 2013 Oh. Alright. Link to comment
50p Posted August 9, 2013 Share Posted August 9, 2013 Simpler would be to make a custom function and still use the built in chatbox. How? I can give you some tips: 1. Use getChatboxLayout to find out client's chatbox layout (width, scale and scale of text) 2. Calculate the length of the string using dxGetTextWidth 3. Calculate width of a space (" ") 4. Find out how many spaces you will need to make the text in the center of the chatbox 5. Add the spaces at the front of the message 6. Output the new message with the spaces needed. This idea would work client-side only but you can make it server-side too by sending the client's chatbox layout to the server when they join in (onClientResourceStart -> triggerServerEvent) and then send the message to every player separately in a loop, or triggerClientEvent with the message that need to be centered and do the calculations client-side. Link to comment
TrapLord Studios™ Posted August 9, 2013 Author Share Posted August 9, 2013 Yea I figured it out, !Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now