Jump to content

x[ تصحيح كود ]x


Recommended Posts

السلام عليكم

عندي كود فيه مشكلة

addEventHandler( "onClientResourceStart",root,
function ()
triggerServerEvent("ReSend",localPlayer)
end
)

-- GUI Elements

addEvent("Add", true)
addEventHandler("Add", root,
function(one,Hours)
guiSetVisible(GUIEditor.gridlist[1], false) guiSetVisible(GUIEditor.gridlist[1], true)
guiGridListClear(GUIEditor.gridlist[1])
local item = guiGridListAddRow(GUIEditor.gridlist[1])
local itemName = guiGridListSetItemText(GUIEditor.gridlist[1], item, 1, one ..'- ' .. getPlayerName(Hours[one].name), false, false)
local itemName2 = 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
)

 

-- S
function getHours()
playersTable = {} ;
for i, v in ipairs(getElementsByType('player')) do 
local Acc = getPlayerAccount ( v )
if ( Acc ) and not isGuestAccount ( Acc ) then 
local playerData = getAccountData ( Acc, "Hours" ) or 0
local Hour, Min, Sec = unpack( split ( playerData, ":" ) )
table.insert(playersTable, {name = v, time = playerData})
end
end
table.sort (
        playersTable,
        function ( a, b )
            return ( tostring ( a.time ) or "" ) > ( tostring ( b.time ) or "" )
        end
    )
return playersTable
end

addEvent("ReSend", true)
addEventHandler("ReSend", root,
function()
setTimer ( Timer, 1000, 0 )
end
)


function Timer ()
local Hours = getHours()
for one = 1, #getElementsByType('player') do
if one >= 30 then return end
if (Hours[1]) then 
triggerClientEvent(root,"Add",root,one,Hours)
end
end
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...