Jump to content

مشكلة بمود اعلي تواجد


mody134

Recommended Posts

مثلا واحد ساعتة 40 يكون اعلي من الي معة 1000 ساعة

Quote

 


Client -- 

	

GUIEditor = {
    gridlist = {},
    window = {},
    button = {},
    label = {}
}
local screenW, screenH = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((screenW - 738) / 2, (screenH - 487) / 2, 738, 487, "- [ لوحة اعلي 40 تواجد ] -", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetAlpha(GUIEditor.window[1], 1.00)
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFCFE00")
guiSetVisible(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(264, 443, 207, 30, " اغلاق |#| Close ", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFCFE00")
GUIEditor.label[1] = guiCreateLabel(624, 443, 53, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 0, 253, 233)
guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
GUIEditor.label[2] = guiCreateLabel(481, 443, 143, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 59, 0, 252)
guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
GUIEditor.label[3] = guiCreateLabel(25, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[3], "default-bold-small")
guiLabelSetColor(GUIEditor.label[3], 250, 112, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
GUIEditor.gridlist[1] = guiCreateGridList(25, 36, 686, 397, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "#اسم اللاعب", 0.7)
guiGridListAddColumn(GUIEditor.gridlist[1], "#عدد الساعات", 0.3)
GUIEditor.label[4] = guiCreateLabel(142, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[4], "default-bold-small")
guiLabelSetColor(GUIEditor.label[4], 17, 249, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[4], "center")

function getHours()
playersTable = {} ;
for i, v in ipairs(getElementsByType('player')) do 
local playerData = getElementData(v, "PlayTime") or "0:0:0"
local Hour, Min, Sec = unpack( split ( playerData, ":" ) )
table.insert(playersTable, {name = v, time = playerData})
end
table.sort (
        playersTable,
        function ( a, b )
            return ( tostring ( a.time ) or "" ) > ( tostring ( b.time ) or "" )
        end
    )
return playersTable
end

setTimer(function()
--guiSetEnabled(GUIEditor.gridlist[1], false)
guiSetVisible(GUIEditor.gridlist[1], false) guiSetVisible(GUIEditor.gridlist[1], true)
guiGridListClear(GUIEditor.gridlist[1])
local Hours = getHours()
for one = 1, #getElementsByType('player') do
if one >= 40 then return end
local item = guiGridListAddRow(GUIEditor.gridlist[1])
if (Hours[1]) then 
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 1, one ..'- ' .. getPlayerName(Hours[one].name), false, false)
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 2, Hours[one].time, false, false)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 1, 255, 0, 0)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 2, 0, 255, 0)
end
end
end, 1000, 0)

addEventHandler( 'onClientGUIClick', root,
function()
if source == GUIEditor.button[1] then
guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end
)

function open()
if guiGetVisible(GUIEditor.window[1]) == false then
guiSetVisible(GUIEditor.window[1], true) showCursor(true)
else guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end

addCommandHandler('time',
function()
guiSetVisible(GUIEditor.window[1],true)
showCursor( true )
   end
)

client --


addCommandHandler('time',
function()
guiSetVisible(TopWindow,true)
showCursor( true )
   end
)

function centerWindow(center_window)
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end

_getPlayerName = getPlayerName
function getPlayerName(player)
	return string.gsub(_getPlayerName(player), "#%x%x%x%x%x%x", "" )
end

TopWindow = guiCreateWindow(30, 86, 600, 430, "= [ اعلى تواجد ] =", false)
guiSetVisible(TopWindow, false)
guiSetAlpha(TopWindow, 0.81)
centerWindow(TopWindow)
        CloseTop = guiCreateButton(221, 393, 153, 28, "=[ إغلاق النافذة ]=", false, TopWindow)
        guiSetProperty(CloseTop, "NormalTextColour", "FFFF0000")    

TimeList = guiCreateGridList(30, 40, 550, 335, false, TopWindow)
guiGridListSetSortingEnabled( TimeList, false )
guiGridListAddColumn(TimeList, "Rank", 0.1)
guiGridListAddColumn(TimeList, "Player Name", 0.5)
guiGridListAddColumn(TimeList, "PlayTime", 0.3)
guiSetProperty( TimeList, 'Disabled', 'True' )
guiSetAlpha( TimeList, 1 )
guiSetVisible(TimeList, true)



