Axel Posted March 29, 2013 Share Posted March 29, 2013 I'v made some log script in wich i want to store some data to mysql and see it whenever i want to. The GUI appears, the query it's made fine but when i open the GUI again, the data it's inserted twice in the gridList.. Here's the code: --Client: g_wnd = guiCreateWindow(0.35,0.15,0.30,0.50,"Log",true) wndlbl = guiCreateGridList(0.05,0.05,0.9,99, true, g_wnd) textcolum = guiGridListAddColumn(wndlbl, "Text", 0.9) guiSetVisible(g_wnd,false) function topHandler ( text ) local row = guiGridListAddRow(wndlbl) guiGridListSetItemText(wndlbl, row, textcolum, text, false, false) end addEvent( "guiclient", true ) addEventHandler( "guiclient", getRootElement(), topHandler ) function panel() if guiGetVisible(g_wnd)== false then guiSetVisible(g_wnd,true) showCursor( true ) triggerServerEvent ( "trigger", getLocalPlayer(), 1 ) else showCursor( false ) guiSetVisible(g_wnd,false) end end addCommandHandler("log",panel) bindKey("F6","down","log") -- Server function trigger ( type ) if type == 1 then local result = mysql:query("SELECT message FROM log") if (result) then local continue = true while continue do row = mysql:fetch_assoc(result) if not (row) then break end triggerClientEvent(source,"guiclient",source, row["message"]) end end mysql:free_result(result) end end addEvent( "trigger", true ) addEventHandler( "trigger", getRootElement(), trigger ) Thanks for helping! 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