SycroX Posted February 1, 2016 Share Posted February 1, 2016 function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end function getPlayersSortByaScore( ) local TopScore = { } for _, aPlayer in next, getElementsByType 'player' do aTime = getElementData ( aPlayer, 'PlayTime' ) or 0 player = aPlayer table.insert (TopScore, {player, aTime}) end table.sort( TopScore, function( a, b ) return( tonumber( a.aTime ) or 0 ) > ( tonumber( b.aTime ) or 0 ) end ) return TopScore end function TopTime ( ) guiGridListClear( GUIEditor.gridlist[1] ) local g = getPlayersSortByaScore ( ) for i = 1, 30 do local aRow = guiGridListAddRow( GUIEditor.gridlist[1] ) if ( g [ i ] )then guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 1, ""..i.."-", false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 2, getPlayerName ( g [ i ].player ), false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 3, convertNumber( g [ i ].aTime ), false, false ) if TopColors[i] then guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 1, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 2, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 3, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) end end end end addEventHandler ( "onClientGUIChanged", GUIEditor.edit[1], function() guiGridListClear(GUIEditor.gridlist[1]) local name = guiGetText(GUIEditor.edit[1]) if name ~= "" then for id, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):gsub("#%x%x%x%x%x%x",""):lower(), name:lower()) then local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) local r, g, b = math.random(100, 255), math.random(100, 255), math.random(100, 255) guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, ""..id.."-", false, false ) guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, getPlayerName(player):gsub("#%x%x%x%x%x%x",""), false, false ) guiGridListSetItemText (GUIEditor.gridlist[1], row, 3, getElementData(player,"PlayTime"), false, false ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 1, r, g, b ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 2, r, g, b ) guiGridListSetItemColor ( GUIEditor.gridlist[1], row, 3, r, g, b ) end end else guiGridListClear(GUIEditor.gridlist[1]) TopTime() end end ) المشكلة هي انو ما يرتب الأسامي وش الحلل Link to comment
TAPL Posted February 1, 2016 Share Posted February 1, 2016 سطر 21 return( tonumber( a[2] ) or 0 ) > ( tonumber( b[2] ) or 0 ) Link to comment
TAPL Posted February 1, 2016 Share Posted February 1, 2016 اصلا يجي شي في القريد لست من اساس؟ شوف سطر 34 و 35 index عندك غلط من اساس ما رح يحط شي بالقريد لست فكيف انت تقول ما يرتب! Link to comment
SycroX Posted February 1, 2016 Author Share Posted February 1, 2016 يب يجي ولله function TopTime ( ) guiGridListClear( GUIEditor.gridlist[1] ) local g = getPlayersSortByaScore ( ) for i = 1, 30 do local aRow = guiGridListAddRow( GUIEditor.gridlist[1] ) if ( g [i] )then guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 1, ""..i.."-", false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 2, getPlayerName ( g [i]player ), false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 3, convertNumber( g [i]aTime ), false, false ) if TopColors[i] then guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 1, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 2, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) guiGridListSetItemColor (GUIEditor.gridlist[1], aRow, 3, TopColors[i][1], TopColors[i][2], TopColors[i][3] ) end end end end Link to comment
SycroX Posted February 1, 2016 Author Share Posted February 1, 2016 ما في مساعدة شباب ؟؟؟ Link to comment
TAPL Posted February 1, 2016 Share Posted February 1, 2016 guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 2, getPlayerName ( g [i]player ), false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 3, convertNumber( g [i]aTime ), false, false ) استبدل بـ: guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 2, getPlayerName ( g [i][1]), false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], aRow, 3, convertNumber( g [i][2]), false, false ) 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