Focker Posted July 16, 2015 Share Posted July 16, 2015 (edited) . Edited July 16, 2015 by Guest Link to comment
GTX Posted July 16, 2015 Share Posted July 16, 2015 You're saying I didn't help you? Well, yeah, it was mostly because your English sucked and I suggested you to go to Spanish forums. Stop creating new topics, you have the old one, reply to it, bump it. And learn some English please... There you go: First you have to drop the table: executeSQLQuery("DROP TABLE LogAdmin") Client: logadmin = guiCreateGridList(0.01, 0.04, 0.70, 0.91, true, TabTest2) logadmid = guiGridListAddColumn(logadmin, "ID", 0.03) logadm1 = guiGridListAddColumn(logadmin, "Fecha", 0.1) logadm2 = guiGridListAddColumn(logadmin, "Admin", 0.3) logadm3 = guiGridListAddColumn(logadmin, "Premio", 0.3) logadm4 = guiGridListAddColumn(logadmin, "Cantidad", 0.3) logadm5 = guiGridListAddColumn(logadmin, "Selecc/Todos", 0.3) logadm6 = guiGridListAddColumn(logadmin, "Jugador", 0.3) borrarselec = guiCreateButton(0.73, 0.24, 0.13, 0.09, "Borrar Seleccionado", true, TabTest2) function onbtn() if source == borrarselec then borrarlogadmin() end end addEventHandler("onClientGUIClick", root, onbtn) function veryaellogad(tab) guiGridListClear(logadmin) for i, gs in pairs(tab) do local row = guiGridListAddRow(logadmin) guiGridListSetItemText(logadmin, row,logadmid, gs.id, false, true) guiGridListSetItemText(logadmin, row,logadm1, gs.Fecha, false, true) guiGridListSetItemText(logadmin, row,logadm2, gs.Admin, false, true) guiGridListSetItemText(logadmin, row,logadm3, gs.Premio, false, true) guiGridListSetItemText(logadmin, row,logadm4, gs.Cantidad, false, true) guiGridListSetItemText(logadmin, row,logadm5, gs.SelecTodos, false, true) guiGridListSetItemText(logadmin, row,logadm6, gs.Jugador, false, true) end end addEvent("veryaellog", true) addEventHandler("veryaellog", root, veryaellogad) function borrarlogadmin() local id = guiGridListGetItemText(logadmin, guiGridListGetSelectedItem(logadmin), 1) if id and id ~= -1 then triggerServerEvent("borrarlogadmin", localPlayer, id) end end triggerServerEvent("VerLogAdmin", localPlayer) Server: executeSQLQuery("CREATE TABLE IF NOT EXISTS LogAdmin (id INTEGER PRIMARY KEY, Fecha TEXT, Admin TEXT, Premio TEXT,Cantidad TEXT,SelecTodos TEXT,Jugador TEXT)") function VerLogAdmin() tablodelgadmin = executeSQLQuery("SELECT * FROM LogAdmin") triggerClientEvent (source,"veryaellog",source,tablodelgadmin) end addEvent ("VerLogAdmin", true) addEventHandler ("VerLogAdmin", root, VerLogAdmin) addEvent("borrarlogadmin", true) function borrarlogadmin(id) if id then executeSQLQuery("DELETE FROM LogAdmin WHERE id='"..id.."'") VerLogAdmin() end end addEventHandler("borrarlogadmin", root, borrarlogadmin) Link to comment
Focker Posted July 16, 2015 Author Share Posted July 16, 2015 Thank you !!!!!! Now I get error in a part of the script says Database query failed: PRIMARY KEY must be unique It is when I delete something and then try to give that error Link to comment
GTX Posted July 16, 2015 Share Posted July 16, 2015 I tested it and it works fine. I don't know what's the problem, try to delete the table and create it again. Link to comment
Focker Posted July 16, 2015 Author Share Posted July 16, 2015 Creates 5 tables and eliminates the 2 and recreated and will give that error will not let you create more Link to comment
GTX Posted July 16, 2015 Share Posted July 16, 2015 That's problem on other side of the script, not mine. Link to comment
Focker Posted July 16, 2015 Author Share Posted July 16, 2015 You can not fix this bug? Link to comment
GTX Posted July 16, 2015 Share Posted July 16, 2015 All I can tell you is, use the code correctly. executeSQLQuery("INSERT INTO LogAdmin (Fecha, Admin, Premio, Cantidad, SelecTodos, Jugador) VALUES ('a', 'b', 'c', 'd', 'e', 'f')") Link to comment
Focker Posted July 17, 2015 Author Share Posted July 17, 2015 Thanks GTX you are a pro 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