iFoReX Posted March 27, 2012 Share Posted March 27, 2012 I want do a Gate GUI But I need help about how Set ID of Object please help me GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(200,105,461,417,"",false) GUIEditor_Edit[1] = guiCreateEdit(36,45,76,32,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(118,49,39,27,"ID",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],200,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[2] = guiCreateEdit(35,77,128,24,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[2],true) GUIEditor_Label[2] = guiCreateLabel(167,81,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],200,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Edit[3] = guiCreateEdit(36,101,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[3],true) GUIEditor_Label[3] = guiCreateLabel(167,103,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],200,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[4] = guiCreateEdit(36,122,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[4],true) GUIEditor_Label[4] = guiCreateLabel(167,123,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],200,0,0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(209,41,240,111,"Porfavor Poner el ID y aprietar obtener Posicion/ Please type ur ID and press Obtener Posicion\n---------------\nGui By Mota",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Button[1] = guiCreateButton(36,148,130,36,"Obtener Posicion",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(9,219,443,14,"-----------------------------------------------------------------------------------",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Edit[5] = guiCreateEdit(36,240,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[6] = guiCreateEdit(36,264,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[7] = guiCreateEdit(36,287,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(166,241,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],200,0,0) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(166,264,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[7],200,0,0) guiSetFont(GUIEditor_Label[7],"default-bold-small") GUIEditor_Label[8] = guiCreateLabel(166,291,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[8],200,0,0) guiSetFont(GUIEditor_Label[8],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(35,311,130,36,"Obtener Nueva Posicion",false,GUIEditor_Window[1]) GUIEditor_Memo[2] = guiCreateMemo(214,240,230,111,"aqui poner la nueva posicion X, Y y Z/ here put the new positions X, Y, Z\n---------------\nGui By Mota",false,GUIEditor_Window[1]) GUIEditor_Label[9] = guiCreateLabel(466,104,5,5,"",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(357,365,95,43,"Crear Gate or Elevator",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(261,367,95,39,"Cancel",false,GUIEditor_Window[1]) local me = getLocalPlayer(); guiSetVisible( GUIEditor_Window[1], false ); addEventHandler( 'onClientGUIClick', GUIEditor_Button[4], function( btn ) if btn ~= 'left' then return false; end; triggerEvent( 'HP_SetVisible', me, false ); end, false ); addEventHandler( 'onClientGUIClick', root, function( btn ) if btn ~= 'left' then return false; end; if source == GUIEditor_Button[1] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[2], x ); guiSetText( GUIEditor_Edit[3], y ); guiSetText( GUIEditor_Edit[4], z ); elseif source == GUIEditor_Button[2] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[5], x ); guiSetText( GUIEditor_Edit[6], y ); guiSetText( GUIEditor_Edit[7], z ); end; end ); This is my Gui please help me Link to comment
iFoReX Posted March 27, 2012 Author Share Posted March 27, 2012 sorry for the double post but please help me about how I can set the ID Link to comment
Castillo Posted March 27, 2012 Share Posted March 27, 2012 You want to get the ID from the gui-edit? if so, use guiGetText. Link to comment
iFoReX Posted March 27, 2012 Author Share Posted March 27, 2012 yeah man I use this but Idk how put in CreateObject please help me Link to comment
Castillo Posted March 27, 2012 Share Posted March 27, 2012 guiGetText returns a text string, convert it with tonumber ( string ) and you have the object ID. Link to comment
iFoReX Posted March 27, 2012 Author Share Posted March 27, 2012 :c ¿? u can give me a example ? please Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 createObject ( tonumber ( guiGetText ( edit ) ), 200, 300, 100 ); Link to comment
Feche1320 Posted March 28, 2012 Share Posted March 28, 2012 First of all, learn some proper english lol. Secondly, learn some lua too local x, y, z = 0, 0, 0 x = tonumber(guiGetText(GUIEditor_Edit[5])) y = tonumber(guiGetText(GUIEditor_Edit[6])) z = tonumber(guiGetText(GUIEditor_Edit[7])) Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 First of all, learn some proper english lol.Secondly, learn some lua too local x, y, z = 0, 0, 0 x = tonumber(guiGetText(GUIEditor_Edit[5])) y = tonumber(guiGetText(GUIEditor_Edit[6])) z = tonumber(guiGetText(GUIEditor_Edit[7])) Me?? Link to comment
Feche1320 Posted March 28, 2012 Share Posted March 28, 2012 First of all, learn some proper english lol.Secondly, learn some lua too local x, y, z = 0, 0, 0 x = tonumber(guiGetText(GUIEditor_Edit[5])) y = tonumber(guiGetText(GUIEditor_Edit[6])) z = tonumber(guiGetText(GUIEditor_Edit[7])) Me?? No Link to comment
X-SHADOW Posted March 28, 2012 Share Posted March 28, 2012 ElMota He is talking about you Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 ElMota He is talking about you xDD -.- xDxDxDxDxDxDxD Ok, lol now this is my code what is bad ? the .lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(200,105,461,417,"",false) GUIEditor_Edit[1] = guiCreateEdit(36,45,76,32,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(118,49,39,27,"ID",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],200,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[2] = guiCreateEdit(35,77,128,24,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[2],true) GUIEditor_Label[2] = guiCreateLabel(167,81,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],200,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Edit[3] = guiCreateEdit(36,101,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[3],true) GUIEditor_Label[3] = guiCreateLabel(167,103,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],200,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[4] = guiCreateEdit(36,122,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[4],true) GUIEditor_Label[4] = guiCreateLabel(167,123,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],200,0,0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(209,41,240,111,"Porfavor Poner el ID y aprietar obtener Posicion/ Please type ur ID and press Obtener Posicion\n---------------\nGui By Mota",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Button[1] = guiCreateButton(36,148,130,36,"Obtener Posicion",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(9,219,443,14,"-----------------------------------------------------------------------------------",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Edit[5] = guiCreateEdit(36,240,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[6] = guiCreateEdit(36,264,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[7] = guiCreateEdit(36,287,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(166,241,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],200,0,0) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(166,264,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[7],200,0,0) guiSetFont(GUIEditor_Label[7],"default-bold-small") GUIEditor_Label[8] = guiCreateLabel(166,291,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[8],200,0,0) guiSetFont(GUIEditor_Label[8],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(35,311,130,36,"Obtener Nueva Posicion",false,GUIEditor_Window[1]) GUIEditor_Memo[2] = guiCreateMemo(214,240,230,111,"aqui poner la nueva posicion X, Y y Z/ here put the new positions X, Y, Z\n---------------\nGui By Mota",false,GUIEditor_Window[1]) GUIEditor_Label[9] = guiCreateLabel(466,104,5,5,"",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(357,365,95,43,"Crear Gate or Elevator",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(261,367,95,39,"Cancel",false,GUIEditor_Window[1]) local me = getLocalPlayer(); guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end ) addCommandHandler("gpanel", function () guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) end ) addEventHandler( 'onClientGUIClick', root, function( btn ) if btn ~= 'left' then return false; end; if source == GUIEditor_Button[1] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[2], x ); guiSetText( GUIEditor_Edit[3], y ); guiSetText( GUIEditor_Edit[4], z ); elseif source == GUIEditor_Button[2] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[5], x ); guiSetText( GUIEditor_Edit[6], y ); guiSetText( GUIEditor_Edit[7], z ); elseif ( source == GUIEditor_Button[4] ) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end function creatingTheGate() local GUIGates_Gate[1] = createObject ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[2] ) ), tonumber ( guiGetText ( GUIEditor_Edit[3] ) ), tonumber ( guiGetText ( GUIEditor_Edit[4] ) ) ); moveObject(GUIGates_Gate,tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[5] ) ), tonumber ( guiGetText ( GUIEditor_Edit[6] ) ), tonumber ( guiGetText ( GUIEditor_Edit[7] ) ) end end addEventHandler("onClientGUIClick", GUIEditor_Button[3], creatingTheGate ) the code in console : [2012-03-29 09:25:01] Starting GUITest [2012-03-29 09:25:01] SCRIPT ERROR: GUITest\nice.lua:54: '' expected near 'end' [2012-03-29 09:25:01] WARNING: Loading script failed: GUITest\nice.lua:54: '' expected near 'end' [2012-03-29 09:25:01] GUITest restarted successfully please help me Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 I have a errors : [2012-03-29 09:33:42] Starting GUITest [2012-03-29 09:33:42] SCRIPT ERROR: GUITest\nice.lua:83: ')' expected (to close '(' at line 64) near 'function' [2012-03-29 09:33:42] WARNING: Loading script failed: GUITest\nice.lua:83: ')' expected (to close '(' at line 64) near 'function' [2012-03-29 09:33:42] GUITest restarted successfully Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 I do this now I have new errors lol - this is my code .lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(200,105,461,417,"",false) GUIEditor_Edit[1] = guiCreateEdit(36,45,76,32,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(118,49,39,27,"ID",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],200,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Edit[2] = guiCreateEdit(35,77,128,24,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[2],true) GUIEditor_Label[2] = guiCreateLabel(167,81,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],200,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Edit[3] = guiCreateEdit(36,101,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[3],true) GUIEditor_Label[3] = guiCreateLabel(167,103,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],200,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[4] = guiCreateEdit(36,122,129,22,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[4],true) GUIEditor_Label[4] = guiCreateLabel(167,123,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],200,0,0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(209,41,240,111,"Porfavor Poner el ID y aprietar obtener Posicion/ Please type ur ID and press Obtener Posicion\n---------------\nGui By Mota",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Button[1] = guiCreateButton(36,148,130,36,"Obtener Posicion",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(9,219,443,14,"-----------------------------------------------------------------------------------",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Edit[5] = guiCreateEdit(36,240,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[6] = guiCreateEdit(36,264,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Edit[7] = guiCreateEdit(36,287,128,24,"",false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(166,241,23,24,"X",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],200,0,0) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(166,264,23,24,"Y",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[7],200,0,0) guiSetFont(GUIEditor_Label[7],"default-bold-small") GUIEditor_Label[8] = guiCreateLabel(166,291,23,24,"Z",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[8],200,0,0) guiSetFont(GUIEditor_Label[8],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(35,311,130,36,"Obtener Nueva Posicion",false,GUIEditor_Window[1]) GUIEditor_Memo[2] = guiCreateMemo(214,240,230,111,"aqui poner la nueva posicion X, Y y Z/ here put the new positions X, Y, Z\n---------------\nGui By Mota",false,GUIEditor_Window[1]) GUIEditor_Label[9] = guiCreateLabel(466,104,5,5,"",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(357,365,95,43,"Crear Gate or Elevator",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(261,367,95,39,"Cancel",false,GUIEditor_Window[1]) local me = getLocalPlayer(); guiSetVisible(GUIEditor_Window[1], false) showCursor(false) addCommandHandler("gpanel", function () guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) end ) addEventHandler( 'onClientGUIClick', root, function( btn ) if btn ~= 'left' then return false; end; if source == GUIEditor_Button[1] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[2], x ); guiSetText( GUIEditor_Edit[3], y ); guiSetText( GUIEditor_Edit[4], z ); elseif source == GUIEditor_Button[2] then local x, y, z = getElementPosition( me ); guiSetText( GUIEditor_Edit[5], x ); guiSetText( GUIEditor_Edit[6], y ); guiSetText( GUIEditor_Edit[7], z ); elseif ( source == GUIEditor_Button[4] ) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end ) local GUIGates_Gate1 = createObject ( tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[2] ) ), tonumber ( guiGetText ( GUIEditor_Edit[3] ) ), tonumber ( guiGetText ( GUIEditor_Edit[4] ) ) ); function creatingTheGate() moveObject(GUIGates_Gate,tonumber ( guiGetText ( GUIEditor_Edit[1] ) ), tonumber ( guiGetText ( GUIEditor_Edit[5] ) ), tonumber ( guiGetText ( GUIEditor_Edit[6] ) ), tonumber ( guiGetText ( GUIEditor_Edit[7] ) ) end end ) addEventHandler("onClientGUIClick", GUIEditor_Button[3], creatingTheGate ) in console error: [2012-03-29 09:42:37] Starting GUITest [2012-03-29 09:42:37] SCRIPT ERROR: GUITest\nice.lua:90: ')' expected (to close '(' at line 88) near 'end' [2012-03-29 09:42:37] WARNING: Loading script failed: GUITest\nice.lua:90: ')' expected (to close '(' at line 88) near 'end' [2012-03-29 09:42:37] GUITest restarted successfully Link to comment
Kenix Posted March 28, 2012 Share Posted March 28, 2012 Read viewtopic.php?f=148&t=40809 You need fix it yourself. Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 lol 1230914011 manuals :c Link to comment
Kenix Posted March 28, 2012 Share Posted March 28, 2012 (edited) lol 1230914011 manuals :c What you mean? Anyway, if you not read all manuals you not going ahead in scripting. Edited March 28, 2012 by Guest Link to comment
drk Posted March 28, 2012 Share Posted March 28, 2012 You don't need learn all, at least 3 because some don't have all. It's not like just read the pages and you will be a pro. You need understand how works and how to use / when to use. Link to comment
Kenix Posted March 28, 2012 Share Posted March 28, 2012 You don't need learn all, at least 3 because some don't have all.It's not like just read the pages and you will be a pro. You need understand how works and how to use / when to use. If he want know lua he need read all. Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 only I want know the error Link to comment
Kenix Posted March 28, 2012 Share Posted March 28, 2012 only I want know the error It's joke? You need learn lua. I gave you link. Read! Want know error? You have syntax error in script. Link to comment
iFoReX Posted March 28, 2012 Author Share Posted March 28, 2012 Kenix I in Weekend learn lua, Now I dont have time because I want know the error 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