Giter Site home page Giter Site logo

cd_drawtextui's Introduction

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.

cd_drawtextui's People

Contributors

dsheedes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.