(s)ection Posted August 31, 2014 Posted August 31, 2014 hi, i have top player money and kills but when i put the table in the gridlist its do something like it: ( its not on the same line) thx.
Et-win Posted August 31, 2014 Posted August 31, 2014 Probably you entered another column ID (or with a loop a miscalculating).
(s)ection Posted September 1, 2014 Author Posted September 1, 2014 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 )
./BlackBird# Posted September 1, 2014 Posted September 1, 2014 top10window = guiCreateWindow( 0.20, 0.20, 0.61, 0.58, "money kills players", true ) guiSetVisible(top10window, false ) 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 ) --CLIENT function top(data) for i,theKey in pairs(data) do local row = guiGridListAddRow(top10gridlist) guiGridListSetItemText(top10gridlist, row, top10column1, theKey[i][1], false, false ) guiGridListSetItemText(top10gridlist, row, top10column2, theKey[i][2], false, false ) guiGridListSetItemText(top10gridlist, row, top10column3, theKey[i][3], false, false ) end guiSetVisible(top10window, true ) addEventHandler( 'onClientGUIClick', top10button, closeBtnTop10, false ) end addEvent( "top", true ) addEventHandler( "top", root, top ) --SERVER function top(thePlayer, commandName) local accountTable = getAccounts( ) local data = { } for i,account in pairs(accountTable) do accountname = getAccountName(account) money = getAccountData(account,"money") or 0 kills = getAccountData(account,"kills") or 0 table.insert(data, {accountname,money,kills}) end triggerClientEvent ( thePlayer, "top", data ) end addCommandHandler( 'top', top )
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