function AttachDxToGuiElement( GUIElement , img )
if ( guiGetVisible ( GUIElement ) ) then
local x, y = guiGetPosition ( GUIElement , false )
local width , Height = guiGetSize ( GUIElement , false )
dxDrawImage(x, y, width , Height ,img, 0, 0, 0,SetImagecolor or tocolor(255, 0, 0, 255), true)
dxDrawText(guiGetText ( GUIElement ) or tostring '',x, y, width + x , Height + y,SetTextcolor or tocolor(55,55,55,255),1,"default-bold","center","center",false,false,true)
guiBringToFront ( GUIElement )
guiSetAlpha ( GUIElement , 0)
end
end
------------------
event = guiCreateButton(16, 20, 250, 40, "Take", false)
guiSetVisible (event, false)
addEventHandler ("onClientRender", root,
function ()
AttachDxToGuiElement( event ,'img/event.png' )
end)
bindKey( "k", "down",function( )
guiSetVisible( event , not guiGetVisible( event ))
showCursor( guiGetVisible( event ))
end
)