Jump to content

how I can Set ID for createObject


iFoReX

Recommended Posts

I want do a Gate GUI But I need help about how Set ID of Object please help me :D

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 :D

Link to comment
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
ElMota He is talking about you :lol:

xDD -.- xDxDxDxDxDxDxD

Ok, lol

now this is my code :D

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 :D

Link to comment

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

I do this now I have new errors lol xD -:D 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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...