MannPro Posted June 6, 2014 Share Posted June 6, 2014 Hey guys! I made a pizza job and also a panel for info about pizza. Now can someone help me how to show the GUI on typing /pizza? Thanks...... Link to comment
Max+ Posted June 6, 2014 Share Posted June 6, 2014 well Type command is hard , i suggest use Keyboard Key , local Window = Window Name local Key = "F2" guiSetVisible(Window,false) bindKey(Key,"Down",function() if ( guiGetVisible(Window) == true ) then guiSetVisible(Window,false) showCursor(false) else guiSetVisible(Window,true) showCursor(true) end end) Link to comment
MannPro Posted June 6, 2014 Author Share Posted June 6, 2014 well Type command is hard , i suggest use Keyboard Key , local Window = Window Name local Key = "F2" guiSetVisible(Window,false) bindKey(Key,"Down",function() if ( guiGetVisible(Window) == true ) then guiSetVisible(Window,false) showCursor(false) else guiSetVisible(Window,true) showCursor(true) end end) Thanks for the code! I'll do it but i insist command as it's only pizza info panel and i can't use keyboard keys for all jobs . I added it to my resource like this -> local Window = Window Name local Key = "F2" guiSetVisible(Window,false) bindKey(Key,"Down",function() if ( guiGetVisible(Window) == true ) then guiSetVisible(Window,false) showCursor(false) else guiSetVisible(Window,true) showCursor(true) end end) But i get this error on console [2014-06-07 00:04:25] Starting pizza [2014-06-07 00:04:25] SCRIPT ERROR: pizza\client.lua:31: '=' expected near 'local' [2014-06-07 00:04:25] ERROR: Loading script failed: pizza\client.lua:31: '=' expected near 'local' Please Help Link to comment
Max+ Posted June 6, 2014 Share Posted June 6, 2014 (edited) addCommandHandler ( 'pizzaopen', function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) Edited June 6, 2014 by Guest Link to comment
MannPro Posted June 6, 2014 Author Share Posted June 6, 2014 As you wish , addCommandHandler ( 'pizzaopen', root, function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', root, function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) + post your code , Thanks and I want the command/code to be /pizza Link to comment
Max+ Posted June 6, 2014 Share Posted June 6, 2014 As you wish , addCommandHandler ( 'pizzaopen', root, function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', root, function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) + post your code , Thanks and I want the command/code to be /pizza just change the command name pizzopen , pizzaclose whatever you want, Link to comment
MannPro Posted June 6, 2014 Author Share Posted June 6, 2014 I added a button to close the guide so I think pizza close command isn't necessary. And is there anything else except making the guide and this command ? I don't know as this is my first guide panel ever c: so, is there any thing else? And thank you very much c: Link to comment
Max+ Posted June 6, 2014 Share Posted June 6, 2014 well , your right close button is not necessary , you can cheack if the window visible or not , like this , if ( guiGetVisible ( myWindow ) == true ) then -- check if the gui element is visible guiSetVisible ( myWindow, false ) -- if it is, we hide it else guiSetVisible ( myWindow, true ) -- if not, we make it visible and what you mean by is there anything else ? if you mean to open the panel not there isn't unless if you want to check if it's show , or not buy the code i posted , Link to comment
TAPL Posted June 6, 2014 Share Posted June 6, 2014 As you wish , addCommandHandler ( 'pizzaopen', root, function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', root, function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) + post your code , bool addCommandHandler ( string commandName, function handlerFunction, [bool caseSensitive = true] ) I wonder why you put root here. Link to comment
Max+ Posted June 6, 2014 Share Posted June 6, 2014 As you wish , addCommandHandler ( 'pizzaopen', root, function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', root, function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) + post your code , bool addCommandHandler ( string commandName, function handlerFunction, [bool caseSensitive = true] ) I wonder why you put root here. well , Thanks For reminding Me, Fixed , Link to comment
TAPL Posted June 6, 2014 Share Posted June 6, 2014 As you wish , addCommandHandler ( 'pizzaopen', root, function () guiSetVisible (GUIEditor_Window[1], true) ----Name of the window, false to hide showCursor ( true ) --- false to hide end ) addCommandHandler ( 'pizzaclose', root, function () guiSetVisible (GUIEditor_Window[1], false) ----Name of the window, false to hide showCursor ( false ) --- false to hide end ) + post your code , Thanks and I want the command/code to be /pizza oh i wonder if you too lazy to change the command? And wondering if it even worked lol. Link to comment
MannPro Posted June 7, 2014 Author Share Posted June 7, 2014 Well my whole Gui is here -> GUIEditor = { button = {}, window = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(344, 146, 342, 458, "Pizza Job", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.memo[1] = guiCreateMemo(16, 30, 312, 384, "Here is the basic Info about Pizza! ->\n\nCurrent Job Head -> Mann\n\n------------ Finding The Job ------------\n\n - To find the pizza job see the Pizza Icon on the . map(F11). \n\n------------ Doing The Job -------------\n\n - You will get a Faggio and must deliver the pizza at the Green Marker on the Map(F11). \n\n - On Delivery you will get your salary! \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" /> \n\n------------ Others ------------\n\n - For more Information you can contanct our staff online!\n\n - You can also contanct the Job Head!", false, GUIEditor.window[1]) guiMemoSetReadOnly(GUIEditor.memo[1], true) GUIEditor.button[1] = guiCreateButton(211, 423, 117, 20, "Close", false, GUIEditor.window[1]) addEventHandler("onClientGuiClick", GUIEditor.button[1], closePanel, false) end ) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createGUIEditor.window[1] () guiSetVisible(GUIEditor.window[1], false) showCursor(false,false) end ) function closePanel (button, state) if button == "left" and state == "up" then guiSetVisible(GUIEditor.window[1], false) showCursor(false,false) end end local Window = Window Name local Key = "F2" guiSetVisible(Window,false) addCommandHandler ( 'pizza', root, function () guiSetVisible (GUIEditor_Window[1], true) showCursor ( true ) end ) This is my whole script of Gui and your command doesn't work Link to comment
MannPro Posted June 7, 2014 Author Share Posted June 7, 2014 And is there any flaw in the script? eh? Plizz inform me if any Link to comment
ikvindmooi Posted June 7, 2014 Share Posted June 7, 2014 Try this: jobPanel = guiCreateWindow (344, 146, 342, 458, "Pizza Job", false) guiWindowSetSizable (jobPanel, false) jobMemo = guiCreateMemo (16, 30, 312, 384, "Here is the basic Info about Pizza! ->\n\nCurrent Job Head -> Mann\n\n------------ Finding The Job ------------\n\n - To find the pizza job see the Pizza Icon on the . map(F11). \n\n------------ Doing The Job -------------\n\n - You will get a and must deliver the pizza at the Green Marker on the Map(F11). \n\n - On Delivery you will get your salary! \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" /> \n\n------------ Others ------------\n\n - For more Information you can contanct our staff online!\n\n - You can also contanct the Job Head!", false, jobPanel) guiMemoSetReadOnly (jobMemo, true) jobButton = guiCreateButton (211, 423, 117, 20, "Close", false, jobPanel) guiSetVisible (jobPanel, false) function closePanel (button, state) if button == "left" and state == "up" then guiSetVisible( jobPanel, false ) showCursor ( false ) end end addEventHandler ( "onClientGUIClick", jobButton, closePanel, false ) function openPanel() if ( guiGetVisible ( jobPanel ) == true ) then guiSetVisible ( jobPanel, false ) showCursor ( false ) else guiSetVisible (jobPanel, true ) showCursor ( true ) end end addCommandHandler("panel", openPanel, false, false ) Link to comment
Max+ Posted June 8, 2014 Share Posted June 8, 2014 there is smile bugs form the fourm in your code make sure you remove them ... . Link to comment
MannPro Posted June 8, 2014 Author Share Posted June 8, 2014 Try this: jobPanel = guiCreateWindow (344, 146, 342, 458, "Pizza Job", false) guiWindowSetSizable (jobPanel, false) jobMemo = guiCreateMemo (16, 30, 312, 384, "Here is the basic Info about Pizza! ->\n\nCurrent Job Head -> Mann\n\n------------ Finding The Job ------------\n\n - To find the pizza job see the Pizza Icon on the . map(F11). \n\n------------ Doing The Job -------------\n\n - You will get a and must deliver the pizza at the Green Marker on the Map(F11). \n\n - On Delivery you will get your salary! \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" /> \n\n------------ Others ------------\n\n - For more Information you can contanct our staff online!\n\n - You can also contanct the Job Head!", false, jobPanel) guiMemoSetReadOnly (jobMemo, true) jobButton = guiCreateButton (211, 423, 117, 20, "Close", false, jobPanel) guiSetVisible (jobPanel, false) Thanks function closePanel (button, state) if button == "left" and state == "up" then guiSetVisible( jobPanel, false ) showCursor ( false ) end end addEventHandler ( "onClientGUIClick", jobButton, closePanel, false ) function openPanel() if ( guiGetVisible ( jobPanel ) == true ) then guiSetVisible ( jobPanel, false ) showCursor ( false ) else guiSetVisible (jobPanel, true ) showCursor ( true ) end end addCommandHandler("panel", openPanel, false, false ) there is smile bugs form the fourm in your code make sure you remove them ... . Thanks Link to comment
MannPro Posted June 8, 2014 Author Share Posted June 8, 2014 Try this: jobPanel = guiCreateWindow (344, 146, 342, 458, "Pizza Job", false) guiWindowSetSizable (jobPanel, false) jobMemo = guiCreateMemo (16, 30, 312, 384, "Here is the basic Info about Pizza! ->\n\nCurrent Job Head -> Mann\n\n------------ Finding The Job ------------\n\n - To find the pizza job see the Pizza Icon on the . map(F11). \n\n------------ Doing The Job -------------\n\n - You will get a and must deliver the pizza at the Green Marker on the Map(F11). \n\n - On Delivery you will get your salary! \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" /> \n\n------------ Others ------------\n\n - For more Information you can contanct our staff online!\n\n - You can also contanct the Job Head!", false, jobPanel) guiMemoSetReadOnly (jobMemo, true) jobButton = guiCreateButton (211, 423, 117, 20, "Close", false, jobPanel) guiSetVisible (jobPanel, false) function closePanel (button, state) if button == "left" and state == "up" then guiSetVisible( jobPanel, false ) showCursor ( false ) end end addEventHandler ( "onClientGUIClick", jobButton, closePanel, false ) function openPanel() if ( guiGetVisible ( jobPanel ) == true ) then guiSetVisible ( jobPanel, false ) showCursor ( false ) else guiSetVisible (jobPanel, true ) showCursor ( true ) end end addCommandHandler("panel", openPanel, false, false ) addEventHandler ( "onClientGUIClick", jobButton, closePanel, false ) It shows incomplete (got boolean)Nil 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