nurfaizfy19 Posted January 28, 2019 Posted January 28, 2019 (edited) sorry for my bad english i want to get cursor position, but in debug show me an error got boolean. I have the code below .... local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = cx*sx,cy*sy -- line 222 .... error message Quote myscript.lua:222: attempt to perform arithmetic on local 'cx' (a boolean value) how to solve this? thank you very much Edited January 28, 2019 by nurfaizfy19 typo
DNL291 Posted January 28, 2019 Posted January 28, 2019 Try removing 'local': local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() cx,cy = cx*sx,cy*sy
Moderators Patrick Posted January 28, 2019 Moderators Posted January 28, 2019 (edited) You can only get the cursor's position if cursor is showing. https://wiki.multitheftauto.com/wiki/IsCursorShowing local sx, sy = guiGetScreenSize() function getpos() if isCursorShowing() then local cx, cy = getCursorPosition() return sx*cx, sy*cy end return false end Edited January 28, 2019 by Patrick2562 1
nurfaizfy19 Posted January 29, 2019 Author Posted January 29, 2019 9 hours ago, DNL291 said: Try removing 'local': local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() cx,cy = cx*sx,cy*sy i tried it but still got boolean 9 hours ago, Patrick2562 said: You can only get the cursor's position if cursor is showing. https://wiki.multitheftauto.com/wiki/IsCursorShowing local sx, sy = guiGetScreenSize() function getpos() if isCursorShowing() then local cx, cy = getCursorPosition() return sx*cx, sy*cy end return false end It works for me, thank you very much
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