Jump to content

Problem


WASSIm.

Recommended Posts

hi guys i have problem its show me on memberCount "N/A"

Server

addEvent("onPlayerOpenGroupsList", true) 
addEventHandler("onPlayerOpenGroupsList", root, 
function ( ) 
    local getGroups = exports["server"]:dbQueryZA("SELECT * FROM groups") 
    local getMembers = exports["server"]:dbQueryZA("SELECT * FROM groupMembers") 
    triggerClientEvent(source, "onClientPlayerOpenGroupsList", source, getGroups, getMembers) 
end) 

Client

addEvent("onClientPlayerOpenGroupsList", true) 
addEventHandler("onClientPlayerOpenGroupsList", root, 
function (groups, members) 
    guiSetVisible(GUIGroup.window[1], true) 
    guiBringToFront(GUIGroup.window[1]) 
    guiGridListClear(GUIGroup.gridlist[1]) 
    for i, group in ipairs(groups) do 
        local groupName = group["groupName"] or "N/A" 
        local memberCount = members[groupName] or "N/A" 
        local row = guiGridListAddRow(GUIGroup.gridlist[1]) 
        guiGridListSetItemText(GUIGroup.gridlist[1], row, 1, tostring(groupName), false, false) 
        guiGridListSetItemText(GUIGroup.gridlist[1], row, 2, tostring(memberCount), false, false) 
    end 
end) 

Link to comment
addEvent ( "onClientPlayerOpenGroupsList", true ) 
addEventHandler ( "onClientPlayerOpenGroupsList", root, 
    function ( groups, members ) 
        guiSetVisible ( GUIGroup.window[1], true ) 
        guiBringToFront ( GUIGroup.window[1] ) 
        guiGridListClear ( GUIGroup.gridlist[1] ) 
        local memberCount = { } 
        for _, member in ipairs ( members ) do 
            if ( not memberCount [ member.groupName ] ) then 
                memberCount [ member.groupName ] = 0 
            end 
            memberCount [ member.groupName ] = ( memberCount [ member.groupName ] + 1 ) 
        end 
        for _, group in ipairs ( groups ) do 
            local groupName = ( group [ "groupName" ] or "N/A" ) 
            local count = ( memberCount [ groupName ] or "N/A" ) 
            local row = guiGridListAddRow ( GUIGroup.gridlist[1] ) 
            guiGridListSetItemText ( GUIGroup.gridlist[1], row, 1, tostring ( groupName ), false, false ) 
            guiGridListSetItemText ( GUIGroup.gridlist[1], row, 2, tostring ( count ), 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...