Jump to content

Problem GridList


(s)ection

Recommended Posts

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 ) 
  

Link to comment
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 )    

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...