oK mjnonfik
--SERVER
topnames = {}
topmoney = {}
topkills = {}
function top(thePlayer, commandName)
local accountTable = getAccounts( )
for i,account in pairs(accountTable) do
accountname = getAccountName(account)
money = getAccountData(account,"money") or 0
kills = getAccountData(account,"kills") or 0
table.insert (topnames,accountname)
table.insert (topmoney,money)
table.insert (topkills,kills)
end
triggerClientEvent ( thePlayer, "top", thePlayer, topnames, topmoney, topkills )
end
addCommandHandler( 'top', top )
--CLIENT
function top(topnames,topkills,topmoney)
top10window = guiCreateWindow( 0.20, 0.20, 0.61, 0.58, "money kills players", true )
guiWindowSetSizable( top10window, false )
guiSetProperty( top10window, "CaptionColour", "FF737373" )
guiSetAlpha( top10window, 0.65 )
top10gridlist = guiCreateGridList( 0.015, 0.06, 0.97, 0.82, true, top10window )
top10button = guiCreateButton( 0.015, 0.90, 0.97, 0.08, "Close", true, top10window )
guiSetFont( top10button, "default-bold-small" )
guiSetFont( top10gridlist, "default-bold-small" )
top10column1 = guiGridListAddColumn( top10gridlist, "Player", 0.4 )
top10column2 = guiGridListAddColumn( top10gridlist, "Kills", 0.15 )
top10column3 = guiGridListAddColumn( top10gridlist, "Money", 0.15 )
for i,theKey in pairs(topnames) do
local row = guiGridListAddRow(top10gridlist)
guiGridListSetItemText(top10gridlist, row, top10column1, theKey, false, false )
end
for i,theKey in pairs(topkills) do
local row = guiGridListAddRow(top10gridlist)
guiGridListSetItemText(top10gridlist, row, top10column2, theKey, false, false )
end
for i,theKey in pairs(topmoney) do
local row = guiGridListAddRow(top10gridlist)
guiGridListSetItemText(top10gridlist, row, top10column3, theKey, false, false )
end
guiSetVisible(top10window, true )
addEventHandler( 'onClientGUIClick', top10button, closeBtnTop10, false )
end
addEvent( "top", true )
addEventHandler( "top", localPlayer, top )