Jump to content

[HELP] dxEdit


N3xT

Recommended Posts

Hello guys,

I am trying to do a " dxEdit ", I try that but it doesn't work.

local text = {} 
  
addEventHandler("onClientCharacter", root, 
    function (c) 
        table.insert(text,c) 
    end ) 
  
addEventHandler("onClientRender", root, 
    function () 
        dxDrawText(#text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
    end ) 

when I press anything I got a " numbers " in the dxText,

example, when I type hello, I got a number 5.

so How to fix it ?

Link to comment
    local text = "" 
      
    addEventHandler("onClientCharacter", root, 
        function (c) 
            text = text..c 
        end ) 
      
    addEventHandler("onClientRender", root, 
        function () 
            dxDrawText(text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
        end ) 

Link to comment
    local text = "" 
      
    addEventHandler("onClientCharacter", root, 
        function (c) 
            text = text..c 
        end ) 
      
    addEventHandler("onClientRender", root, 
        function () 
            dxDrawText(text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
        end ) 

It's working, but how I can delete the last value?

bindKey("backspace", "down", function () 
  text = "" 
end) 

or I just can delete all the values ?

Link to comment
        
  
  
  
       local text = {} 
          
        addEventHandler("onClientCharacter", root, 
            function (c) 
                text[#text+1] = c 
            end ) 
             
        bindKey("backspace", "down", function () 
         text[#text] = nil 
        end) 
             
  
        function getText() 
        local Text = "" 
        for i,v in pairs(text) do 
        local Text = Text..v 
        end 
        return Text 
        end 
         
        addEventHandler("onClientRender", root, 
            function () 
                dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
            end ) 

Link to comment
        
  
  
  
       local text = {} 
          
        addEventHandler("onClientCharacter", root, 
            function (c) 
                text[#text+1] = c 
            end ) 
             
        bindKey("backspace", "down", function () 
         text[#text] = nil 
        end) 
             
  
        function getText() 
        local Text = "" 
        for i,v in pairs(text) do 
        local Text = Text..v 
        end 
        return Text 
        end 
         
        addEventHandler("onClientRender", root, 
            function () 
                dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
            end ) 

line 19 : bad argument #1 to'pairs' (table expected got string)

Link to comment

Oh sorry try this.

           
      
      
      
           local text = {} 
              
            addEventHandler("onClientCharacter", root, 
                function (c) 
                    text[#text+1] = c 
                end ) 
                
            bindKey("backspace", "down", function () 
             text[#text] = nil 
            end) 
                
      
            function getText() 
            local TText = "" 
            for i,v in pairs(text) do 
            local TText = TText..v 
            end 
            return TText 
            end 
            
            addEventHandler("onClientRender", root, 
                function () 
                    dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
                end ) 

Link to comment
Oh sorry try this.
           
      
      
      
           local text = {} 
              
            addEventHandler("onClientCharacter", root, 
                function (c) 
                    text[#text+1] = c 
                end ) 
                
            bindKey("backspace", "down", function () 
             text[#text] = nil 
            end) 
                
      
            function getText() 
            local TText = "" 
            for i,v in pairs(text) do 
            local TText = TText..v 
            end 
            return TText 
            end 
            
            addEventHandler("onClientRender", root, 
                function () 
                    dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
                end ) 

same error.

Link to comment

CodyL your code will not work o.O

pairs? local in this for block?

local text = "" 
  
bindKey ( "backspace", "down", function ()  
    if text ~= "" then 
        string.sub ( text, 1, #text - 1 ) 
    end 
end ) 
  
addEventHandler ( "onClientCharacter", root, function ( key ) 
    text = text .. key 
end ) 
  
addEventHandler ( "onClientRender", root, function ()  
    dxDrawText ( text, ... ) 
end ) 

Link to comment
CodyL your code will not work o.O

pairs? local in this for block?

local text = "" 
  
bindKey ( "backspace", "down", function ()  
    if text ~= "" then 
        string.sub ( text, 1, #text - 1 ) 
    end 
end ) 
  
addEventHandler ( "onClientCharacter", root, function ( key ) 
    text = text .. key 
end ) 
  
addEventHandler ( "onClientRender", root, function ()  
    dxDrawText ( text, ... ) 
end ) 

It's only writing, nothing in debug

Link to comment

I'm sorry I wasn't thinking about that at the time, try this

     
    local text = "" 
      
    bindKey ( "backspace", "down", function () 
        if text ~= "" then 
            string.sub ( text, 1, #text - 1 ) 
        end 
    end ) 
      
    addEventHandler ( "onClientCharacter", root, function ( key ) 
    if not key == "backspace" then 
        text = text .. key 
    end 
    end ) 
      
    addEventHandler ( "onClientRender", root, function () 
        dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
    end ) 

-- Updated version of other guys code.

Link to comment
I'm sorry I wasn't thinking about that at the time, try this
     
    local text = "" 
      
    bindKey ( "backspace", "down", function () 
        if text ~= "" then 
            string.sub ( text, 1, #text - 1 ) 
        end 
    end ) 
      
    addEventHandler ( "onClientCharacter", root, function ( key ) 
    if not key == "backspace" then 
        text = text .. key 
    end 
    end ) 
      
    addEventHandler ( "onClientRender", root, function () 
        dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
    end ) 

-- Updated version of other guys code.

Now I can't write :(

Link to comment
local text = "" 
  
bindKey ( "backspace", "down", function () 
    if text ~= "" then 
        string.sub ( text, 1, #text - 1 ) 
    end 
end ) 
  
addEventHandler ( "onClientCharacter", root, function ( key ) 
    text = text .. key 
end ) 
  
addEventHandler ( "onClientRender", root, function () 
     dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
end ) 

I expected you to fill the dxDrawText :D

Was on mobile phone

Link to comment
local text = "" 
  
bindKey ( "backspace", "down", function () 
    if text ~= "" then 
        string.sub ( text, 1, #text - 1 ) 
    end 
end ) 
  
addEventHandler ( "onClientCharacter", root, function ( key ) 
    text = text .. key 
end ) 
  
addEventHandler ( "onClientRender", root, function () 
     dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
end ) 

I expected you to fill the dxDrawText :D

Was on mobile phone

Ok, now it's writing but can't delete the text

Link to comment

Hmm ... normally I don't use bindKey there, I use onClientKey.

Test this:

local text = "" 
  
addEventHandler ( "onClientKey", root, function ( button, press ) 
    if press then 
        if button == "tab" then 
            text = text .. "\n" 
        elseif button == "backspace" then 
            if #text > 0 then 
                string.sub ( text, 1, #text - 1 ) 
            end 
        end 
    end 
end ) 
  
addEventHandler ( "onClientCharacter", root, function ( key ) 
    text = text .. key 
end ) 
  
addEventHandler ( "onClientRender", root, function () 
     dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) 
end ) 

Link to comment

Lets try this

addEventHandler ( "onClientKey", root, function ( button, press )  
    if press and button == "backspace" then 
        outputChatBox ( "Test" ) 
    end 
end ) 

Put this in and try to delete like you normally do.

Do you get an output in the chat?

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...