Wysłany: 2019-07-14, 18:02
Pyrek24
Wiek: 25 Na forum: 3438 dni Posty: 546
Nick w MP: Pyrek
Piwa : 10
Witam ot?? mam kod na scorboarda. Chcia?bym by id sortowa?o si? pokolei 1,2,3,4,5,6,7,8,9,10... itd.
kod
--[[
Autor : Asperek
Zakaz u ? ywania bez zgody autora !
Zakaz udost ? pniania bez zgody autora !
]]
--[[
Wszelkie prawa odkupione przez STOPseba !
]]--
local screenW , screenH = guiGetScreenSize ()
local dxfont0_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 30 )
local dxfont1_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 16 )
local dxfont2_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 14 )
local dxfont3_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 11 )
local px , sy = guiGetScreenSize ()
local px , py = ( screenW / 1920 ),( screenH / 1080 )
local zoom = 1
local fh = 1920
if px < fh then
zoom = math . min ( 2 , fh / px )
end
-- tego nie ruszaj
local k = 1
local n = 19
local score = false
local font = dxCreateFont ( "font.ttf" , 13 ) or "default-bold"
local ping = {}
local logo = false -- wylaczanie / wlaczanie loga w scoreboardzie
function dxDrawShadowText ( text , x , y , w , h , color , size , font , x1 , x2 )
end
addEventHandler ( "onClientRender" , root , function()
score = getKeyState ( "tab" )
local gracze = getElementsByType ( "player" )
if score ~= true then return end
-- werjsa z logiem
if logo == true then
dxDrawRectangle ( screenW * 0.3068 , screenH * 0.0370 , screenW * 0.3943 , screenH * 0.8583 , tocolor ( 91 , 91 , 92 , 100 ), false )
-- dxDrawImage ( screenW * 0.3729 , screenH * 0.2194 , screenW * 0.2562 , screenH * 0.09 , "logo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else -- wersja bez loga
dxDrawRectangle ( screenW * 0.3068 , screenH * 0.0370 , screenW * 0.3943 , screenH * 0.8583 , tocolor ( 0 , 0 , 0 , 200 ), false )
end
local x = 0
for i , v in ipairs ( gracze ) do
if i >= k and i <= n then
x = x + 1
if not ping [ v ] then
ping [ v ] = {}
ping [ v ][ "ms" ] = getPlayerPing ( v )
ping [ v ][ "time" ] = getTickCount ()
elseif getTickCount ()- ping [ v ][ "time" ] > 1500 then
ping [ v ][ "ms" ] = getPlayerPing ( v )
ping [ v ][ "time" ] = getTickCount ()
end
local id = getElementData ( v , "id" )
local uid = getElementData ( v , "player:uid" )
local org = getElementData ( v , "player:organization" )
local frakcja = getElementData ( v , "player:duty" )
local offsetY = ( screenH * 0.03600 )*( x - 1 )
local isPremium = getElementData ( v , "player:premium" )
dxDrawLine (( screenW * 0.3068 ) - 1 , ( screenH * 0.0370 ) - 1 , ( screenW * 0.3068 ) - 1 , screenH * 0.8954 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine ( screenW * 0.7010 , ( screenH * 0.0370 ) - 1 , ( screenW * 0.3068 ) - 1 , ( screenH * 0.0370 ) - 1 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine (( screenW * 0.3068 ) - 1 , screenH * 0.8954 , screenW * 0.7010 , screenH * 0.8954 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine ( screenW * 0.7010 , screenH * 0.8954 , screenW * 0.7010 , ( screenH * 0.0370 ) - 1 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) - 1 , ( screenH * 0.0343 ) - 1 , ( screenW * 0.5349 ) - 1 , ( screenH * 0.1370 ) - 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) + 1 , ( screenH * 0.0343 ) - 1 , ( screenW * 0.5349 ) + 1 , ( screenH * 0.1370 ) - 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) - 1 , ( screenH * 0.0343 ) + 1 , ( screenW * 0.5349 ) - 1 , ( screenH * 0.1370 ) + 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) + 1 , ( screenH * 0.0343 ) + 1 , ( screenW * 0.5349 ) + 1 , ( screenH * 0.1370 ) + 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , screenW * 0.3052 , screenH * 0.0343 , screenW * 0.5349 , screenH * 0.1370 , tocolor ( 1 , 1 , 0 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Graczy online:\n" .. tostring ( #gracze).."/295 !", screenW * 0.5359, screenH * 0.0389, screenW * 0.7010, screenH * 0.1370, tocolor(255, 255, 255, 255), 1.00*px, dxfont1_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
dxDrawText ( "RID" , screenW * 0.3073 , screenH * 0.1398 , screenW * 0.3276 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "ID" , screenW * 0.3297 , screenH * 0.1398 , screenW * 0.3500 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Nick" , screenW * 0.3500 , screenH * 0.1398 , screenW * 0.4484 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "S?u?ba" , screenW * 0.4484 , screenH * 0.1398 , screenW * 0.5078 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Organizacja" , screenW * 0.5078 , screenH * 0.1398 , screenW * 0.6083 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Gang" , screenW * 0.6083 , screenH * 0.1398 , screenW * 0.6500 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "PING" , screenW * 0.6500 , screenH * 0.1398 , screenW * 0.7010 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:uid" ) or "---" , screenW * 0.3073 , screenH * 0.1630 + offsetY , screenW * 0.3276 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "id" ) or "---" , screenW * 0.3297 , screenH * 0.1630 + offsetY , screenW * 0.3500 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getPlayerName ( v ), screenW * 0.3500 , screenH * 0.1630 + offsetY , screenW * 0.4484 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , true , true )
dxDrawText ( getElementData ( v , "player:duty" ) or "---" , screenW * 0.4484 , screenH * 0.1630 + offsetY , screenW * 0.5078 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:organization" ) or "---" , screenW * 0.5078 , screenH * 0.1630 + offsetY , screenW * 0.6083 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:gang" ) or "---" , screenW * 0.6083 , screenH * 0.1630 + offsetY , screenW * 0.6500 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getPlayerPing ( v ), screenW * 0.6500 , screenH * 0.1630 + offsetY , screenW * 0.7010 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
end
end
end )
bindKey ( "mouse_wheel_down" , "both" , function()
if score ~= true then return end
scrollUp ()
end )
bindKey ( "mouse_wheel_up" , "both" , function()
if score ~= true then return end
scrollDown ()
end )
function openScoreboard ()
if score == true then
score = false
else
score = true
end
end
function scrollDown ()
if n == 19 then return end
k = k - 1
n = n - 1
end
function scrollUp ()
if n > #getElementsByType("player") then return end
k = k + 1
n = n + 1
end
function roundedRectangle ( x , y , w , h , color )
end
Wysłany: 2019-07-16, 09:21
Hemoglobina
Tylko Hema
Wiek: 29 Na forum: 3397 dni Posty: 89
Nick w MP: Answer
Piwa : 1386
table . sort ( gracze , function( a , b ) return a > b end )
Musisz to zmodyfikowa? tak, ?eby sortowa?o po ID.
Więcej szczegółów
Wystawiono 1 piw(a):Pyrek24
Wysłany: 2019-07-16, 16:14
DylemaT929
Nikt
Wiek: 28 Na forum: 4041 dni Posty: 333
Nick w MP: dylemat929
Piwa : 3195
Masz podmie? .
--[[
Autor : Asperek
Zakaz u ? ywania bez zgody autora !
Zakaz udost ? pniania bez zgody autora !
]]
--[[
Wszelkie prawa odkupione przez STOPseba !
]]--
local screenW , screenH = guiGetScreenSize ()
local dxfont0_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 30 )
local dxfont1_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 16 )
local dxfont2_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 14 )
local dxfont3_CaviarDreams_Bold = dxCreateFont ( ":guied/fonts/CaviarDreams_Bold.ttf" , 11 )
local px , sy = guiGetScreenSize ()
local px , py = ( screenW / 1920 ),( screenH / 1080 )
local zoom = 1
local fh = 1920
if px < fh then
zoom = math . min ( 2 , fh / px )
end
-- tego nie ruszaj
local k = 1
local n = 19
local score = false
local font = dxCreateFont ( "font.ttf" , 13 ) or "default-bold"
local ping = {}
local logo = false -- wylaczanie / wlaczanie loga w scoreboardzie
function dxDrawShadowText ( text , x , y , w , h , color , size , font , x1 , x2 )
end
function sort ( parametr1 , parametr2 )
if isElement ( parametr1 ) and isElement ( parametr2 ) then
return ( getElementData ( parametr1 , "id" ) or 0 ) < ( getElementData ( parametr2 , "id" ) or 0 )
end
end
addEventHandler ( "onClientRender" , root , function()
score = getKeyState ( "tab" )
local gracze = getElementsByType ( "player" )
table . sort ( gracze , sort )
if score ~= true then return end
-- werjsa z logiem
if logo == true then
dxDrawRectangle ( screenW * 0.3068 , screenH * 0.0370 , screenW * 0.3943 , screenH * 0.8583 , tocolor ( 91 , 91 , 92 , 100 ), false )
-- dxDrawImage ( screenW * 0.3729 , screenH * 0.2194 , screenW * 0.2562 , screenH * 0.09 , "logo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else -- wersja bez loga
dxDrawRectangle ( screenW * 0.3068 , screenH * 0.0370 , screenW * 0.3943 , screenH * 0.8583 , tocolor ( 0 , 0 , 0 , 200 ), false )
end
local x = 0
for i , v in ipairs ( gracze ) do
if i >= k and i <= n then
x = x + 1
if not ping [ v ] then
ping [ v ] = {}
ping [ v ][ "ms" ] = getPlayerPing ( v )
ping [ v ][ "time" ] = getTickCount ()
elseif getTickCount ()- ping [ v ][ "time" ] > 1500 then
ping [ v ][ "ms" ] = getPlayerPing ( v )
ping [ v ][ "time" ] = getTickCount ()
end
local id = getElementData ( v , "id" )
local uid = getElementData ( v , "player:uid" )
local org = getElementData ( v , "player:organization" )
local frakcja = getElementData ( v , "player:duty" )
local offsetY = ( screenH * 0.03600 )*( x - 1 )
local isPremium = getElementData ( v , "player:premium" )
dxDrawLine (( screenW * 0.3068 ) - 1 , ( screenH * 0.0370 ) - 1 , ( screenW * 0.3068 ) - 1 , screenH * 0.8954 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine ( screenW * 0.7010 , ( screenH * 0.0370 ) - 1 , ( screenW * 0.3068 ) - 1 , ( screenH * 0.0370 ) - 1 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine (( screenW * 0.3068 ) - 1 , screenH * 0.8954 , screenW * 0.7010 , screenH * 0.8954 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawLine ( screenW * 0.7010 , screenH * 0.8954 , screenW * 0.7010 , ( screenH * 0.0370 ) - 1 , tocolor ( 255 , 200 , 0 , 255 ), 1 , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) - 1 , ( screenH * 0.0343 ) - 1 , ( screenW * 0.5349 ) - 1 , ( screenH * 0.1370 ) - 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) + 1 , ( screenH * 0.0343 ) - 1 , ( screenW * 0.5349 ) + 1 , ( screenH * 0.1370 ) - 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) - 1 , ( screenH * 0.0343 ) + 1 , ( screenW * 0.5349 ) - 1 , ( screenH * 0.1370 ) + 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , ( screenW * 0.3052 ) + 1 , ( screenH * 0.0343 ) + 1 , ( screenW * 0.5349 ) + 1 , ( screenH * 0.1370 ) + 1 , tocolor ( 255 , 216 , 75 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "MoveRPG" , screenW * 0.3052 , screenH * 0.0343 , screenW * 0.5349 , screenH * 0.1370 , tocolor ( 1 , 1 , 0 , 254 ), 1.00 * px , dxfont0_CaviarDreams_Bold , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Graczy online:\n" .. tostring ( #gracze).."/295 !", screenW * 0.5359, screenH * 0.0389, screenW * 0.7010, screenH * 0.1370, tocolor(255, 255, 255, 255), 1.00*px, dxfont1_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
dxDrawText ( "RID" , screenW * 0.3073 , screenH * 0.1398 , screenW * 0.3276 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "ID" , screenW * 0.3297 , screenH * 0.1398 , screenW * 0.3500 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Nick" , screenW * 0.3500 , screenH * 0.1398 , screenW * 0.4484 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "S?u?ba" , screenW * 0.4484 , screenH * 0.1398 , screenW * 0.5078 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Organizacja" , screenW * 0.5078 , screenH * 0.1398 , screenW * 0.6083 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "Gang" , screenW * 0.6083 , screenH * 0.1398 , screenW * 0.6500 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( "PING" , screenW * 0.6500 , screenH * 0.1398 , screenW * 0.7010 , screenH * 0.8954 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont2_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:uid" ) or "---" , screenW * 0.3073 , screenH * 0.1630 + offsetY , screenW * 0.3276 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "id" ) or "---" , screenW * 0.3297 , screenH * 0.1630 + offsetY , screenW * 0.3500 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getPlayerName ( v ), screenW * 0.3500 , screenH * 0.1630 + offsetY , screenW * 0.4484 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , true , true )
dxDrawText ( getElementData ( v , "player:duty" ) or "---" , screenW * 0.4484 , screenH * 0.1630 + offsetY , screenW * 0.5078 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:organization" ) or "---" , screenW * 0.5078 , screenH * 0.1630 + offsetY , screenW * 0.6083 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getElementData ( v , "player:gang" ) or "---" , screenW * 0.6083 , screenH * 0.1630 + offsetY , screenW * 0.6500 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
dxDrawText ( getPlayerPing ( v ), screenW * 0.6500 , screenH * 0.1630 + offsetY , screenW * 0.7010 , screenH * 0.8954 + offsetY , tocolor ( 255 , 255 , 255 , 255 ), 1.00 * px , dxfont3_CaviarDreams_Bold , "center" , "top" , false , false , false , false , false )
end
end
end )
bindKey ( "mouse_wheel_down" , "both" , function()
if score ~= true then return end
scrollUp ()
end )
bindKey ( "mouse_wheel_up" , "both" , function()
if score ~= true then return end
scrollDown ()
end )
function openScoreboard ()
if score == true then
score = false
else
score = true
end
end
function scrollDown ()
if n == 19 then return end
k = k - 1
n = n - 1
end
function scrollUp ()
if n > #getElementsByType("player") then return end
k = k + 1
n = n + 1
end
function roundedRectangle ( x , y , w , h , color )
end
zresetuj i zobacz
Więcej szczegółów
Wystawiono 1 piw(a):Pyrek24
Tagi: sortowanie :: tabie
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: