hi guys ,
i make gridlist connected with executeSQLQuery
everythink work but only player account colmun in the executeSQLQuery
i want to put it in the gridlist but it's say to me nil
like this :
Client :
addEventHandler("onClientResourceStart", resourceRoot,
function()
WindowHistory = guiCreateWindow(390, 140, 590, 572, "History Za5rafa", false)
guiWindowSetSizable(WindowHistory, false)
guiSetAlpha(WindowHistory, 1.00)
guiSetProperty(WindowHistory, "CaptionColour", "FFFFFF00")
guiSetVisible(WindowHistory,false)
HistoryGridList = guiCreateGridList(13, 47, 567, 515, false, WindowHistory)
guiGridListAddColumn(HistoryGridList, "# Za7rafa :'", 0.3)
guiGridListAddColumn(HistoryGridList, "# Account Player : ", 0.3)
ExitHistory = guiCreateButton(542, 20, 38, 22, "X", false, WindowHistory)
guiSetFont(ExitHistory, "default-bold-small")
guiSetProperty(ExitHistory, "NormalTextColour", "FFFFFF00")
end
)
--------------------------------------------
addEventHandler("onClientGUIClick",root,
function()
if (source == HistoryZa5rafa) then
guiSetVisible(WindowAccounts,false)
guiSetVisible(WindowHistory,true)
triggerServerEvent("History1",localPlayer)
end
end
)
addEvent("History2",true)
addEventHandler("History2",root,
function(ExecuteSQLQuery)
for i , v in ipairs(ExecuteSQLQuery) do
local r = guiGridListAddRow(HistoryGridList)
guiGridListSetItemText(HistoryGridList, r, 1, tostring(v.NameMoza5rf), false, false)
guiGridListSetItemText(HistoryGridList, r, 2, tostring(v.aa), false, false)
end
end
)
addEventHandler("onClientGUIClick",root,
function()
if (source == ExitHistory) then
guiSetVisible(WindowAccounts,true)
guiSetVisible(WindowHistory,false)
end
end
)
Server :
addEventHandler('onResourceStart',resourceRoot,
function ()
local CreateHistoryTable = executeSQLQuery ('CREATE TABLE IF NOT EXISTS `History1` ( aa , NameMoza5rf ) ')
if ( CreateHistoryTable ) then
outputDebugString('Create [ VIP System ] History Za5rf Table done .')
end
)
addEvent("SetNameNew",true)
addEventHandler("SetNameNew",root,
function (NewName)
local Account = getPlayerAccount(source)
executeSQLQuery ( "INSERT INTO `History1` ( aa , NameMoza5rf ) VALUES(?,?)",Account,NewName )
outputChatBox("#FF0000* Your New Name In The Chat Now #FFF000[ ".. NewName .. " ]",source,255,255,255,true)
end
end
)
addEvent("History1",true)
addEventHandler("History1",root,
function()
local selectSQL = executeSQLQuery("SELECT * FROM `History1`")
if ( type (selectSQL) == "table" and #selectSQL == 0 or not selectSQL ) then return end
triggerClientEvent("History2",source,selectSQL)
end
)
i think it's should work but i don't know why it's dosen't work .