freudo Posted October 29, 2014 Share Posted October 29, 2014 I need help This code its working but ı dont send clientside pls help me! İts work but Don't refresh gridlist server: local amountOfTopsToDisplay = 3 -- how many tops you need function ToplistServerClans(player, command) local file = xmlLoadFile("clans.xml") -- load file if file then -- if file exists local tableOrder = {} -- make a table local subTable = {} -- make a sub table for i,v in ipairs(xmlNodeGetChildren(file)) do -- get children from file subTable.name = xmlNodeGetAttribute(v, "isim") -- name goes in subTable subTable.data = xmlNodeGetAttribute(v, "ClanWin") -- data goes in subTable table.insert(tableOrder, subTable) -- subTable is inserted in bigger table subTable = {} -- empty subTable for next loop end table.sort(tableOrder, function(a,b) return tonumber(a.data) > tonumber(b.data) end) -- put data in order for i,v in ipairs(tableOrder) do -- loop the sorted table outputChatBox("#f4a460[TOP]#ffffffEn iyi #ff33333 #ffffffClan!",root,255,0,0,true) outputChatBox(i..". "..v.name.." - #ff3333"..v.data, player, 255,255,255,true) -- display in order if i == amountOfTopsToDisplay then break end -- when enough tops has been shown, break it end xmlUnloadFile(file) -- unload the file from memory triggerClientEvent("onServerTopClans",player,tableOrder) end end addCommandHandler("topclans",ToplistServerClans) client: addEvent("onServerTopClans", true) addEventHandler("onServerTopClans", getRootElement(), function(tableOrder) if (guiGridListClear) then local topList if tableOrder then for i=1,10 do if tableOrder[i] then local column = guiGridListAddColumn(clantopgrid, "Sıra", 0.15) local column1 = guiGridListAddColumn(clantopgrid, "Clanlist", 0.55) local column2 = guiGridListAddColumn(clantopgrid, "Puan", 0.30) local row = guiGridListAddRow(clantopgrid) guiGridListSetItemText(clantopgrid, row, column,i, false, false) guiGridListSetItemText(clantopgrid, row, column1,removeColorCoding(tableOrder[i].name), false, false) guiGridListSetItemText(clantopgrid, row, column2,tostring(tableOrder[i].data), false, false) local r, g, b local playerTeam = getPlayerTeam( source ) if ( playerTeam ) then r, g, b = getTeamColor ( playerTeam ) guiGridListSetItemColor ( clantopgrid, row, column1, r, g, b ) guiGridListSetItemColor ( clantopgrid, row, column2, r, g, b ) guiGridListSetItemColor ( clantopgrid, row, column, r, g, b ) end end end end end end) please open new tab this image Link to comment
Moderators IIYAMA Posted October 29, 2014 Moderators Share Posted October 29, 2014 Empty the grid list first. https://wiki.multitheftauto.com/wiki/GuiGridListClear Link to comment
freudo Posted October 29, 2014 Author Share Posted October 29, 2014 ı try but dont work and lost data Link to comment
Moderators IIYAMA Posted October 29, 2014 Moderators Share Posted October 29, 2014 Well check the variables(if the table has it's data etc.) and at which part it stops working. 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