Jump to content

[HELP] Grid List


Recommended Posts

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

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

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