Jump to content

Problem


WASSIm.

Recommended Posts

Posted

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) 

Omerta Roleplay

Posted

Because that's not how it has to be done, "members" contains a table with all the members of all groups.

The format of "members" table would be:

row: [ column ]: value

row: [ column ]: value

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Post the column names from "groupMembers" table.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ID INTEGER PRIMARY KEY, groupName TEXT, memberName TEXT, memberAccount TEXT, memberLevel INT, memberWL INT, memberLastOn TEXT, memberJoinedOn TEXT

Omerta Roleplay

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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