Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dxDrawBoxText( text , x, y , w , h , ... )
- dxDrawText( text , x , y , x + w , y + h , ... )
- end
- function dxDrawShadowText( text , x, y , w , h , shadowOffSetX , shadowOffSetY , tCol , sCol , ... )
- dxDrawText( text , x + shadowOffSetX , y + shadowOffSetY , x + w , y + h , sCol, ... )
- dxDrawText( text , x - shadowOffSetX , y - shadowOffSetY , x + w , y + h , sCol, ... )
- dxDrawText( text , x , y , x + w , y + h , tCol , ... )
- end
- function dxDrawBoxShape( x, y, w, h , ...)
- dxDrawLine( x, y, x+w,y,...)
- dxDrawLine( x, y+h , x +w , y+h,...)
- dxDrawLine( x , y ,x , y+h , ... )
- dxDrawLine( x+w , y ,x+w , y+h , ...)
- end
- --############################
- --## Widget-ScrollBox ##
- --## main_c.lua ##
- --## @author: Str0^ ##
- --## @date: 01.03.2015 ##
- --############################
- local w,h = guiGetScreenSize()
- local centerX , centerY = w*0.5 , h*0.6
- local width , height = w*0.4, w*0.3
- local logo_width = w*0.3
- local logo_height = w*0.3
- local font = dxCreateFont( "font.ttf", 12)
- triggerServerEvent("getServerInfos",localPlayer)
- addEvent("getServerInfo",true )
- addEventHandler("getServerInfo",localPlayer,function(maxPlayer,sname,ver)
- s_maxPlayer = maxPlayer
- s_name = sname
- v_name = ver
- end)
- plist = {}
- function show_Playerlist( key,b_state )
- if b_state == "down" then
- local n,p,m = getPlayerTables ( )
- removeEventHandler("onClientRender",root,player_list_title )
- addEventHandler("onClientRender",root,player_list_title )
- 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 )
- 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 )
- 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 )
- elseif b_state == "up" then
- for key, obj in pairs( plist ) do
- call(getResourceFromName("widget-scrollbox"), "destroyScrollBox",plist[key].id)
- end
- removeEventHandler("onClientRender",root,player_list_title )
- end
- end
- bindKey( "tab", "both",show_Playerlist )
- function player_list_title ( )
- local time = getRealTime()
- dxDrawImage( ( centerX )-logo_width/2,(centerY - ( height *1.21 )),logo_width,logo_height,"logo.png" )
- dxDrawRectangle( ( centerX - width /2 ) , centerY - ( height /2 ) - height *0.1 , width , height*0.1, tocolor( 0,20,20,180))
- dxDrawBoxShape( ( centerX - width /2 ) , centerY - ( height /2 ) - height *0.1 , width , (height*0.1) , tocolor(0,0,0,255),2)
- 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")
- 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")
- 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")
- dxDrawBoxShape( centerX -( width / 2) , centerY - ( height / 2) , width , height,tocolor(0,0,0,255),2)
- end
- function getPlayerTables ( )
- local n_table = {{"SPIELER",1,tocolor(100,100,100,200)} }
- local p_table = {{"PING",1,tocolor(100,100,100,200)} }
- local m_table = {{"GELD",1,tocolor(100,100,100,200)} }
- for key, player in ipairs( getElementsByType( "player" ) ) do
- local color = tocolor( 0,100,100,200)
- for i = 1,4 do
- if key % 2 == 0 then tocolor( 0,150,150,200) end
- table.insert ( n_table , {string.upper(getPlayerName( player )) ,tocolor(100,100,100,255),color} )
- table.insert ( p_table , {string.upper(getPlayerPing( player ).."ms"),tocolor(100,100,100,255),color+tocolor(0,20,20,0)} )
- table.insert ( m_table , {string.upper("$"..getPlayerMoney( player )),tocolor(100,100,100,255),color+tocolor(0,40,40,0)} )
- end
- end
- return n_table, p_table , m_table
- end
- FPS = {}
- local counter = 0
- local starttick
- local currenttick
- FPS.fps = "x"
- addEventHandler("onClientRender",root,
- function()
- if not starttick then
- starttick = getTickCount()
- end
- counter = counter + 1
- currenttick = getTickCount()
- if currenttick - starttick >= 1000 then
- FPS.fps = counter
- counter = 0
- starttick = false
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement