[help] Floating box with text

Hello, I want to add in certain locations a floating box with text or text with a black background.
I tried using Draw3DText but I can’t add a background to it.

This is what I have right know:

Does someone know how can I do this but with a background?

Thanks.

2 Likes

Dunno if it’s what you need, but here you go

function DrawText3Ds(x,y,z, text)
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    
    SetTextScale(0.35, 0.35)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(1)
    AddTextComponentString(text)
    DrawText(_x,_y)
    local factor = (string.len(text)) / 370
    DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end

Example useage:

DrawText3Ds(x, y, z , "TEXT HERE")

Enjoy mate

3 Likes

It’s released.
Search the releases category for floating / hologram text.

That’s exactly what I need! Thank you very much!

I know, I just didn’t know how to add a background to it

I’m sorry, but do you know how can I attach it to a player? I want to when a player type /me it appears on top of their head.

Sounds the like 3dme

2 Likes

Oh thanks, my bad for not founding it!

What’s the way to put this to replace a marker?

Just replace the marker code with the DrawText3Ds code with the coords

Ok ty very much for that bro :wink:

it is by doing that we learn, you worry about three weeks ago I knew nothing, but by force enters the brain.

it’s an easy script edit this and save this in client.lua

function DrawText3Ds(x,y,z, text)
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    
    SetTextScale(0.35, 0.35)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(1)
    AddTextComponentString(text)
    DrawText(_x,_y)
    local factor = (string.len(text)) / 370
    DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end

you will have to put the coordinates here and the text is enough to replace the xyz by the coordinator and add a small text …

here ----------------------- function DrawText3Ds(x,y,z, text) I think you have to remove the parenthesis too no sure …

and of course for the script to work you need a resource so

write this text and save on _ressource.lua

resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'

client_script "client.lua"

now put your two files client.lua and _ressource.lua in a file named as you want … example texte3d

and in server.cfg

start text3d
1 Like

What can I do about the distance I can see them?

you have the lambda menu for the coordinates or this one I just take it to see if it works … https: //github.com/IllusiveTea/show-coords/tree/master/showcoords

I’m going to sleep good night :slight_smile:

And about the distance to see them? I can see the 3dtext really far away