Jump to content

Question guiGridList


WASSIm.

Recommended Posts

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

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

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