papam77 Posted June 24, 2013 Posted June 24, 2013 -- Move To DD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! function moveToDD() local dd = { ["dd"]= guiCreateStaticImage(0.331, 0.19, 0.17, 0.305, "images/areny/dd.png", true, arenas, lobby), } guiSetAlpha ( dd["dd"], 0.75 ) addEventHandler( "onClientMouseEnter", root, function(aX, aY) for key,gui in pairs (dd) do if gui == source then guiSetAlpha ( source, 1 ) playSound("sound/btn.mp3") return end end end ) addEventHandler( "onClientMouseLeave", root, function(aX, aY) for key,gui in pairs (dd) do if gui == source then guiSetAlpha ( source, 0.75 ) return end end end ) addEventHandler ( "onClientGUIClick", dd["dd"], moveToDD, false ) end addCommandHandler( "system", moveToDD ) function moveToDD2(button) if button == "left" then setElementData (localPlayer,"gamemode","dd", true) setElementDimension (localPlayer,3) outputChatBox ("True") end end When i am clicking to it button has bigger and bigger alpha, but why? This is DM but this works correct. -- Move To DM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! function moveToDM() local dm = { ["dm"]= guiCreateStaticImage(0.157, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas, lobby), } guiSetAlpha ( dm["dm"], 0.75 ) addEventHandler( "onClientMouseEnter", root, function(aX, aY) for key,gui in pairs (dm) do if gui == source then guiSetAlpha ( source, 1 ) playSound("sound/btn.mp3") return end end end ) addEventHandler( "onClientMouseLeave", root, function(aX, aY) for key,gui in pairs (dm) do if gui == source then guiSetAlpha ( source, 0.75 ) return end end end ) addEventHandler ( "onClientGUIClick", dm["dm"], moveToDM2, false ) end addCommandHandler( "system", moveToDM ) function moveToDM2(button) if button == "left" then setElementData (localPlayer,"gamemode","race", true) setElementDimension (localPlayer,2) outputChatBox ("True") end end
xXMADEXx Posted June 24, 2013 Posted June 24, 2013 (edited) Try: dd = { } dd["dd"]= guiCreateStaticImage(0.331, 0.19, 0.17, 0.305, "images/areny/dd.png", true, arenas, lobby) guiSetAlpha ( dd["dd"], 0.75 ) addEventHandler( "onClientMouseEnter", root, function ( ) if ( source == dd["dd"] ) then guiSetAlpha ( source, 1 ) playSound("sound/btn.mp3") end end ) addEventHandler( "onClientMouseLeave", dd["dd"], function( ) guiSetAlpha ( source, 0.75 ) end ) addEventHandler ( "onClientGUIClick", dd["dd"], moveToDD, false ) function moveToDD2(button) if button == "left" then setElementData (localPlayer,"gamemode","dd", true) setElementDimension (localPlayer,3) outputChatBox ("True") end end Edited June 24, 2013 by Guest The Ultimate Lua Tutorial! | MTA PHP SDK
papam77 Posted June 24, 2013 Author Posted June 24, 2013 Doesn't work, now button has only Alpha 1.0 and onClientMouseEnter doesn't work.
xXMADEXx Posted June 24, 2013 Posted June 24, 2013 Try the code now (I edited it.) The Ultimate Lua Tutorial! | MTA PHP SDK
papam77 Posted June 24, 2013 Author Posted June 24, 2013 If you hit the button, then button will stay with the Alpha 1.0
ixjf Posted June 24, 2013 Posted June 24, 2013 How about no? I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now