addEventHandler ("onClientGUIClick", root,
        function()
        if (source == CloseTop ) then
         guiSetVisible(TopWindow, false)
         showCursor(false)
         guiSetInputEnabled(false)
        end
    end
)

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 getPlayersSortByaTime( )
	local TopTimer = { }
	for _, aPlayer in next, getElementsByType 'player' do
		PlayTime = getElementData ( aPlayer, 'PlayTime' ) or "0:0:0"
		local h, m, s = unpack ( split ( PlayTime, ":" ) )	
        table.insert (
            TopTimer,
            {
                player = aPlayer,
                PlayTime = PlayTime,
                SortTime = ( tonumber ( h ) * 3600000 + tonumber ( m ) * 60000 + tonumber ( s ) * 1000 )
            }
        )
    end
    table.sort (
        TopTimer,
        function ( a, b )
            return ( tonumber ( a.SortTime ) or 0 ) > ( tonumber ( b.SortTime ) or 0 )
        end
    )
	return TopTimer
end

setTimer ( 
	function ( )
		guiGridListClear( TimeList )
		local g = getPlayersSortByaTime ( )
		for i = 1, 20 do
		local aRow = guiGridListAddRow( TimeList )
			if ( g [ i ] )then
				guiGridListSetItemText( TimeList, aRow, 1, i ..'-', false, false )
				guiGridListSetItemText( TimeList, aRow, 2, getPlayerName ( g [ i ].player ), false, false )
				guiGridListSetItemText( TimeList, aRow, 3, convertNumber( g [ i ].PlayTime ), false, false )
				guiGridListSetItemColor( TimeList, aRow, 2, getPlayerNametagColor( g [ i ].player ) )
				guiGridListSetItemColor( TimeList, aRow, 1, 255, 255, 0 )
				guiGridListSetItemColor( TimeList, aRow, 3, 0, 255, 0 )
			end
		end
	end
, 100, 0 )

function TopDriftW( )
	guiSetVisible ( TopWindow, not guiGetVisible(TopWindow) )
	showCursor ( guiGetVisible(TopWindow)  )
end
bindKey( '', 'down', TopDriftW )
       showCursor(false)

 


 

Quote
Quote

 

 

 

Edited by mody134
Link to comment
GUIEditor = {
    gridlist = {},
    window = {},
    button = {},
    label = {}
}
local screenW, screenH = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((screenW - 738) / 2, (screenH - 487) / 2, 738, 487, "- [ لوحة اعلي 40 تواجد ] -", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetAlpha(GUIEditor.window[1], 1.00)
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFCFE00")
guiSetVisible(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(264, 443, 207, 30, " اغلاق |#| Close ", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFCFE00")
GUIEditor.label[1] = guiCreateLabel(624, 443, 53, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 0, 253, 233)
guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
GUIEditor.label[2] = guiCreateLabel(481, 443, 143, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 59, 0, 252)
guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
GUIEditor.label[3] = guiCreateLabel(25, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[3], "default-bold-small")
guiLabelSetColor(GUIEditor.label[3], 250, 112, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
GUIEditor.gridlist[1] = guiCreateGridList(25, 36, 686, 397, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "#اسم اللاعب", 0.7)
guiGridListAddColumn(GUIEditor.gridlist[1], "#عدد الساعات", 0.3)
GUIEditor.label[4] = guiCreateLabel(142, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[4], "default-bold-small")
guiLabelSetColor(GUIEditor.label[4], 17, 249, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[4], "center")

function getHours()
playersTable = {} ;
for i, v in ipairs(getElementsByType('player')) do 
local playerData = getElementData(v, "PlayTime") or "0:0:0"
local Hour, Min, Sec = unpack( split ( playerData, ":" ) )
table.insert(playersTable, {name = v, time = playerData})
end
table.sort (
        playersTable,
        function ( a, b )
            return ( tostring ( a.time ) or "" ) > ( tostring ( b.time ) or "" )
        end
    )
return playersTable
end

setTimer(function()
--guiSetEnabled(GUIEditor.gridlist[1], false)
guiSetVisible(GUIEditor.gridlist[1], false) guiSetVisible(GUIEditor.gridlist[1], true)
guiGridListClear(GUIEditor.gridlist[1])
local Hours = getHours()
for one = 1, #getElementsByType('player') do
if one >= 40 then return end
local item = guiGridListAddRow(GUIEditor.gridlist[1])
if (Hours[1]) then 
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 1, one ..'- ' .. getPlayerName(Hours[one].name), false, false)
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 2, Hours[one].time, false, false)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 1, 255, 0, 0)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 2, 0, 255, 0)
end
end
end, 1000, 0)

