WASSIm. Posted September 6, 2013 Share Posted September 6, 2013 hi guys i have question how get all acount in guiGridList ? Link to comment
xXMADEXx Posted September 6, 2013 Share Posted September 6, 2013 You need to trigger a client event that haves a table containing all the accounts: getAccounts Link to comment
WASSIm. Posted September 6, 2013 Author Share Posted September 6, 2013 You need to trigger a client event that haves a table containing all the accounts: getAccounts nothing and no error CLIENT addEvent("onClientLoadAccountsList",true) addEventHandler("onClientLoadAccountsList", root, function(text) guiGridListClear(tabaccountslist) local row = guiGridListAddRow ( tabaccountslist ) guiGridListSetItemText ( tabaccountslist, row, tabaccountslistcolumn, text, false, false ) end ) SERVER function onLoadAccountsList( ) for _,accounts in ipairs(getAccounts()) do local names = getAccountName(accounts) triggerClientEvent("onClientLoadAccountsList",root,names) end end addEvent( "onLoadAccountsList", true ) addEventHandler( "onLoadAccountsList", getRootElement(), onLoadAccountsList) Link to comment
RainBow Posted September 6, 2013 Share Posted September 6, 2013 uh on the server side, the table is not a table its a function, make a table like AccountsT={} Link to comment
WASSIm. Posted September 6, 2013 Author Share Posted September 6, 2013 uh on the server side, the table is not a table its a function, make a table like AccountsT={} can make it plis. don't understand the tables Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 -- server side: function onLoadAccountsList ( ) local accounts = { } for _, account in ipairs ( getAccounts ( ) ) do table.insert ( accounts, getAccountName ( account ) ) end triggerClientEvent ( "onClientLoadAccountsList", root, accounts ) end addEvent ( "onLoadAccountsList", true ) addEventHandler ( "onLoadAccountsList", getRootElement(), onLoadAccountsList ) -- client side: addEvent ( "onClientLoadAccountsList", true ) addEventHandler ( "onClientLoadAccountsList", root, function ( accounts ) guiGridListClear ( tabaccountslist ) for _, name in ipairs ( accounts ) do local row = guiGridListAddRow ( tabaccountslist ) guiGridListSetItemText ( tabaccountslist, row, tabaccountslistcolumn, name, false, false ) end end ) Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 Copy the client side again. Link to comment
WASSIm. Posted September 6, 2013 Author Share Posted September 6, 2013 Copy the client side again. nothing Link to comment
Castillo Posted September 6, 2013 Share Posted September 6, 2013 No errors or anything at debugscript? Post your whole code. Link to comment
WASSIm. Posted September 6, 2013 Author Share Posted September 6, 2013 No errors or anything at debugscript?Post your whole code. function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end bindKey( "0", "down", function ( ) --if (getPlayerTeam ( localPlayer ) and getTeamName ( getPlayerTeam ( localPlayer ) ) == "STAFF") then local window = guiGetVisible ( windows ) if ( window == true ) then guiSetVisible ( windows, false ) showCursor ( false) else guiSetVisible ( windows, true ) showCursor ( true) triggerServerEvent("onLoadPlayerList", getRootElement()) triggerServerEvent("onLoadResourcesList", getRootElement()) triggerServerEvent("onLoadAccountsList", getRootElement()) end --end end ) -------------------------------------------------------------------------------------------------- -----------------------------------------WINDOWS-------------------------------------------------- -------------------------------------------------------------------------------------------------- windows = guiCreateWindow(380, 131, 763, 575, "Admin Panel", false) guiWindowSetSizable(windows, false) guiSetVisible ( windows, false ) centerWindow(windows) tabpanel = guiCreateTabPanel(10, 26, 743, 539, false, windows) -------------------------------------------------------------------------------------------------- -------------------------------------TAB ACOUNTS-------------------------------------------------- -------------------------------------------------------------------------------------------------- tabaccounts = guiCreateTab("Acounts", tabpanel) tabaccountslist = guiCreateGridList(10, 10, 203, 495, false, tabaccounts) tabaccountslistcolumn = guiGridListAddColumn(tabaccountslist, "Acounts", 0.-- s8) --> tabaccountsinfo = guiCreateLabel(223, 10, 324, 495, "Account General Information:\n\n-Account Name:\n\n\n\nGame Information:\n\n-Created Time:\n-Last Time Connected:\n-Time Onilne:", false, tabaccounts) guiSetFont(tabaccountslist, "default-bold-small") tabaccountscreateaccount = guiCreateButton(547, 10, 190, 32, "Create Acount", false, tabaccounts) tabaccountsdeleteaccount = guiCreateButton(547, 78, 190, 32, "Delete Account", false, tabaccounts) tabaccountsline1 = guiCreateLabel(547, 53, 190, 15, "-------------------------------------------------------------", false, tabaccounts) tabaccountschangepassworld = guiCreateButton(547, 121, 190, 32, "Change Passworld", false, tabaccounts) addEvent ( "onClientLoadAccountsList", true ) addEventHandler ( "onClientLoadAccountsList", root, function ( accounts ) guiGridListClear ( tabaccountslist ) for _, name in ipairs ( accounts ) do local row = guiGridListAddRow ( tabaccountslist ) guiGridListSetItemText ( tabaccountslist, row, tabaccountslistcolumn, name, false, false ) end end ) 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