[Release] Motion Text - Draw 3D Text Easily

Motion Text - Draw 3D Text Easily

What is this?

An easy way of implementing 3D Text on your server, permanent or not. Also, this is a dev tool.

What can you do?

A bunch of stuff.



Place static text anywhere on the map

Temporarily draw 3D text using the chat.

Draw 3D Text and let it disappear after a specific threshold (with distance).

Possibilities are endless.

Installation

Download motiontext on github.


Place the motiontext folder into your resources folder.
Add start motiontext in your server.cfg (above any resources that use this).

Documentation

  • Draw3DTextPermanent - Draws 3D text permanently on specific coordinates (for static purposes)
exports.motiontext:Draw3DTextPermanent({
   xyz={x = -1377.514282266, y = -2852.64941406, z = 13.9448}, -- At airport 
   text={
       content="Test" --[[This is the string that you want to be displayed]],
       rgb={255 , 255, 255} --[[The color value of the text]],
       textOutline=true --[[ Text outline ]],
       scaleMultiplier=1, --[[ Text Size Multiplier]]
       font=0, --[[ Font type (0-5) ]]
   },
   perspectiveScale=4,
   radius=5000 --[[ The radius of units until the text disappears/reappears ]],
})
  • Draw3DText - Draws 3D text for 1 frame.
Citizen.CreateThread(function()
   while true do --[[ requests every frame ]]
   	Citizen.Wait(1)
   	exports.motiontext:Draw3DText({
   	    xyz= GetEntityCoords(PlayerPedId()), --at your coords 
   	    text={
   	        content="Test" --[[This is the string that you want to be displayed]],
   	        rgb={255 , 255, 255} --[[The color value of the text]],
   	        textOutline=true --[[ Text outline ]],
   	        scaleMultiplier=1, --[[ Text Size Multiplier]]
   	        font=0, --[[ Font type (0-5) ]]
   	    },
   	    perspectiveScale=4,
   	    radius=5000 --[[ The radius of units until the text disappears/reappears ]],
   	})
   end
end)
  • Draw3DTimeout - Draws 3D text for a set amount of time.
-- Uses chat arguments to draw text (temporarily ~2 seconds) at your coords
RegisterCommand("test", function(source, args)
    local argString = table.concat(args, " ") -- concats the args into a string
    exports.motiontext:Draw3DTextTimeout({
	    xyz=GetEntityCoords(PlayerPedId()),
	    timeout=2000, --[[ the amt. of time it takes for the text to disappear (in ms) ]]
	    text={
	        content=argString,
	        rgb={255 , 255, 255},
	        textOutline=true,
	        scaleMultiplier=1,
	        font=0
	    },
	    perspectiveScale=4,
	    radius=5000,
    }) 
end)

Usage

-- CLIENT SIDED ONLY
local vector =  vector3(-1377.514282266, -2852.64941406, 13.9448) 
default = {
    xyz = vector, -- vectors work too
    text={
        content="Test",
        rgb={255 , 255, 255},
        textOutline=true,
        scaleMultiplier=1,
        font=0
    },
    perspectiveScale=4,
    radius=5000,
    timeout=5000
}
exports.motiontext:Draw3DText(default)
exports.motiontext:Draw3DTextPermanent(default)
exports.motiontext:Draw3DTextTimeout(default)
7 Likes

Can you add a function to show a text only on first spawn ?
That can be very cool for tutorials !

3 Likes

This is dope

But we all know that what we really want is a LSPDFR 0.4 Flashlight.

Nice! We need more resources like this. (exports are a powerful tool)

Also I don’t know if you are aware but https://runtime.fivem.net/doc/natives/#_0xAA0008F3BBB8F416 might be able to achieve this in less code. I might take a look myself and pull request if I am able to get it to work.

1 Like

a friend wants to use this to label the front of peoples houses, so we need it to be to persist untilll someone leaves our server or switches houses. is there a /command to edit these in game? if so what is it? and is there way to make them permanent ,

whenever you put a text on the server the server starts dropping fps till its gamebreaking

I don’t know if it’s something wrong with my server but…

I simply dragged and dropped the resource, started it, teleported to where the include ‘Default’ Test text should be…and it’s not there.

There’s been tons of compatibility issues with OneSync lately, and I think that could be it, but do you have any ideas?

I am having an issue as well where text is only seen client side and never goes away on its own. this issue only started happening recently and i am using one sync. i assume onesync has messed something up, has anyone been able to sort this out yet?

Was gonna say that you can see so much lag on the gif he provided

Hello I have DrawText3Ds on my server and the text is not displayed it is just a black band which appears without text

image

dont use Draw3DTextPermanent every frame

how can i make a 3dtext to show everyone? bcz what i got here only work for 1 client

Has anyone made this chat into a script already being used…not being lazy just not great at coding so was curious…thanks and looks awesome…I ask as I saw in a server where you type /me and the text is basically dropped on the ground for a certain time then disappears

hmmmm… okey…