Skip to content

dsheedes/cd_drawtextui

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
December 12, 2020 17:52
December 12, 2020 17:52
December 12, 2020 17:52
June 13, 2023 00:42
June 4, 2023 18:43
December 12, 2020 17:55

INSTALLATION GUIDE

1. Clone the repository or Code > Download zip

2. Add the resource to your server start config: ensure cd_drawtextui. The name of the folder must be cd_drawtextui or the resource will not function correctly.

How to use?

This can be triggered from the server or client. A more advanced example is posted below.

Show the UI Hide the UI
Triggerevent('cd_drawtextui:ShowUI', 'show', TEXT_HERE) Triggerevent('cd_drawtextui:HideUI')

This is an example how to implement the UI for a single location.

Citizen.CreateThread(function()
    local alreadyEnteredZone = false
    local text = nil
    while true do
        wait = 5
        local ped = PlayerPedId()
        local inZone = false
        local dist = #(GetEntityCoords(ped)-vector3(0,0,0))
        if dist <= 5.0 then
            wait = 5
            inZone  = true
            text = '<b>Title</b></p>[E] Press E to be bald'

            if IsControlJustReleased(0, 38) then
                TriggerEvent('add your event here')
            end
        else
            wait = 2000
        end
        
        if inZone and not alreadyEnteredZone then
            alreadyEnteredZone = true
            TriggerEvent('cd_drawtextui:ShowUI', 'show', text)
        end

        if not inZone and alreadyEnteredZone then
            alreadyEnteredZone = false
            TriggerEvent('cd_drawtextui:HideUI')
        end
        Citizen.Wait(wait)
    end
end)

This is an example how to implement the UI while doing a for loop for multiple locations in 1 thread.

Citizen.CreateThread(function()
    local alreadyEnteredZone = false
    local text = nil
    while true do
        wait = 5
        local ped = PlayerPedId()
        local inZone = false
        for cd = 1, #Config.YOURTABLE do
            local dist = #(GetEntityCoords(ped)-vector3(Config.YOURTABLE.x, Config.YOURTABLE.y, Config.YOURTABLE.z))
            if dist <= 5.0 then
                wait = 5
                inZone  = true
                text = '<b>Title</b></p>[E] Press E to be bald'

                if IsControlJustReleased(0, 38) then
                    TriggerEvent('add your event here')
                end
                break
            else
                wait = 2000
            end
        end
        
        if inZone and not alreadyEnteredZone then
            alreadyEnteredZone = true
            TriggerEvent('cd_drawtextui:ShowUI', 'show', text)
        end

        if not inZone and alreadyEnteredZone then
            alreadyEnteredZone = false
            TriggerEvent('cd_drawtextui:HideUI')
        end
        Citizen.Wait(wait)
    end
end)

Is the resource not working as expected?

  • Make sure the name of the folder is cd_drawtextui.
  • Check the server console and the in game F8 console for errors.
  • If all else fails, contact the Codesign Team in the Codesign Discord.

About

This is a more optimised replacement for the standard 3Dtext.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published