Jump to content

Is there a way to?


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...