thecooldudes1000 Posted June 19, 2012 Posted June 19, 2012 I am scripting a new userpanel for my clan and I want to make images and use them as buttons! My dilemma is that I cant do that! So what I basically want it to know a code for using images as buttons! Thank you! Just like TG and FFS!
Stanley Sathler Posted June 19, 2012 Posted June 19, 2012 (edited) When the user click (onClientGUIClick), you can get the mouse position and get the element (image) position. If is equal, execute your function. Userful functions and events: guiCreateStaticImage() --to create the image guiGetPosition() --to get the image position getCursorPosition() --to get the cursor position onClientGUIClick --event called when the player clicks on something Also, you will use some mathematics. You will need get the cursor position and calculate if the cursor is on the image (in other words, calculate if your cursor is in image_position + image_size)(I don't know explain much well). Edited June 19, 2012 by Guest Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Stanley Sathler Posted June 19, 2012 Posted June 19, 2012 Be welcome. Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Anderl Posted June 19, 2012 Posted June 19, 2012 You're wrong Stan. You don't need to get cursor position. Just do it like making a button but create an image instead of a button. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
X-SHADOW Posted June 19, 2012 Posted June 19, 2012 you mean like this Darken ? ---clientSide addEventHandler('onClientGUIClick', root, function() local me = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false ) if (source == me ) then triggerServerEvent('giveM4', localPlayer) end end) ---serverSide addEvent('giveM4', true) addEvent('giveM4', root, function() giveWeapon ( source, 31, 200 ) end) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
Anderl Posted June 19, 2012 Posted June 19, 2012 Yes, this. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
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