Jump to content

GUI PRoblem :D


iFoReX

Recommended Posts

Posted

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 
    ) 
      
  

Posted
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 
    ) 

Posted (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 by Guest
Posted

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]) 

Posted

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

Posted
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 
) 

Posted

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

Posted

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?

Posted (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 :

mtascreen20120402061017.png

Edited by Guest
Posted

You have to use:

guiGridListGetSelectedItem -- Get selected item on a grid list. 
guiGridListGetItemText -- Get text of selected item on a grid list. 

Posted
... 
  
local name = getPlayerName ( source ) 
  
function getName() 
guiSetText ( GUIEditor_Label[1], "... name") 
       end 
end 
  
addEventHandler("onClientDoubleClick",GUIEditor_Grid[1],getName) 
  

what is bad ?

Posted

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.

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...