HUNGRY:3 Posted September 8, 2015 Posted September 8, 2015 Hello I want to open a window near cursor how to do that?
KariiiM Posted September 8, 2015 Posted September 8, 2015 Middle of the screen? because cursor is also in the middle
HUNGRY:3 Posted September 8, 2015 Author Posted September 8, 2015 Middle of the screen? because cursor is also in the middle No no I mean when cursor is showing and player click on an element the window should appear near the cursor getCursorPosition Yeah I know it but I have no idea look.. Like this? function cursorshit() local showing = isCursorShowing () if showing then local screenx, screeny = getCursorPosition() local myWindow = guiCreateWindow ( screenx,screeny, 0.5, 0.4, "test", true ) end addCommandHandler("okay",cursorshit)
JR10 Posted September 8, 2015 Posted September 8, 2015 Looks fine, but you're missing an end. That and the forum doesn't like your language.
HUNGRY:3 Posted September 8, 2015 Author Posted September 8, 2015 Looks fine, but you're missing an end. That and the forum doesn't like your language. Lol thank you , but about the forum doesn't like my language it should be "cursors hit" but I did "cursors(no space)hit"
HUNGRY:3 Posted September 10, 2015 Author Posted September 10, 2015 ok this doesn't set the image near the cursor when i click on player ._. function lxad(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) local x, y, z = getElementPosition(localPlayer) local showing = isCursorShowing () if showing then if ( getElementType ( clickedElement ) == 'player' ) then if getDistanceBetweenPoints3D(x, y, z, worldX, worldY, worldZ)<=5 then guiSetVisible(CLP.staticimage[1],true) guiSetPosition ( CLP.staticimage[1], screenx, screeny,true ) guiSetText(CLP.label[1],"PlayerName: "..getPlayerName(clickedElement)) setTimer(function()guiSetVisible(CLP.staticimage[1],false)end,5000,0) end end end end addEventHandler ( 'onClientClick', root,lxad)
JR10 Posted September 10, 2015 Posted September 10, 2015 Because screenx and screeny are not defined here. Use absoluteX and absoluteY.
HUNGRY:3 Posted September 10, 2015 Author Posted September 10, 2015 it's defined i didn't show my full code sorry but i did screenx,screeny = getCursorPosition()
JR10 Posted September 10, 2015 Posted September 10, 2015 You already have absoluteX and absoluteY, use them.
HUNGRY:3 Posted September 10, 2015 Author Posted September 10, 2015 okay... i added output when clicking a player but it output 2 times ._.
JR10 Posted September 10, 2015 Posted September 10, 2015 onClientClick triggers for key down and up, so it triggers twice for pressing and releasing. Add: if (state ~= 'down') then return end
HUNGRY:3 Posted September 10, 2015 Author Posted September 10, 2015 onClientClick triggers for key down and up, so it triggers twice for pressing and releasing.Add: if (state ~= 'down') then return end Thanks again
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