thecooldudes1000 Posted June 19, 2012 Share 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! Link to comment
Stanley Sathler Posted June 19, 2012 Share 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 Link to comment
Anderl Posted June 19, 2012 Share 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. Link to comment
X-SHADOW Posted June 19, 2012 Share 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) Link to comment
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