3B00DG4MER Posted March 10, 2014 Share Posted March 10, 2014 (edited) GUIEditor = { window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() win = guiCreateWindow(252, 144, 712, 475, "Support Panel", false) guiWindowSetSizable(win, false) btnsend = guiCreateButton(585, 398, 111, 50, "Send", false, win) guiSetProperty(btnsend, "NormalTextColour", "FFAAAAAA") msg = guiCreateEdit(35, 394, 540, 54, "", false, win) supgl = guiCreateGridList(12, 27, 684, 361, false, win) local Name = guiGridListAddColumn(supgl, "Name", 0.2) local Message = guiGridListAddColumn(supgl, "Message", 0.-- s8) --> function OnClickSend() function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == btnsend) then if ( Message ) then -- If the column was successfully created --Loop through all the players, adding them to the table local row = guiGridListAddRow ( supgl ) guiGridListSetItemText ( supgl, row, Message, msg, false, false ) end end end end end end ) Anyone Fix it please ? When i pressed Send nothing Happened Edited March 11, 2014 by Guest Link to comment
Moderators Citizen Posted March 10, 2014 Moderators Share Posted March 10, 2014 GUIEditor = { window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() win = guiCreateWindow(252, 144, 712, 475, "Support Panel", false) guiWindowSetSizable(win, false) btnsend = guiCreateButton(585, 398, 111, 50, "Send", false, win) guiSetProperty(btnsend, "NormalTextColour", "FFAAAAAA") msg = guiCreateEdit(35, 394, 540, 54, "", false, win) supgl = guiCreateGridList(12, 27, 684, 361, false, win) local Name = guiGridListAddColumn(supgl, "Name", 0.2) local Message = guiGridListAddColumn(supgl, "Message", 0.-- s8) --> function OnClickSend() function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == btnsend) then if ( Message ) then -- If the column was successfully created --Loop through all the players, adding them to the table local row = guiGridListAddRow ( supgl ) guiGridListSetItemText ( supgl, row, Message, msg, false, false ) end end end end end end ) Anyone Fix it please ? When i pressed Send nothing Happened 1 - say hello before anything else 2 - learn the basics of scripting, I would recommend to learn C before. 3 - Learn the MTA Scripting: https://wiki.multitheftauto.com/wiki/Scr ... troduction 4 - Use a proper ide (Notepad from windows isn't piece of paper, it has nothing to do with scripting) 5 - And finally do not copy/paste piece of code you do not understand (so mine too) GUIEditor = { window = {}, button = {}, gridlist = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(252, 144, 712, 475, "Support Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(585, 398, 111, 50, "Send", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[1], onClickSend, false) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.edit[1] = guiCreateEdit(35, 394, 540, 54, "", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(12, 27, 684, 361, false, GUIEditor.window[1]) local name = guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) local message = guiGridListAddColumn(GUIEditor.gridlist[1], "Message", 0.8 ) end ) function onClickSend(button, state) if button == "left" then local editmsg = tostring( guiGetText( GUIEditor.edit[1] ) ) local playerName = getPlayerName( localPlayer ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, editmsg, false, false ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, playerName, false, false ) end ) Link to comment
3B00DG4MER Posted March 10, 2014 Author Share Posted March 10, 2014 Thanks Citizen But there is Problem When i start the resource nothing Happened I tried to add "bindkey",but the same Error Can you Help me ? GUIEditor = { window = {}, button = {}, gridlist = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(252, 144, 712, 475, "Support Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) showCursor( false ) GUIEditor.button[1] = guiCreateButton(585, 398, 111, 50, "Send", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[1], onClickSend, false) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.edit[1] = guiCreateEdit(35, 394, 540, 54, "", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(12, 27, 684, 361, false, GUIEditor.window[1]) local name = guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) local message = guiGridListAddColumn(GUIEditor.gridlist[1], "Message", 0.8 ) end ) function winshow() guiWindowSetSizable(GUIEditor.window[1], true) showCursor( true ) end bindKey ( player, "F2", "down", winshow ) function onClickSend(button, state) if button == "left" then local editmsg = tostring( guiGetText( GUIEditor.edit[1] ) ) local playerName = getPlayerName( localPlayer ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, editmsg, false, false ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, playerName, false, false ) end ) Link to comment
Moderators Citizen Posted March 10, 2014 Moderators Share Posted March 10, 2014 Modify your code to looks like this (I only modified these lines but the first part has nothing to do with the bind problem: guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) --removed useless variable here guiGridListAddColumn(GUIEditor.gridlist[1], "Message", 0.8 ) --removed useless variable here guiSetVisible(GUIEditor.window[1], false) --Make it invisible by default bindKey ( "F2", "down", winshow ) --Use the client syntax (you were using the server one) Don't forget you can use /debugscript 3 to see the errors on both sides (server and client). You need to be logged in as admin to be able to use /debuscript 3 Link to comment
3B00DG4MER Posted March 10, 2014 Author Share Posted March 10, 2014 Thanks,But i did it,Before you said it Thanks for the info to debug script 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