Castillo Posted December 31, 2014 Posted December 31, 2014 That's because you named your function the same as your variable "DxMenu". Rename your function or variable.
FlyingSpoon Posted December 31, 2014 Author Posted December 31, 2014 I don't understand, what do you mean? function DxMenu to function DxMenuTwo ? But that's the whole window thing isn't it?
MTA Team botder Posted December 31, 2014 MTA Team Posted December 31, 2014 You are using the DxMenu variable for your function and then you overwrite it with your boolean. Change your variable name. function DxMenu() local DxMenu = false -- function DxMenu doesn't exist anymore
FlyingSpoon Posted January 1, 2015 Author Posted January 1, 2015 So, function menuState() local DxMenu = false To that?
Castillo Posted January 1, 2015 Posted January 1, 2015 Well, I was telling you to rename the variable, not the function. This is a variable: local DxMenu = false This is a function: function test ( ) end
MTA Team botder Posted January 1, 2015 MTA Team Posted January 1, 2015 Well, I was telling you to rename the variable, not the function.This is a variable: local DxMenu = false This is a function: function test ( ) end Both are variables, but with different types. (boolean and function) test = function() end
FlyingSpoon Posted January 1, 2015 Author Posted January 1, 2015 Yeah but if I name the variable to, menuState = false No such thing exists so what's the point of it ?
Castillo Posted January 1, 2015 Posted January 1, 2015 Name both differently. Seriously, is not that hard to understand what we're trying to tell you.
FlyingSpoon Posted January 1, 2015 Author Posted January 1, 2015 Well I figured something out, the command works with /settingsmenu, however now the problem is when I hit close it disables the cursor but Dx dont go. ----------------------- -- The Menu -- ----------------------- function DxMenu() font = dxCreateFont("Digital.ttf",30) dxDrawRectangle(261, 125, 292, 287, tocolor(50, 160, 212, 144), false) dxDrawRectangle(312, 196, 186, 43, tocolor(0, 0, 0, 255), false) dxDrawRectangle(313, 197, 184, 41, tocolor(50, 160, 212, 255), false) dxDrawLine(261, 170, 552, 170, tocolor(1, 1, 1, 219), 1, true) dxDrawRectangle(312, 255, 186, 43, tocolor(0, 0, 0, 255), false) dxDrawRectangle(313, 256, 184, 41, tocolor(50, 160, 212, 255), false) dxDrawRectangle(312, 316, 186, 43, tocolor(0, 0, 0, 255), false) dxDrawRectangle(313, 317, 184, 41, tocolor(50, 160, 212, 255), false) dxDrawRectangle(481, 380, 70, 29, tocolor(0, 0, 0, 255), false) dxDrawRectangle(482, 381, 68, 27, tocolor(50, 160, 212, 255), false) gameSet = dxDrawText("Game Settings", 359, 269, 431, 287, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) dxDrawText("Help Menu", 371, 210, 443, 228, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) dxDrawText("Coming Soon...", 359, 329, 431, 347, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) closeBtn = dxDrawText("Close", 498, 386, 534, 400, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) dxDrawText("Settings Menu", 335, 128, 434, 155, tocolor(0, 0, 0, 255), 1.00, font, "left", "top", false, false, true, false, false) end ----------------------- ----------------------- -- Menu Moved -- ----------------------- function bindKeys() bindKey("F1", "down", F1RPhelp) end addEventHandler("onClientResourceStart", getRootElement(), bindKeys) function resetState() pressed = false end function F1RPhelp() outputChatBox("This menu has been moved to /settingsmenu!", 0, 179, 255) end ---------------------- ---------------------- -- Binded CMD -- ---------------------- function cmdType() addEventHandler("onClientRender", getRootElement(), DxMenu) showCursor(true) DxMenu = true end addCommandHandler("settingsmenu", cmdType) ---------------------- ---------------------- -- Test -- ---------------------- function bTest() tWindow = guiCreateWindow(233, 251, 297, 226, "", false) guiWindowSetSizable(tWindow, false) end local menuState = false ----------------------- -- Clicks -- ----------------------- function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) -- Get the player screen resolution local cx, cy = getCursorPosition ( ) -- Get the cursor position local cx, cy = ( cx * sx ), ( cy * sy ) -- Convert relative positions to absolute if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end addEventHandler ( "onClientClick", root, function ( ) if ( DxMenu ) then if isMouseInPosition ( 481, 380, 70, 29 ) then removeEventHandler("onClientRender", getRootElement(), DxMenu) showCursor(false) end end end ) -------------------------
MTA Team botder Posted January 2, 2015 MTA Team Posted January 2, 2015 function cmdType() addEventHandler("onClientRender", getRootElement(), DxMenu) showCursor(true) DxMenu = true -- You killed the function here, it doesn't exist anymore end
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