DriFtyZ Posted June 7, 2017 Share Posted June 7, 2017 Hello people, i noticed on the wiki there are some function called Useful functions, how can i use them? what are they exactly? Link to comment
pa3ck Posted June 7, 2017 Share Posted June 7, 2017 They are functions / code snippets developed by individuals like you, me or any other developer that think their code would help others. For example there's a function called IsMouseInPosition which is not implemented in MTA, you have to code it yourself, but somebody else already did and put it up there. If I was to use it, all I had to do is copy the whole function, paste it in your script and use it as you would use any other functions like: -- My code addEventHandler("onClientResourceStart", resourceRoot, function() if isMouseInPosition ( some X, some Y, some Width, some Height) then -- code end end) -- Useful functions function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end 1 Link to comment
koragg Posted June 7, 2017 Share Posted June 7, 2017 damn @pa3ck you beat me to it Just had to erase 20 lines of writing because you said them :v 1 Link to comment
pa3ck Posted June 7, 2017 Share Posted June 7, 2017 2 minutes ago, koragg said: damn @pa3ck you beat me to it Just had to erase 20 lines of writing because you said them :v Ah, sorry man, there should be a feature that shows "Somebody else is writing a post.." or something, didn't realize you were about to send a reply. Link to comment
DriFtyZ Posted June 7, 2017 Author Share Posted June 7, 2017 thank you, i was so dumb that just tried to use only a useful function without copying the code below 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