Adde Posted September 17, 2013 Share Posted September 17, 2013 Hello, I have my panel here where it supposed to be showing player names in the gridlist. I did exactly as I read on wiki and in another topic but it wont work. Nothing in debug can anyone see the problem? just so you know, this: GUIEditor = { tab = {}, tabpanel = {}, button = {}, label = {}, window = {}, gridlist = {} } is not the problem, i just removed all labels and buttons to make it easier to read. client GUIEditor = { tab = {}, tabpanel = {}, button = {}, label = {}, window = {}, gridlist = {} } local x, y = guiGetScreenSize() GUIEditor.window[11] = guiCreateWindow(1389/1920*x, 359/1080*y, 475, 506, "Staff panel", false) guiWindowSetSizable(GUIEditor.window[11], false) guiSetVisible(GUIEditor.window[11], false) guiSetProperty(GUIEditor.window[11], "CaptionColour", "FFFF0000") GUIEditor.tabpanel[1] = guiCreateTabPanel(10, 23, 455, 473, false, GUIEditor.window[11]) GUIEditor.tab[11] = guiCreateTab("Players", GUIEditor.tabpanel[1]) GUIEditor.gridlist[1] = guiCreateGridList(9, 10, 187, 428, false, GUIEditor.tab[11]) guiGridListSetSelectionMode(GUIEditor.gridlist[1], 2) column = guiGridListAddColumn(GUIEditor.gridlist[1], "Player Name", 1) function Refresh () guiGridListClear ( GUIEditor_gridlist[1] ) if column then for id,playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_gridlist[1]) guiGridListSetItemText(GUIEditor_gridlist[1], row, column, getPlayerName(playeritem), false, false) end end end addEventHandler ( "onClientPlayerJoin", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerQuit", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), Refresh ) Link to comment
isa_Khamdan Posted September 17, 2013 Share Posted September 17, 2013 Hello, I have my panel here where it supposed to be showing player names in the gridlist. I did exactly as I read on wiki and in another topic but it wont work. Nothing in debug can anyone see the problem?just so you know, this: GUIEditor = { tab = {}, tabpanel = {}, button = {}, label = {}, window = {}, gridlist = {} } is not the problem, i just removed all labels and buttons to make it easier to read. client GUIEditor = { tab = {}, tabpanel = {}, button = {}, label = {}, window = {}, gridlist = {} } local x, y = guiGetScreenSize() GUIEditor.window[11] = guiCreateWindow(1389/1920*x, 359/1080*y, 475, 506, "Staff panel", false) guiWindowSetSizable(GUIEditor.window[11], false) guiSetVisible(GUIEditor.window[11], false) guiSetProperty(GUIEditor.window[11], "CaptionColour", "FFFF0000") GUIEditor.tabpanel[1] = guiCreateTabPanel(10, 23, 455, 473, false, GUIEditor.window[11]) GUIEditor.tab[11] = guiCreateTab("Players", GUIEditor.tabpanel[1]) GUIEditor.gridlist[1] = guiCreateGridList(9, 10, 187, 428, false, GUIEditor.tab[11]) guiGridListSetSelectionMode(GUIEditor.gridlist[1], 2) column = guiGridListAddColumn(GUIEditor.gridlist[1], "Player Name", 1) function Refresh () guiGridListClear ( GUIEditor_gridlist[1] ) if column then for id,playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_gridlist[1]) guiGridListSetItemText(GUIEditor_gridlist[1], row, column, getPlayerName(playeritem), false, false) end end end addEventHandler ( "onClientPlayerJoin", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerQuit", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), Refresh ) lol that's my code just a second and I will post a fix for you Edit: here is it clientsideResourceStart = function() 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 addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) function Refresh () guiGridListClear ( GUIEditor_Grid[1] ) 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 addEventHandler ( "onClientPlayerJoin", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerQuit", getRootElement(), Refresh ) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), Refresh ) That's should work Edit: else edit the gui Grid list name in the code because it's different than yours. Link to comment
Adde Posted September 17, 2013 Author Share Posted September 17, 2013 Haha yes hmm, " attempt to index global "GUIEditor_gridlist" (a nil value) " I have changed gridlist name to GUIEditor_gridlist[1] everywere even tried to copy again and change my created gridlist name. Link to comment
isa_Khamdan Posted September 17, 2013 Share Posted September 17, 2013 Haha yes hmm, " attempt to index global "GUIEditor_gridlist" (a nil value) " I have changed gridlist name to GUIEditor_gridlist[1] everywere even tried to copy again and change my created gridlist name. Change _ to . ( That's your Grid list name "GUIEditor.gridlist[1]" ) Link to comment
Adde Posted September 17, 2013 Author Share Posted September 17, 2013 oh Thx, works now haha, someone helped you and you helped me Link to comment
isa_Khamdan Posted September 17, 2013 Share Posted September 17, 2013 oh Thx, works now haha, someone helped you and you helped me You are welcome Link to comment
Adde Posted September 17, 2013 Author Share Posted September 17, 2013 Btw, I don´t remember how I use guiGridListGetSelectedItem to use for players. I found something and tried to code it. Is this right? function kick() if ( guiGridListGetSelectedItem ( GUIEditor.Grid ) ~= -1 ) then local player = getPlayerFromNick ( guiGridListGetItemPlayerName ( GUIEditor.Grid, guiGridListGetSelectedItem( GUIEditor.Grid ), 1 ) ) if ( player ) then triggerServerEvent( player, "kickplayer") end end addEventhandler("onClientGuiClick", GUIEditor.button[5], kick) 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