data,_add = { },addEventHandler
function SColor(e,r,g,b)
if getElementType(e) == 'gui-button' then guiSetProperty(e, 'NormalTextColour', string.format("%.2X%.2X%.2X%.2X",r,g,b,255)) end end
dxDrawImage_ = dxDrawImage local dxDrawImage = function (...) local a = {...}
if isElement( a[1] ) and getElementType( a[1] ) == 'gui-button' and guiGetVisible (a[1]) then
data [ a[1] ] = true
local posX, posY = guiGetPosition ( a[1] , false )
local width , Height = guiGetSize ( a[1] , false )
dxDrawImage_ (posX , posY, width,Height,a[2], a[3],a[4],a[5], a[6] , a[7])
local r, g, b = getColorFromString("#"..guiGetProperty(a[1], "NormalTextColour"))
dxDrawText(guiGetText ( a[1] ) or tostring '',posX, posY, width + posX , Height + posY,SetTextcolor or tocolor(r, g, b,255),1,"default-bold","center","center",false,false,true)
guiSetAlpha( a[1] , 0)
end
if not isElement( a[1] ) then return dxDrawImage_ (...) end
end
local function Enter()
if data [ source ] == true then SColor(source,0 ,255, 0) end end
local function Leave()
if data [ source ] == true then SColor(source,255, 124,124) end end
_add ( "onClientMouseEnter",resourceRoot,Enter) _add ( "onClientGUIMouseUp", resourceRoot,Enter)
_add ( "onClientMouseLeave",resourceRoot,Leave) _add ( "onClientGUIMouseDown",resourceRoot,Leave)
-----------------\\\\\\\\\\\\\\\\\\\\-----------------
event = guiCreateButton(16, 20, 250, 40, "Take", false)
guiSetVisible (event, false)
addEventHandler ("onClientRender", root,
function ()
dxDrawImage(event ,'img/event.png', 0, 0, 0,tocolor(255, 255, 255, 255), true) -- attach to Button
-- dxDrawImage(160, 200, 250, 40 ,'img/event.png', 0, 0, 0,tocolor(255, 255, 255, 255), true) -- dx Image
end)
bindKey( "k", "down",function( )
guiSetVisible( event , not guiGetVisible( event ))
showCursor( guiGetVisible( event ))
end
)
try this