Jump to content

[PLEASE HELP ME!] COOLDOWN DONT WORK!


Murilo_apa

Recommended Posts

local cooldown = {}

local tick = getTickCount()

function dxConce()
    if exibindo_painelC == false then
        if cooldown[element] and tick - cooldown[element] < 5000 then
            return
        end
        cooldown = tick
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painel = false
            end
        end)
    end
end

Help me please! after I enter the marker for the first time it stops working! looks like an error with the cooldown, but I can't identify it (I'm using the translator).

Link to comment
local cooldown = {}

local tick = getTickCount()

function dxConce()
    if exibindo_painelC == false then
        if cooldown[element] and tick - cooldown[element] < 5000 then
            return
        end
        cooldown = tick
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

 

Edited by shishani
Link to comment
local cooldown = {}

local tick = getTickCount()

function dxConce()
    if exibindo_painelC == false then
        if cooldown[element] and tick - cooldown[element] < 5000 then
            return
        end
        cooldown[element] = tick
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

 

Edited by shishani
Link to comment

Estou com dificuldades para fazer um script de atendido , quando o player está no marcador os dx ao lado do setCameraMatrix são chamados, e quando o backspace é engolido, na teoria era para retirar o EventHandler e voltar tudo ao normal. O cooldown seria evitar um loop, the script is of type client and the player comes from client side script.

Edited by Murilo_apa
Link to comment

You did not answer my question

19 minutes ago, Murilo_apa said:

Estou com dificuldades para fazer um script de atendido , quando o player está no marcador os dx ao lado do setCameraMatrix são chamados, e quando o backspace é engolido, na teoria era para retirar o EventHandler e voltar tudo ao normal. O cooldown seria evitar um loop. 

 

local cooldown = {}

function dxConce()
    if exibindo_painelC == false then
        if cooldown and (getTickCount() - cooldown) < 5000 then
            return
        end
        cooldown = getTickCount()
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

Try this then

Edited by shishani
Link to comment

the element comes from the server side script when the element is on the marker.
 

function dxConce()
    if exibindo_painelC == false then
        if cooldown[element] and tick - cooldown[element] < 5000 then
            return
        end
        cooldown[element] = tick -- this line
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

 

16 minutes ago, shishani said:

You did not answer my question

 

local cooldown = {}

local tick = getTickCount()

function dxConce()
    if exibindo_painelC == false then
        if cooldown and tick - cooldown < 5000 then
            return
        end
        cooldown = tick
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

Try this then

does not work ?

Link to comment
local cooldown

function dxConce()
    if exibindo_painelC == false then
        if cooldown and (getTickCount() - cooldown) < 5000 then
            return
        end
        cooldown = getTickCount()
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

Sorry, I do not know English, and with the help of a translator, I did not quite understand you.

last try

Edited by shishani
Link to comment
4 minutes ago, shishani said:
local cooldown

function dxConce()
    if exibindo_painelC == false then
        if cooldown and (getTickCount() - cooldown) < 5000 then
            return
        end
        cooldown = getTickCount()
        addEventHandler("onClientRender", root, drawConce)
        exibindo_painelC = true
        bindKey('backspace','down', function()
            if exibindo_painelC == true then
                removeEventHandler("onClientRender", root, drawConce)
                setCameraTarget (localPlayer)
                exibindo_painelC = false
            end
        end)
    end
end

Sorry, I do not know English, and with the help of a translator, I did not quite understand you.

last try

Brooooh! you're a god ┗|`O′|┛ Thank you veeeery much for your patience and sorry for the lack of information! LOV U ❤️

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...