Jump to content

[HELP]Top clans server send == Client


freudo

Recommended Posts

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) 

mta-screen_2014-10-29_11-42-50.png

please open new tab this image :)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...