Estevez Posted May 27, 2015 Share Posted May 27, 2015 (edited) problem resolved. ty Edited May 28, 2015 by Guest Link to comment
Estevez Posted May 28, 2015 Author Share Posted May 28, 2015 so can somebody help me ? Link to comment
Walid Posted May 28, 2015 Share Posted May 28, 2015 so can somebody help me ? Clear the grid list before adding new rows all what you need is guiGridListClear() like this local ateamablak = nil function listAllOfAdminRender(anick, alvl) if (ateamablak == nil) then guiSetInputEnabled(true) local sx,sy = guiGetScreenSize () local width = 250 local height = 400 local ateamablak = guiCreateWindow (sx/2-width/2,sy/2-height/2,width,height,"servername - adminteam",false) local Bezaras = guiCreateButton (10,height-30,width-20,22,"Close",false,ateamablak) local lista = guiCreateGridList (10,25,width-20,height-60,false,ateamablak) local d3 = guiGridListAddColumn (lista,"Rang",0.35) local d2 = guiGridListAddColumn (lista,"Név",0.43) guiWindowSetMovable(ateamablak, false) guiWindowSetSizable(ateamablak, false) guiGridListClear(lista) local row = guiGridListAddRow ( lista ) guiGridListSetItemText ( lista, row, d2, anick, false, false ) guiGridListSetItemText ( lista, row, d3, alvl, false, false ) guiBringToFront (Bezaras) guiSetVisible (ateamablak, true) addEventHandler ("onClientGUIClick", Bezaras, function(button, state) if (button == "left") then if (state == "up") then guiSetVisible(ateamablak, false) showCursor (false) guiSetInputEnabled(false) ateamablak = nil end end end, false) else local lathato = guiGetVisible (ateamablak) if (lathato == false) then guiSetVisible( ateamablak, true) showCursor (true) else showCursor(false) end end end addEvent("listAllOfAdminRender", true) addEventHandler("listAllOfAdminRender", resourceRoot, listAllOfAdminRender) Link to comment
Estevez Posted May 28, 2015 Author Share Posted May 28, 2015 Doesnt work The problem still exists. There are so many pages as there are admins name Link to comment
Walid Posted May 28, 2015 Share Posted May 28, 2015 Doesnt work The problem still exists. There are so many pages as there are admins name explane your problem better, post some SS here. /debugscript Link to comment
Estevez Posted May 28, 2015 Author Share Posted May 28, 2015 i dont get warnings/errors in debugscript 3 my problem looks like this: ( i've moved the windows so that u can see my problem. ) http://prntscr.com/7adlee Link to comment
Walid Posted May 28, 2015 Share Posted May 28, 2015 i dont get warnings/errors in debugscript 3my problem looks like this: ( i've moved the windows so that u can see my problem. ) http://prntscr.com/7adlee -- Client Side local sx,sy = guiGetScreenSize () local width = 250 local height = 400 addEventHandler("onClientResourceStart",resourceRoot, function() ateamablak = guiCreateWindow (sx/2-width/2,sy/2-height/2,width,height,"servername - adminteam",false) Bezaras = guiCreateButton (10,height-30,width-20,22,"Close",false,ateamablak) lista = guiCreateGridList (10,25,width-20,height-60,false,ateamablak) d3 = guiGridListAddColumn (lista,"Rang",0.35) d2 = guiGridListAddColumn (lista,"Név",0.43) guiWindowSetMovable(ateamablak, false) guiWindowSetSizable(ateamablak, false) guiSetVisible(ateamablak, false) addEventHandler ("onClientGUIClick", Bezaras, CloseGui,false) end ) function listAllOfAdminRender(table) guiSetVisible( ateamablak, true) showCursor (true) guiSetInputEnabled(true) guiGridListClear(lista) for k,v in pairs(table) do local row = guiGridListAddRow ( lista ) guiGridListSetItemText ( lista, row, d2, v[1], false, false ) guiGridListSetItemText ( lista, row, d3, v[2], false, false ) end end addEvent("listAllOfAdminRender", true) addEventHandler("listAllOfAdminRender", resourceRoot, listAllOfAdminRender) function CloseGui(button, state) if (button == "left") and (state == "up") then guiSetVisible(ateamablak, false) showCursor (false) guiSetInputEnabled(false) end end -- Server side local connection = dbConnect( "mysql", exports.roleplay_global:getSQLData() ) function listAllOfAdmin(player) admins = {} local query = dbQuery(connection,"SELECT * FROM `account` WHERE `admin` >= '1'") local result = dbPoll(query, -1) local aNick, adminLevel if result then for k, data in ipairs (result) do aNick = data["anick"] adminLevel = data["admin"] table.insert(admins,{aNick,adminLevel}) triggerClientEvent(player,"listAllOfAdminRender", resourceRoot, admins) end else return end dbFree(query) end addCommandHandler("asd", listAllOfAdmin) Link to comment
xeon17 Posted May 28, 2015 Share Posted May 28, 2015 problem resolved.ty You are new on the forum so you probably don't know it but you shouldn't remove your code as it could help peoples who have the same problem. 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