Advertisement
Guest User

Liste-DxKlasse by Strobe

a guest
Mar 1st, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.74 KB | None | 0 0
  1. function dxDrawBoxText( text , x, y , w , h , ... )
  2.     dxDrawText( text , x , y , x + w , y + h , ... )
  3. end
  4.  
  5. function dxDrawShadowText( text , x, y , w , h , shadowOffSetX , shadowOffSetY , tCol , sCol , ... )
  6.     dxDrawText( text , x + shadowOffSetX , y + shadowOffSetY , x + w , y + h , sCol, ... )
  7.     dxDrawText( text , x - shadowOffSetX , y - shadowOffSetY  , x + w , y + h , sCol, ... )
  8.     dxDrawText( text , x , y , x + w , y + h , tCol , ... )
  9. end
  10.  
  11. function dxDrawBoxShape( x, y, w, h , ...)
  12.     dxDrawLine( x, y, x+w,y,...)
  13.     dxDrawLine( x, y+h , x +w , y+h,...)
  14.    
  15.     dxDrawLine( x , y ,x , y+h , ... )
  16.     dxDrawLine( x+w , y ,x+w , y+h , ...)
  17. end
  18.  
  19.  
  20.  
  21. --############################
  22. --##    Widget-ScrollBox    ##
  23. --##        main_c.lua      ##
  24. --##    @author: Str0^      ##
  25. --##    @date: 01.03.2015   ##
  26. --############################
  27.  
  28.  
  29. local w,h = guiGetScreenSize()
  30. local centerX , centerY = w*0.5 , h*0.6
  31. local width , height = w*0.4, w*0.3
  32. local logo_width = w*0.3
  33. local logo_height = w*0.3
  34. local font = dxCreateFont( "font.ttf", 12)
  35. triggerServerEvent("getServerInfos",localPlayer)
  36. addEvent("getServerInfo",true )
  37. addEventHandler("getServerInfo",localPlayer,function(maxPlayer,sname,ver)
  38.     s_maxPlayer = maxPlayer
  39.     s_name = sname
  40.     v_name = ver
  41. end)
  42.  
  43. plist = {}
  44.  
  45. function show_Playerlist( key,b_state  )
  46.     if b_state == "down" then
  47.         local n,p,m = getPlayerTables ( )  
  48.         removeEventHandler("onClientRender",root,player_list_title )
  49.         addEventHandler("onClientRender",root,player_list_title )
  50.         plist["name"] = call( getResourceFromName("widget-scrollbox"),"createScrollBox", centerX -(  width / 2) , centerY - (  height / 2)  , width*0.5 , height , n ,tocolor(0,40,40,180),font,false,false,2 )
  51.         plist["ping"] = call( getResourceFromName("widget-scrollbox"),"createScrollBox",(centerX -(  width / 2))+width*0.5 , centerY - (  height / 2)  , width*(1/4) , height , p ,tocolor(0,40,40,180),font,false,false,2 )
  52.         plist["money"] = call( getResourceFromName("widget-scrollbox"),"createScrollBox",(centerX -(  width / 2))+width*0.75 , centerY - (  height / 2)  , width*(1/4) , height , m ,tocolor(0,40,40,180),font,false,true,2 )
  53.     elseif b_state == "up" then
  54.         for key, obj in pairs( plist ) do
  55.             call(getResourceFromName("widget-scrollbox"), "destroyScrollBox",plist[key].id)
  56.         end
  57.         removeEventHandler("onClientRender",root,player_list_title )
  58.     end
  59. end
  60.  
  61. bindKey( "tab", "both",show_Playerlist )
  62.  
  63.  
  64.  
  65. function player_list_title ( )
  66.     local time = getRealTime()
  67.     dxDrawImage( ( centerX )-logo_width/2,(centerY - ( height *1.21 )),logo_width,logo_height,"logo.png" )
  68.     dxDrawRectangle( ( centerX - width /2 ) , centerY - ( height /2 ) - height *0.1 , width , height*0.1, tocolor( 0,20,20,180))
  69.     dxDrawBoxShape( ( centerX - width /2 ) , centerY - ( height /2 ) - height *0.1 , width , (height*0.1) , tocolor(0,0,0,255),2)
  70.     dxDrawBoxText( time.monthday.."/"..(time.month+1).."/"..(time.year+1900).." "..time.hour..":"..time.minute..":"..time.second,( centerX - width /2.1 ) , centerY - ( height /2 ) - height *0.1 , width , (height*0.1) ,tocolor(255,255,255,255),1,"default-bold","left","center")
  71.     dxDrawBoxText( string.upper( s_name.." "..v_name ),( centerX - width /1.9 ) , centerY - ( height /2 ) - height *0.1 , width , (height*0.1) ,tocolor(255,255,255,255),1,"default-bold","center","center")
  72.     dxDrawBoxText( "Spieler:"..#getElementsByType("player").."/"..s_maxPlayer,( centerX - width /1.9 ) , centerY - ( height /2 ) - height *0.1 , width , (height*0.1) ,tocolor(255,255,255,255),1,"default-bold","right","center")
  73.     dxDrawBoxShape( centerX -(  width / 2) , centerY - (  height / 2)  , width , height,tocolor(0,0,0,255),2)
  74.  
  75. end
  76.  
  77. function getPlayerTables ( )
  78.     local n_table = {{"SPIELER",1,tocolor(100,100,100,200)} }
  79.     local p_table = {{"PING",1,tocolor(100,100,100,200)}    }
  80.     local m_table = {{"GELD",1,tocolor(100,100,100,200)}    }
  81.     for key, player in ipairs( getElementsByType( "player" ) ) do
  82.         local color = tocolor( 0,100,100,200)
  83.         for i = 1,4 do
  84.         if key % 2 == 0 then tocolor( 0,150,150,200) end
  85.         table.insert ( n_table , {string.upper(getPlayerName( player )) ,tocolor(100,100,100,255),color} )
  86.         table.insert ( p_table , {string.upper(getPlayerPing( player ).."ms"),tocolor(100,100,100,255),color+tocolor(0,20,20,0)} )
  87.         table.insert ( m_table , {string.upper("$"..getPlayerMoney( player )),tocolor(100,100,100,255),color+tocolor(0,40,40,0)} )
  88.         end
  89.     end
  90.     return n_table, p_table , m_table
  91. end
  92.  
  93. FPS  = {}
  94. local counter = 0
  95. local starttick
  96. local currenttick
  97. FPS.fps = "x"
  98. addEventHandler("onClientRender",root,
  99.     function()
  100.         if not starttick then
  101.             starttick = getTickCount()
  102.         end
  103.         counter = counter + 1
  104.         currenttick = getTickCount()
  105.         if currenttick - starttick >= 1000 then
  106.             FPS.fps = counter
  107.             counter = 0
  108.             starttick = false
  109.         end
  110.     end
  111. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement