How about this ?
function sql(thePlayer)
team = getPlayerTeam(thePlayer)
teamstr = getTeamName(team)
local sql = mysql:query("SELECT `username` FROM `accounts` WHERE `factiune` = '"..teamstr.."'")
if (sql) then
while true do
row = mysql:fetch_assoc(sql)
if (not row) then break end
jucatori = row["username"]
triggerClientEvent(source, "factiunemeniu", getRootElement(), jucatori)
end
mysql:free_result(sql)
end
end
addEventHandler("onPlayerJoin", getRootElement(), sql)
function factiunemeniu(jucatori)
meniu = guiCreateWindow(233,164,600,440,"Meniu factiune",false)
grid = guiCreateGridList(9,29,467,379,false,meniu)
local nume = guiGridListAddColumn(grid,"Nume",0.2)
outputDebugString(jucatori)
for k, v in ipairs (jucatori) do
local row = guiGridListAddRow(grid)
guiGridListSetItemText(grid, row, nume, jucatori, false, false)
end
end
addEvent("factiunemeniu", true)
addEventHandler("factiunemeniu", getRootElement(), factiunemeniu)
On outputDebugString(jucatori) returns nil. In server side the debug shows