Jump to content

[HELP] Button press animation


JAY.ANN

Recommended Posts

hello , you can use variable to change the image

path = "img1.png"

addEventHandler("onClientRender",root,funtion()
     dxDrawImage ( 100, 300, 100, 240, path, 0, 0, 0,tocolor(255,255,255) )
end)

addCommandHandler("changeimage",function()
   path = "img2.png"
end)

 

  • Thanks 1
Link to comment
3 minutes ago, AliGR said:

hello , you can use variable to change the image

path = "img1.png"

addEventHandler("onClientRender",root,funtion()
     dxDrawImage ( 100, 300, 100, 240, path, 0, 0, 0,tocolor(255,255,255) )
end)

addCommandHandler("changeimage",function()
   path = "img2.png"
end)

 

I tried to do something like that but it didn't worked

Link to comment
--FUNCTIONS BELOW GETTING ON CLIENT RENDER EVENT WHEN THE PLAYER ENTERS SPECIFIED MARKER
function drawActionButton()
local action_button = dxDrawImage( 1080 * sW, actionButtonHeight * sH, 64 * sW, 64 * sH, action_image, 0, 0, 0, tocolor( 255, 255, 255, actionButtonAlpha ) )
dxDrawText( actionButton[ 1 ], 1099 * sW, ( actionButtonHeight + 1 ) * sH, 20 * sW, 45 * sH, tocolor( 25, 25, 25, actionButtonAlpha ), 1, gilroyActionButton )
dxDrawText( actionButtonTitle, 1155 * sW, actionButtonHeight * sH, 20 * sW, 45 * sH, tocolor( 255, 255, 255, actionButtonAlpha ), 1, segoeBold20 )
dxDrawText( actionButtonDescription, 1155 * sW, ( actionButtonHeight + 25 ) * sH, 20 * sW, 45 * sH, tocolor( 255, 255, 255, actionButtonAlpha ), 1, segoeSemiLight16 )
end

addEventHandler( "onClientKey", root, function( button, state )
	if button == actionButton[ 1 ] then
		if state == true then
		action_image = "files/btn_unactive.png"
		else
		action_image = "files/btn_active.png"
		end
	end
end)

 

Solved, xd - that was my problem. I didn't figure out that actionButton[ 1 ] is "E" and not "e". That's why my code couldn't read it correctly. Thank you!

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