Baseplate Posted June 7, 2015 Share Posted June 7, 2015 --Client function openPanel(result4) for h=1,#result4 do guiGridListClear(manageGridList) row = guiGridListAddRow(manageGridList) guiGridListSetItemText(manageGridList, row, 1, result4[h]["accName"], false, false) guiGridListSetItemText(manageGridList, row, 2, result4[h]["rank"], false, false) end addEvent("openGroupPanel", true) addEventHandler("openGroupPanel", root, openPanel) --Server executeSQLQuery("CREATE TABLE IF NOT EXISTS groupMembers (groupName TEXT, accName TEXT, rank TEXT)") function openServerPanel(thePlayer) local accName = getAccountName(getPlayerAccount(thePlayer)) local group = getElementData(thePlayer, "Group") local result4 = executeSQLQuery("SELECT * FROM groupMembers WHERE groupName=?", group) triggerClientEvent(thePlayer, "openGroupPanel", thePlayer, result4) end The problem; as when I open the gridlist it only displays the last result found. P.S: I obviously didn't post all of the code, just the part that isn't working properly. Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 Try this one. -- Client Side function openPanel(result4) guiGridListClear(manageGridList) for i , v in pairs (result4) do local row = guiGridListAddRow(manageGridList) guiGridListSetItemText(manageGridList, row, 1, v["accName"], false, false) guiGridListSetItemText(manageGridList, row, 2, v["rank"], false, false) end end addEvent("openGroupPanel", true) addEventHandler("openGroupPanel", root, openPanel) -- Server Side executeSQLQuery("CREATE TABLE IF NOT EXISTS groupMembers (groupName TEXT, accName TEXT, rank TEXT)") function openServerPanel(thePlayer) local accName = getAccountName(getPlayerAccount(thePlayer)) local group = getElementData(thePlayer, "Group") local result4 = executeSQLQuery("SELECT * FROM groupMembers WHERE groupName=?", group) triggerClientEvent(thePlayer, "openGroupPanel", thePlayer, result4) end Link to comment
Baseplate Posted June 7, 2015 Author Share Posted June 7, 2015 Works like a charm, thanks a lot for helping. Link to comment
Walid Posted June 7, 2015 Share Posted June 7, 2015 Works like a charm, thanks a lot for helping. np. 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