Jump to content

clipboard text


Master_MTA

Recommended Posts

txt =  "" 
function setClipboard (texts) 
txt = texts 
end

function isClipboard () 
if txt ~= ""  then 
return true 
else
return false 
end
end

function getClipboard () 
return txt 
 end 
 
-- Example

 addCommandHandler("qq",
 function (cmd,...) 
 if arg ~= "" then 
  local w = table.concat({...}, " ") 
 setClipboard(w)
 outputChatBox("Done "..w.."") 
 end
 end
 )
 
 addCommandHandler("dd",
function () 
if  isClipboard ()  then 
outputChatBox(""..getClipboard().."") 
else
outputChatBox("error")
end
end 
)

 

Link to comment
51 minutes ago, Ahmed Ly said:

txt =  "" 
function setClipboard (texts) 
txt = texts 
end

function isClipboard () 
if txt ~= ""  then 
return true 
else
return false 
end
end

function getClipboard () 
return txt 
 end 
 
-- Example

 addCommandHandler("qq",
 function (cmd,...) 
 if arg ~= "" then 
  local w = table.concat({...}, " ") 
 setClipboard(w)
 outputChatBox("Done "..w.."") 
 end
 end
 )
 
 addCommandHandler("dd",
function () 
if  isClipboard ()  then 
outputChatBox(""..getClipboard().."") 
else
outputChatBox("error")
end
end 
)

 

that wasn't my mean i mean if player was browser he is pc normal  then he was copy any text

then i need to get this copied text not only in mta 

Link to comment
19 hours ago, IIYAMA said:

You can't 'get' it ingame.

Only 'set' it, which you can use in any other application.

 

Clear?

no thing is possible for Master_MTA

small usfel function u can use it with dx edit box like i was want

with small example 

--------------------------useful function
function getClipboard()
if (getKeyState('rctrl')==true or getKeyState('lctrl')==true) and getKeyState('v')==true then
local edit= guiCreateEdit (  0,0,0,0, '',false,nil )
guiSetAlpha(edit,0)
guiEditSetCaretIndex ( edit, 0  )
local text=guiGetText(edit)
destroyElement(edit)
return text
end
return false
end
--------------------------------------------
GUIEditor = {
    edit = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(542, 304, 403, 102, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.edit[1] = guiCreateEdit(62, 39, 279, 24, "", false, GUIEditor.window[1])    
    end
)
addEventHandler('onClientKey',root,function(btn,st)
if st then
guiSetText(GUIEditor.edit[1],getClipboard() or '')
end
end)

 

  • Like 1
  • Thanks 1
Link to comment
32 minutes ago, IIYAMA said:

It isn't the same as what getClipboard would do, because ctrl + v is required. But it is definitely useful.

 

2 hours ago, Master_MTA said:

small usfel function u can use it with dx edit box like i was want

 

that i was said xD any way that will help us when we want to set Dx edit box text 

  • Like 1
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...