0 Üye ve 1 Ziyaretçi konuyu incelemekte.
local sw, sh = guiGetScreenSize()scoreboardColumns = { { name = "İsim", width = 200, data = function (element) return getPlayerName ( element ) end }, { name = "Öldürülen insanlar", width = 120, data = function (element) return ( getElementData ( element, "murders" ) or 0 ).. "/"..( getElementData ( element, "maxmurders" ) or 0 ) end }, { name = "Zombi Öldürme", width = 100, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ).. "/"..( getElementData ( element, "maxzombieskilled" ) or 0 ) end }, { name = "Yaşam Süresi", width = 90, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "Grup", width = 180, data = function (element) return getElementData ( element, "gang" ) or "none" end }, { name = "Ping", width = 40, data = function (element) return getPlayerPing ( element, "getPlayerPing" ) end }, { name = "Level", width = 100, data = function (element) return tostring((getElementData(element,"Level") or 1)) end }}local serverName = "MTA"local topsize = 80local playersize = 15local panelsize = 480function calculateWidth() local width = 0 for key, value in ipairs( scoreboardColumns ) do width = width + value.width end return width + 60end local max_players = 0local ploff = 0local width = calculateWidth()local baseX = sw/2-width/2local baseY = sh/2-(panelsize+topsize)/2 bindKey ( "tab", "up", function () ploff = 0 end ) addEventHandler( "onClientRender", root, function() if not getKeyState( "tab" ) then return end if getElementData(getLocalPlayer(),"logedin") then dxDrawRectangle ( baseX, baseY, width, topsize, tocolor(32,32,32) ) dxDrawText ( serverName, baseX+20, baseY+10, baseX+width, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold" ) dxDrawRectangle ( baseX, baseY+topsize, width, panelsize, tocolor(0,0,0,150) ) dxDrawLine ( baseX, baseY+30, baseX+width, baseY+30, tocolor(145,138,138),0.8 ) dxDrawLine ( baseX, baseY+30, baseX, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX, baseY+panelsize+topsize, baseX+width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX+40, baseY+30, baseX+40, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( "№", baseX, baseY+60, baseX+40, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) local xoff = 60 for i, v in ipairs ( scoreboardColumns ) do dxDrawLine ( baseX+xoff+v.width, baseY+30, baseX+xoff+v.width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( v.name, baseX+xoff, baseY+60, baseX+xoff+v.width, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) xoff = xoff+v.width end local playersTable = getElementsByType("player") local playerData = {} for i=1, #playersTable do local player = playersTable[i] local playerKills = getElementData(player, "alivetime" ) or 0 table.insert(playerData, {player, playerKills}) end table.sort(playerData, function(a, b) return (tonumber(a[2]) or 0) > (tonumber(b[2]) or 0) end) --playersTable = {} --for i = 1, 40 do -- table.insert ( playersTable, localPlayer ) --end --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } dxDrawText ( "Oyuncu Sayısı: "..tostring(#playerData).."/"..tostring(max_players), baseX+20, baseY+10, baseX+width-20, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold", "right" ) local maxNum = #playerData if maxNum > 30 then maxNum = 30 end local tempoff = 0 for i = 1, maxNum do if i == 4 or i == 11 then tempoff = tempoff+playersize end dxDrawLine ( baseX, baseY+topsize+playersize*i+tempoff, baseX+width, baseY+topsize+playersize*i+tempoff, tocolor(172,162,162),0.8 ) dxDrawText ( i+ploff, baseX, baseY+topsize+playersize*(i-1)+tempoff, baseX+40, baseY+topsize+playersize*i+tempoff, tocolor(255,255,255), 1, "default-bold", "center", "center" ) if playerData[i+ploff][1] == localPlayer then --if i == 10 then dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1)+tempoff, width, playersize, tocolor(112,112,112,100) ) end local xoff = 60 for c, d in ipairs ( scoreboardColumns ) do local data = d.data(playerData[i+ploff][1]) local r,g,b = 255,255,255 if d.name == "Grup" and data == "none" then r,g,b = 255,0,0 data = "Grubu Bulunmamaktadır" end dxDrawText ( data, baseX+xoff, baseY+topsize+playersize*(i-1)+tempoff, baseX+xoff+d.width, baseY+topsize+playersize*i+tempoff, tocolor(r,g,b), 1, "default-bold", "center", "center" ) xoff = xoff+d.width end end end end)function PlayerScrollMenu (key,keyState,arg) if getElementData(localPlayer,"logedin") and getKeyState( "tab" ) then if ( keyState == "down" ) then if arg == "up" then if ploff > 0 then ploff=ploff-1 end elseif arg == "down" then local playersTable = getElementsByType ( "player" ) --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } if ploff < #playersTable-30 then ploff = ploff+1 end end end endendbindKey ( "mouse_wheel_up", "down", PlayerScrollMenu, "up" )bindKey ( "mouse_wheel_down", "down", PlayerScrollMenu, "down" )function formatTimeFromMinutes(value) if value then local hours = math.floor(value/60) local minutes = math.round(((value/60) - math.floor(value/60))*100/(100/60)) if minutes < 10 then minutes = "0"..minutes end value = hours..":"..minutes return value end return trueendfunction math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) endendfunction sendMaxPlayersOnServer (players) max_players = playersendaddEvent("sendMaxPlayersOnServer",true)addEventHandler("sendMaxPlayersOnServer",getLocalPlayer(),sendMaxPlayersOnServer)
local sw, sh = guiGetScreenSize()scoreboardColumns = { { name = "İsim", width = 200, data = function (element) return getPlayerName ( element ) end }, { name = "Öldürülen insanlar", width = 120, data = function (element) return ( getElementData ( element, "murders" ) or 0 ).. "/"..( getElementData ( element, "maxmurders" ) or 0 ) end }, { name = "Zombi Öldürme", width = 100, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ).. "/"..( getElementData ( element, "maxzombieskilled" ) or 0 ) end }, { name = "Yaşam Süresi", width = 90, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "Grup", width = 180, data = function (element) return getElementData ( element, "gang" ) or "none" end }, { name = "Ping", width = 40, data = function (element) return getPlayerPing ( element, "getPlayerPing" ) end }, { name = "Level", width = 100, data = function (element) return tostring((getElementData(element,"Level") or 1)) end }}local serverName = "MTA"local topsize = 80local playersize = 15local panelsize = 480function calculateWidth() local width = 0 for key, value in ipairs( scoreboardColumns ) do width = width + value.width end return width + 60end local max_players = 0local ploff = 0local width = calculateWidth()local baseX = sw/2-width/2local baseY = sh/2-(panelsize+topsize)/2 function tabpanel() if not getKeyState( "tab" ) then return end if getElementData(getLocalPlayer(),"logedin") then dxDrawRectangle ( baseX, baseY, width, topsize, tocolor(32,32,32) ) dxDrawText ( serverName, baseX+20, baseY+10, baseX+width, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold" ) dxDrawRectangle ( baseX, baseY+topsize, width, panelsize, tocolor(0,0,0,150) ) dxDrawLine ( baseX, baseY+30, baseX+width, baseY+30, tocolor(145,138,138),0.8 ) dxDrawLine ( baseX, baseY+30, baseX, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX, baseY+panelsize+topsize, baseX+width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX+40, baseY+30, baseX+40, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( "№", baseX, baseY+60, baseX+40, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) local xoff = 60 for i, v in ipairs ( scoreboardColumns ) do dxDrawLine ( baseX+xoff+v.width, baseY+30, baseX+xoff+v.width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( v.name, baseX+xoff, baseY+60, baseX+xoff+v.width, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) xoff = xoff+v.width end local playersTable = getElementsByType("player") local playerData = {} for i=1, #playersTable do local player = playersTable[i] local playerKills = getElementData(player, "alivetime" ) or 0 table.insert(playerData, {player, playerKills}) end table.sort(playerData, function(a, b) return (tonumber(a[2]) or 0) > (tonumber(b[2]) or 0) end) --playersTable = {} --for i = 1, 40 do -- table.insert ( playersTable, localPlayer ) --end --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } dxDrawText ( "Oyuncu Sayısı: "..tostring(#playerData).."/"..tostring(max_players), baseX+20, baseY+10, baseX+width-20, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold", "right" ) local maxNum = #playerData if maxNum > 30 then maxNum = 30 end local tempoff = 0 for i = 1, maxNum do if i == 4 or i == 11 then tempoff = tempoff+playersize end dxDrawLine ( baseX, baseY+topsize+playersize*i+tempoff, baseX+width, baseY+topsize+playersize*i+tempoff, tocolor(172,162,162),0.8 ) dxDrawText ( i+ploff, baseX, baseY+topsize+playersize*(i-1)+tempoff, baseX+40, baseY+topsize+playersize*i+tempoff, tocolor(255,255,255), 1, "default-bold", "center", "center" ) if playerData[i+ploff][1] == localPlayer then --if i == 10 then dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1)+tempoff, width, playersize, tocolor(112,112,112,100) ) end local xoff = 60 for c, d in ipairs ( scoreboardColumns ) do local data = d.data(playerData[i+ploff][1]) local r,g,b = 255,255,255 if d.name == "Grup" and data == "none" then r,g,b = 255,0,0 data = "Grubu Bulunmamaktadır" end dxDrawText ( data, baseX+xoff, baseY+topsize+playersize*(i-1)+tempoff, baseX+xoff+d.width, baseY+topsize+playersize*i+tempoff, tocolor(r,g,b), 1, "default-bold", "center", "center" ) xoff = xoff+d.width end end end endfunction PlayerScrollMenu (key,keyState,arg) if getElementData(localPlayer,"logedin") and getKeyState( "tab" ) then if ( keyState == "down" ) then if arg == "up" then if ploff > 0 then ploff=ploff-1 end elseif arg == "down" then local playersTable = getElementsByType ( "player" ) --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } if ploff < #playersTable-30 then ploff = ploff+1 end end end endendbindKey ( "mouse_wheel_up", "down", PlayerScrollMenu, "up" )bindKey ( "mouse_wheel_down", "down", PlayerScrollMenu, "down" )function formatTimeFromMinutes(value) if value then local hours = math.floor(value/60) local minutes = math.round(((value/60) - math.floor(value/60))*100/(100/60)) if minutes < 10 then minutes = "0"..minutes end value = hours..":"..minutes return value end return trueendfunction math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) endendfunction sendMaxPlayersOnServer (players) max_players = playersendaddEvent("sendMaxPlayersOnServer",true)addEventHandler("sendMaxPlayersOnServer",getLocalPlayer(),sendMaxPlayersOnServer)bindKey("tab","down",function() showChat(false) ploff = 1 addEventHandler( "onClientRender", root,tabpanel)end)bindKey("tab","up",function() showChat(true) ploff = 0 removeEventHandler( "onClientRender", root,tabpanel)end)
Kod
Kodlocal sw, sh = guiGetScreenSize()scoreboardColumns = { { name = "İsim", width = 200, data = function (element) return getPlayerName ( element ) end }, { name = "Öldürülen insanlar", width = 120, data = function (element) return ( getElementData ( element, "murders" ) or 0 ).. "/"..( getElementData ( element, "maxmurders" ) or 0 ) end }, { name = "Zombi Öldürme", width = 100, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ).. "/"..( getElementData ( element, "maxzombieskilled" ) or 0 ) end }, { name = "Yaşam Süresi", width = 90, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "Grup", width = 180, data = function (element) return getElementData ( element, "gang" ) or "none" end }, { name = "Ping", width = 40, data = function (element) return getPlayerPing ( element, "getPlayerPing" ) end }, { name = "Level", width = 100, data = function (element) return tostring((getElementData(element,"Level") or 1)) end }}local serverName = "MTA"local topsize = 80local playersize = 15local panelsize = 480function calculateWidth() local width = 0 for key, value in ipairs( scoreboardColumns ) do width = width + value.width end return width + 60end local max_players = 0local ploff = 0local width = calculateWidth()local baseX = sw/2-width/2local baseY = sh/2-(panelsize+topsize)/2 function tabpanel() if not getKeyState( "tab" ) then return end if getElementData(getLocalPlayer(),"logedin") then dxDrawRectangle ( baseX, baseY, width, topsize, tocolor(32,32,32) ) dxDrawText ( serverName, baseX+20, baseY+10, baseX+width, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold" ) dxDrawRectangle ( baseX, baseY+topsize, width, panelsize, tocolor(0,0,0,150) ) dxDrawLine ( baseX, baseY+30, baseX+width, baseY+30, tocolor(145,138,138),0.8 ) dxDrawLine ( baseX, baseY+30, baseX, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX, baseY+panelsize+topsize, baseX+width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawLine ( baseX+40, baseY+30, baseX+40, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( "№", baseX, baseY+60, baseX+40, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) local xoff = 60 for i, v in ipairs ( scoreboardColumns ) do dxDrawLine ( baseX+xoff+v.width, baseY+30, baseX+xoff+v.width, baseY+panelsize+topsize, tocolor(172,162,162),0.8 ) dxDrawText ( v.name, baseX+xoff, baseY+60, baseX+xoff+v.width, baseY+topsize-30, tocolor(255,255,255), 1, "default-bold", "center", "center" ) xoff = xoff+v.width end local playersTable = getElementsByType("player") local playerData = {} for i=1, #playersTable do local player = playersTable[i] local playerKills = getElementData(player, "alivetime" ) or 0 table.insert(playerData, {player, playerKills}) end table.sort(playerData, function(a, b) return (tonumber(a[2]) or 0) > (tonumber(b[2]) or 0) end) --playersTable = {} --for i = 1, 40 do -- table.insert ( playersTable, localPlayer ) --end --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } dxDrawText ( "Oyuncu Sayısı: "..tostring(#playerData).."/"..tostring(max_players), baseX+20, baseY+10, baseX+width-20, baseY+topsize, tocolor(255,255,255), 0.9, "default-bold", "right" ) local maxNum = #playerData if maxNum > 30 then maxNum = 30 end local tempoff = 0 for i = 1, maxNum do if i == 4 or i == 11 then tempoff = tempoff+playersize end dxDrawLine ( baseX, baseY+topsize+playersize*i+tempoff, baseX+width, baseY+topsize+playersize*i+tempoff, tocolor(172,162,162),0.8 ) dxDrawText ( i+ploff, baseX, baseY+topsize+playersize*(i-1)+tempoff, baseX+40, baseY+topsize+playersize*i+tempoff, tocolor(255,255,255), 1, "default-bold", "center", "center" ) if playerData[i+ploff][1] == localPlayer then --if i == 10 then dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1)+tempoff, width, playersize, tocolor(112,112,112,100) ) end local xoff = 60 for c, d in ipairs ( scoreboardColumns ) do local data = d.data(playerData[i+ploff][1]) local r,g,b = 255,255,255 if d.name == "Grup" and data == "none" then r,g,b = 255,0,0 data = "Grubu Bulunmamaktadır" end dxDrawText ( data, baseX+xoff, baseY+topsize+playersize*(i-1)+tempoff, baseX+xoff+d.width, baseY+topsize+playersize*i+tempoff, tocolor(r,g,b), 1, "default-bold", "center", "center" ) xoff = xoff+d.width end end end endfunction PlayerScrollMenu (key,keyState,arg) if getElementData(localPlayer,"logedin") and getKeyState( "tab" ) then if ( keyState == "down" ) then if arg == "up" then if ploff > 0 then ploff=ploff-1 end elseif arg == "down" then local playersTable = getElementsByType ( "player" ) --local playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } if ploff < #playersTable-30 then ploff = ploff+1 end end end endendbindKey ( "mouse_wheel_up", "down", PlayerScrollMenu, "up" )bindKey ( "mouse_wheel_down", "down", PlayerScrollMenu, "down" )function formatTimeFromMinutes(value) if value then local hours = math.floor(value/60) local minutes = math.round(((value/60) - math.floor(value/60))*100/(100/60)) if minutes < 10 then minutes = "0"..minutes end value = hours..":"..minutes return value end return trueendfunction math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) endendfunction sendMaxPlayersOnServer (players) max_players = playersendaddEvent("sendMaxPlayersOnServer",true)addEventHandler("sendMaxPlayersOnServer",getLocalPlayer(),sendMaxPlayersOnServer)bindKey("tab","down",function() showChat(false) ploff = 1 addEventHandler( "onClientRender", root,tabpanel)end)bindKey("tab","up",function() showChat(true) ploff = 0 removeEventHandler( "onClientRender", root,tabpanel)end)