Seba500PLK Posted April 7, 2015 Share Posted April 7, 2015 Hi, my problem is grid --Client function grid(cheaters) local ListCheaters = guiCreateGridList ( 0.7, 0.10, 0.2, 0.60, true,t5 ) local ColumnCheaters = guiGridListAddColumn( ListCheaters, "Cheater", 0.85 ) if (isElement(ListCheaters)) then for id, player in ipairs(cheaters) do local row = guiGridListAddRow ( ListCheaters ) guiGridListSetItemText(ListCheaters, guiGridListAddRow(ListCheaters), ColumnCheaters, player, false, false) end end end addEvent( "ZMDA", true ) addEventHandler( "ZMDA", localPlayer,grid) --Server function getCheaterID(g) local sql = dbQuery(dbConnection,"SELECT * FROM TabsCheaterzy") local result = dbPoll ( sql, -1 ) if result then for _, row in ipairs ( result ) do triggerClientEvent ( g, "ZMDA", g, tostring(row["Nick_Cheatera"]) ) end end end addCommandHandler ( "cc", getCheaterID ) MySQL is: Nick_Cheatera Kolas Nobas Lia jusah kidol debugscript 3: ERROR: [sCRIPT]\Panel\scriptClient.lua:16: Bad argument #1 to 'ipairs' (table expected, got string) ERROR: [sCRIPT]\Panel\scriptClient.lua:16: Bad argument #1 to 'ipairs' (table expected, got string) ERROR: [sCRIPT]\Panel\scriptClient.lua:16: Bad argument #1 to 'ipairs' (table expected, got string) ERROR: [sCRIPT]\Panel\scriptClient.lua:16: Bad argument #1 to 'ipairs' (table expected, got string) ERROR: [sCRIPT]\Panel\scriptClient.lua:16: Bad argument #1 to 'ipairs' (table expected, got string) Link to comment
WhoAmI Posted April 7, 2015 Share Posted April 7, 2015 Delete 'for' serverside and trigger table to client. Make loop (for) clientside. Just trigger 'result' only. Link to comment
Seba500PLK Posted April 8, 2015 Author Share Posted April 8, 2015 Delete 'for' serverside and trigger table to client. Make loop (for) clientside.Just trigger 'result' only. 0.o i no understand. If in server side add outputChatBox : function getCheaterID(g) local sql = dbQuery(dbConnection,"SELECT * FROM TabsCheaterzy") local result = dbPoll ( sql, -1 ) if result then for _, row in ipairs ( result ) do outputChatBox ( row["Nick_Cheatera"] ) --triggerClientEvent ( g, "ZMDA", g, tostring(row["Nick_Cheatera"]) ) end end end addCommandHandler ( "cc", getCheaterID ) in chat show: Kolas Nobas Lia jusah kidol Link to comment
ALw7sH Posted April 8, 2015 Share Posted April 8, 2015 Server: function getCheaterID(g) local sql = dbQuery(dbConnection,"SELECT * FROM TabsCheaterzy") local result = dbPoll ( sql, -1 ) if result then triggerClientEvent ( g, "ZMDA", g, result ) end end addCommandHandler ( "cc", getCheaterID ) Client: function grid(cheaters) local ListCheaters = guiCreateGridList ( 0.7, 0.10, 0.2, 0.60, true,t5 ) local ColumnCheaters = guiGridListAddColumn( ListCheaters, "Cheater", 0.85 ) if (isElement(ListCheaters)) then for id, row in ipairs(cheaters) do local player = row["Nick_Cheatera"] guiGridListSetItemText(ListCheaters, guiGridListAddRow(ListCheaters), ColumnCheaters, player, false, false) end end end addEvent( "ZMDA", true ) addEventHandler( "ZMDA", localPlayer,grid) Link to comment
Seba500PLK Posted April 8, 2015 Author Share Posted April 8, 2015 Server: function getCheaterID(g) local sql = dbQuery(dbConnection,"SELECT * FROM TabsCheaterzy") local result = dbPoll ( sql, -1 ) if result then triggerClientEvent ( g, "ZMDA", g, result ) end end addCommandHandler ( "cc", getCheaterID ) Client: function grid(cheaters) local ListCheaters = guiCreateGridList ( 0.7, 0.10, 0.2, 0.60, true,t5 ) local ColumnCheaters = guiGridListAddColumn( ListCheaters, "Cheater", 0.85 ) if (isElement(ListCheaters)) then for id, row in ipairs(cheaters) do local player = row["Nick_Cheatera"] guiGridListSetItemText(ListCheaters, guiGridListAddRow(ListCheaters), ColumnCheaters, player, false, false) end end end addEvent( "ZMDA", true ) addEventHandler( "ZMDA", localPlayer,grid) ohhh nice!! thx 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