iFoReX Posted April 1, 2012 Share Posted April 1, 2012 Help me with it I cant open the window and the grid GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,"PM a getPlayerName(getLocalPlayer())",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"aaaa",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(63,119,184,377,false) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list if ( column ) then -- If the column was successfully created for id, playeritem in ipairs(getElementsByType("player")) do --Loop through all the players, adding them to the table local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) end end end bindKey("F7","down", function () guiSetVisible(GUIEditor_Grid[1], true) guiSetVisible(GUIEditor_Welcome[1], true) showCursor(true) end ) Link to comment
X-SHADOW Posted April 1, 2012 Share Posted April 1, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,"PM a getPlayerName(getLocalPlayer())",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"aaaa",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(63,119,184,377,false) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list if ( column ) then -- If the column was successfully created for id, playeritem in ipairs(getElementsByType("player")) do --Loop through all the players, adding them to the table local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) end end bindKey("F7","down", function () guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end ) Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 x shadow but the Grid ? Link to comment
TAPL Posted April 1, 2012 Share Posted April 1, 2012 (edited) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) local text = "PM a "..getPlayerName(localPlayer) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,text,false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"aaaa",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(63,119,184,377,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local column = guiGridListAddColumn(GUIEditor_Grid[1], "Player", 0.85 ) -- Create a 'players' column in the list if ( column ) then -- If the column was successfully created for id, playeritem in ipairs(getElementsByType("player")) do --Loop through all the players, adding them to the table local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText (GUIEditor_Grid[1], row, column, getPlayerName(playeritem ), false, false ) end end end bindKey("F7","down", function() if guiGetVisible(GUIEditor_Welcome[1]) then guiSetVisible(GUIEditor_Welcome[1], false) showCursor(false) else guiSetVisible(GUIEditor_Welcome[1], true) showCursor(true) end end) Edited April 1, 2012 by Guest Link to comment
X-SHADOW Posted April 1, 2012 Share Posted April 1, 2012 (edited) and what is GuiWelcome this ? Edited April 1, 2012 by Guest Link to comment
Absence2 Posted April 1, 2012 Share Posted April 1, 2012 read thru your code elmota, your gridlist isn't attached to the window --yours GUIEditor_Grid[1] = guiCreateGridList(63,119,184,377,false) --correct GUIEditor_Grid[1] = guiCreateGridList(63,119,184,377,false,GUIEditor_Window[1]) Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 Dont man the Grid dont is in Window Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 I already done the Bindkey , but the players dont show in the GridList GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(GuiEditor_Window[2], false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,"PM a getPlayerName(getLocalPlayer())",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Window[2] = guiCreateWindow(84,122,163,376,"",false) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) GUIEditor_Grid[1] = guiCreateGridList(9,26,145,338,false,GUIEditor_Window[2]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local column = guiGridListAddColumn(GUIEditor_Grid[1], "Player", 0.85 ) if ( column ) then for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText (GUIEditor_Grid[1], row, column, getPlayerName(playeritem ), false, false ) end end end bindKey("F7","down", function() if guiGetVisible(GUIEditor_Welcome[1]) then guiSetVisible(GUIEditor_Welcome[1], false) showCursor(false) else guiSetVisible(GUIEditor_Welcome[1], true) showCursor(true) elseif guiGetVisible(GUIEditor_Welcome[2]) then guiSerVisible(GUIEditor_Welcome[2], false) showCursor(false) else guiSetVisible(GUIEditor_Welcome[2], true) showCursor(true) end end) EDIT: the bindkey dont show the GUIs :c Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) guiSetVisible(GUIEditor_Window[1], false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,"PM a ",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Window[2] = guiCreateWindow(84,122,163,376,"",false) guiSetVisible(GUIEditor_Window[2], false) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) GUIEditor_Grid[1] = guiCreateGridList(9,26,145,338,false,GUIEditor_Window[2]) local column = guiGridListAddColumn ( GUIEditor_Grid[1], "Player", 0.85 ) if ( column ) then for id, playeritem in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, column, getPlayerName( playeritem ), false, false ) end end bindKey ( "F7", "down", function ( ) guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) guiSetVisible ( GUIEditor_Window[2], not guiGetVisible ( GUIEditor_Window[2] ) ) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) end ) Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 what is bad ? now the WindowS dont appear with the bindkey, I put for DoubleClick the player in label : PM TO THEPLAYER but dont work :c Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 I've tested the script and it works just fine. About the double click, how can it ever do that if you didn't add the script to do it? Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 (edited) Here the script GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(247,116,339,383,"",false) guiSetVisible(GUIEditor_Window[1], false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(46,43,223,20,"PM a ".. playerName",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Memo[1] = guiCreateMemo(12,76,312,236,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Edit[1] = guiCreateEdit(12,318,239,38,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(252,315,78,44,"Enviar",false,GUIEditor_Window[1]) GUIEditor_Window[2] = guiCreateWindow(84,122,163,376,"",false) guiSetVisible(GUIEditor_Window[2], false) guiWindowSetMovable(GUIEditor_Window[2],false) guiWindowSetSizable(GUIEditor_Window[2],false) GUIEditor_Grid[1] = guiCreateGridList(9,26,145,338,false,GUIEditor_Window[2]) local column = guiGridListAddColumn ( GUIEditor_Grid[1], "Player", 0.85 ) if ( column ) then for id, playeritem in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, column, getPlayerName( playeritem ), false, false ) end end function doubleClickedName( ) local selectedRow, selectedCol = guiGridListGetSelectedItem( GUIEditor_Grid[1] ) local playerName = guiGridListGetItemText( GUIEditor_Grid[1], selectedRow, selectedCol ) end addEventHandler( "onClientGUIDoubleClick", GUIEditor_Grid[1], doubleClickedName, false ); bindKey ( "F7", "down", function ( ) guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) guiSetVisible ( GUIEditor_Window[2], not guiGetVisible ( GUIEditor_Window[2] ) ) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) end ) here the debugscript : Edited April 1, 2012 by Guest Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 Because that make's no sense, you don't want to set the label to local player name, but to the selected player. Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 I want when the player double click in a item the label change to : PM TO : selectedplayer Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 You have to use: guiGridListGetSelectedItem -- Get selected item on a grid list. guiGridListGetItemText -- Get text of selected item on a grid list. Link to comment
iFoReX Posted April 1, 2012 Author Share Posted April 1, 2012 ... local name = getPlayerName ( source ) function getName() guiSetText ( GUIEditor_Label[1], "... name") end end addEventHandler("onClientDoubleClick",GUIEditor_Grid[1],getName) what is bad ? Link to comment
drk Posted April 4, 2012 Share Posted April 4, 2012 All. addEventHandler ( 'onClientGUIDoubleClick', root, function ( ) if ( source == GUIEditor_Grid[1] ) then guiSetText ( GUIEditor_Label[1], getPlayerName ( elem ) ) end end ) I don't know what element you want to get name, so you need change elem to your element. 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