dxGetTextWidth | Multi Theft Auto: Wiki Skip to content

dxGetTextWidth

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function retrieves the theoretical width (in pixels) of a certain piece of text, if it were to be drawn using dxDrawText.

Syntax

dxGetTextWidth ( )

Code Examples

client

This will show you the width of a message in a normal chatbox sent by a player

function dxwidth(msg)
chatbox = getChatboxLayout()
local length = dxGetTextWidth(msg,chatbox["chat_scale"][1])
outputChatBox(tostring(length))
end
addEventHandler("onClientChatMessage",root,dxwidth)