0 Üye ve 1 Ziyaretçi konuyu incelemekte.
----------------------- GENEL PANEL -----------------------sC,sD = guiGetScreenSize()C,D = 500,350A = (sC/2) - (C/2)B = (sD/2) - (D/2)panel = guiCreateWindow(A, B, C, D, "Sıralama Panel", false)guiWindowSetSizable(panel, false)guiWindowSetMovable(panel, false)guiSetVisible(panel, false)guiSetProperty(panel, "CaptionColour", "FF006600")Driftsirala = guiCreateButton(20, 315, 100, 25, "Drift", false, panel)guiSetFont(Driftsirala, "default-bold-small")guiSetProperty(Driftsirala, "NormalTextColour", "FFFFFFFF") zamansirala = guiCreateButton(380, 315, 100, 25, "Zaman", false, panel)guiSetFont(zamansirala, "default-bold-small") guiSetProperty(zamansirala, "NormalTextColour", "FFFFFFFF") -------------------- DRİFT KISMI --------------------DriftGrid = guiCreateGridList(5, 25, 490, 285, false, panel)local column = guiGridListAddColumn(DriftGrid, "Sıra", 0.20 ) local column1 = guiGridListAddColumn(DriftGrid, "Oyuncu Adı", 0.40 ) local column2 = guiGridListAddColumn(DriftGrid, "Drıft Skor", 0.30 )guiGridListSetSortingEnabled(DriftGrid, false)guiSetVisible(DriftGrid,false)for i = 1,18 dolocal row = guiGridListAddRow ( DriftGrid )guiGridListSetItemText ( DriftGrid, row, column, "" .. i .. "-", false, false )guiGridListSetItemText ( DriftGrid, row, column1, "N/A", false, false )guiGridListSetItemText ( DriftGrid, row, column2, "N/A", false, false )guiGridListSetItemColor(DriftGrid, row, column1, 255, 255, 255)guiGridListSetItemColor(DriftGrid, row, column2, 0, 102, 0)guiGridListSetItemColor(DriftGrid, row, column, 255, 255, 255)endaddEvent("SetData",true)addEventHandler("SetData",root,function ( Table ) guiGridListClear( Driftsirala ) for i,v in pairs(Table) do if ( v.skor ) then local row = guiGridListAddRow ( Driftsirala ) guiGridListSetItemText(DriftGrid, row, column, i , false, false ) guiGridListSetItemText(DriftGrid, row, column1, tostring(v.isim) , false, false ) guiGridListSetItemText(DriftGrid, row, column2, v.skor , false, false ) guiGridListSetItemColor(DriftGrid, row, column1, 28, 144, 225) guiGridListSetItemColor(DriftGrid, row, column2, 255, 255, 255) guiGridListSetItemColor(DriftGrid, row, column, 255, 255, 255) end endend)-------------------- ZAMAN KISMI --------------------zamansiralamagrid = guiCreateGridList(5, 25, 490, 285, false, panel)local column = guiGridListAddColumn(zamansiralamagrid, "Sıra", 0.20 ) local column1 = guiGridListAddColumn(zamansiralamagrid, "Oyuncu Adı", 0.40 ) local column2 = guiGridListAddColumn(zamansiralamagrid, "Zaman", 0.30 )guiGridListSetSortingEnabled(zamansiralamagrid, false)addEvent("SetData2",true)addEventHandler("SetData2",root,function ( Table ) guiGridListClear( zamansiralamagrid ) for i,v in pairs(Table) do if ( v.zaman ) then local row = guiGridListAddRow ( zamansiralamagrid ) guiGridListSetItemText( zamansiralamagrid, row, column, i , false, false ) guiGridListSetItemText( zamansiralamagrid, row, column1, tostring(v.isim) , false, false ) guiGridListSetItemText( zamansiralamagrid, row, column2, v.zaman , false, false ) guiGridListSetItemColor(zamansiralamagrid, row, column1, 255, 255, 255) guiGridListSetItemColor(zamansiralamagrid, row, column2, 0, 102, 0) guiGridListSetItemColor(zamansiralamagrid, row, column, 255, 255, 255) end endend)----------------------- GENEL FONKSİYON -----------------------addEventHandler ( "onClientGUIClick", resourceRoot,function() if source == kapatmabutonu then guiSetVisible(panel,false) elseif source == Driftsirala then if not durum1 then triggerServerEvent("getTop", localPlayer) durum1 = true setTimer(function() durum1 = false end,60000,1) end if guiGetVisible(zamansiralamagrid) then guiSetVisible(zamansiralamagrid,false) end guiSetVisible(DriftGrid,true) elseif source == zamansirala then if not durum3 then triggerServerEvent("getTop4", localPlayer) durum3 = true setTimer(function() durum3 = false end,60000,1) end if guiGetVisible(DriftGrid) then guiSetVisible(DriftGrid,false) end guiSetVisible(zamansiralamagrid,true) endend)addEventHandler ("onClientMouseLeave", root,function ()if source == DriftGrid thenelseif source == zamansirala thenendend)addEventHandler ("onClientMouseEnter", root,function()if source == DriftGrid thenelseif source == zamansirala thenendend)function sirlamaackapa()if guiGetVisible(panel) == false thenguiSetVisible(panel, true)guiSetInputEnabled(true)showCursor(true)triggerServerEvent("getTop4", localPlayer)elseguiSetInputEnabled(false)guiSetVisible(panel, false)showCursor(false)endendbindKey ("F7","down", sirlamaackapa)
------------------- DRİFT KISMI -------------------function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return falseendfunction createTopSystem( player ) if not isElement( player ) then return end local Top = {} local CreatTop = executeSQLQuery( "SELECT * FROM Drift_top_byS3Dd" ) for i = 1, #CreatTop do table.insert(Top,{name = CreatTop[i].Name,score = CreatTop[i].Score}) end if #CreatTop >0 then table.sort(Top, function(a,b) return (tonumber(a.score)or 0) > (tonumber(b.score)or 0) end) setTimer( function() for k, data in ipairs(Top) do if k == 1 then triggerClientEvent (player,"deltTop",player) end triggerClientEvent (player,"updateTop",player,tostring(data.name),tostring(data.score),tonumber(k)) if k == 30 then table.remove(Top) break end end end, 500, 1 ) endendfunction setAcontSqlData( player, top, name) if not isElement( player ) then return end if isGuestAccount ( getPlayerAccount ( player ) ) then return end result = executeSQLQuery("SELECT * FROM `Drift_top_byS3Dd` WHERE `Owner`=?", getAccountName(getPlayerAccount( player ))) if ( type ( result ) == "table" and #result == 0 ) or not result then executeSQLQuery( 'INSERT INTO Drift_top_byS3Dd( Owner, Score , Name) VALUES( ?, ?, ? )', getAccountName(getPlayerAccount( player )), top, name) else if tonumber ( top ) < tonumber( result[1]["Score"] ) then top = result[1]["Score"] else top = top end executeSQLQuery( 'UPDATE Drift_top_byS3Dd SET Score =?,Name =? WHERE Owner =?', top, name, getAccountName(getPlayerAccount( player ))) endendaddEvent("getTop", true)addEventHandler("getTop", root, function() createTopSystem( source ) end)------------- ZAMAN -------------function siraliZaman() local Zamanlar = {} local dbZaman = executeSQLQuery( "SELECT * FROM NormZaman ORDER BY saat DESC LIMIT 30" ) for i,v in pairs(dbZaman) do local isim = nil if getAccount(v.hesap_adi) then isim = getAccountData(getAccount(v.hesap_adi),"nickname") or v.hesap_adi end if isim then local zaman = v.zaman or 1 local saat = v.saat or 1 local dakika = v.dakika or 1 local toplam = (tonumber(v.saat)+tonumber(v.dakika/60)) or 0 table.insert(Zamanlar, {isim=isim,zaman=zaman,saat=saat,dakika=dakika,toplam=toplam}) isim = nil end end table.sort(Zamanlar, function(a,b) return (tonumber(a.toplam)or 0) > (tonumber(b.toplam)or 0) end) return ZamanlarendaddEvent("getTop4", true)addEventHandler("getTop4", root,function() triggerClientEvent(source, "SetData2", source, siraliZaman())end)