addEventHandler( 'onClientGUIClick', root,
function()
if source == GUIEditor.button[1] then
guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end
)

function open()
if guiGetVisible(GUIEditor.window[1]) == false then
guiSetVisible(GUIEditor.window[1], true) showCursor(true)
else guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end

addCommandHandler('time',
function()
guiSetVisible(GUIEditor.window[1],true)
showCursor( true )
   end
)

 

Link to comment

جرب ذا

GUIEditor = {
    gridlist = {},
    window = {},
    button = {},
    label = {}
}
local screenW, screenH = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((screenW - 738) / 2, (screenH - 487) / 2, 738, 487, "- [ لوحة اعلي 40 تواجد ] -", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetAlpha(GUIEditor.window[1], 1.00)
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFCFE00")
guiSetVisible(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(264, 443, 207, 30, " اغلاق |#| Close ", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFCFE00")
GUIEditor.label[1] = guiCreateLabel(624, 443, 53, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 0, 253, 233)
guiLabelSetHorizontalAlign(GUIEditor.label[1], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
GUIEditor.label[2] = guiCreateLabel(481, 443, 143, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 59, 0, 252)
guiLabelSetHorizontalAlign(GUIEditor.label[2], "right", false)
guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
GUIEditor.label[3] = guiCreateLabel(25, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[3], "default-bold-small")
guiLabelSetColor(GUIEditor.label[3], 250, 112, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
GUIEditor.gridlist[1] = guiCreateGridList(25, 36, 686, 397, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "#اسم اللاعب", 0.7)
guiGridListAddColumn(GUIEditor.gridlist[1], "#عدد الساعات", 0.3)
GUIEditor.label[4] = guiCreateLabel(142, 443, 112, 30, "", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[4], "default-bold-small")
guiLabelSetColor(GUIEditor.label[4], 17, 249, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[4], "center")

function getHours()
playersTable = {} ;
for i, v in ipairs(getElementsByType('player')) do 
local playerData = getElementData(v, "PlayTime") or "0:0:0"
local Hour, Min, Sec = unpack( split ( playerData, ":" ) )
table.insert(playersTable, {name = v, time = playerData})
end
table.sort(playersTable,function( a, b ) return ( tonumber( a[2] ) or 0 ) > ( tonumber( b[2] ) or 0 ) end )
return playersTable
end

setTimer(function()
--guiSetEnabled(GUIEditor.gridlist[1], false)
guiSetVisible(GUIEditor.gridlist[1], false) guiSetVisible(GUIEditor.gridlist[1], true)
guiGridListClear(GUIEditor.gridlist[1])
local Hours = getHours()
for one = 1, #getElementsByType('player') do
if one >= 40 then return end
local item = guiGridListAddRow(GUIEditor.gridlist[1])
if (Hours[1]) then 
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 1, one ..'- ' .. getPlayerName(Hours[one].name), false, false)
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 2, Hours[one].time, false, false)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 1, 255, 0, 0)
guiGridListSetItemColor(GUIEditor.gridlist[1], item, 2, 0, 255, 0)
end
end
end, 1000, 0)

addEventHandler( 'onClientGUIClick', root,
function()
if source == GUIEditor.button[1] then
guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end
)

function open()
if guiGetVisible(GUIEditor.window[1]) == false then
guiSetVisible(GUIEditor.window[1], true) showCursor(true)
else guiSetVisible(GUIEditor.window[1], false) showCursor(false)
end
end

addCommandHandler('time',
function()
guiSetVisible(GUIEditor.window[1],true)
showCursor( true )
   end
)

 

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