Aruna Posted July 26, 2015 Share Posted July 26, 2015 Hola una pregunta he intentado agregar una fila de FPS pero me tira error he buscado por la Wiki de MTA y no he encontrado nada alguien me puede ayudar. EJ la del Ping o Money es facil porque usamos getPlayerMoney y getPlayerPing pero en el FPS no hay nada yA = 0 local screenWidth, screenHeight = guiGetScreenSize() local sw, sh = guiGetScreenSize() scoreboardColumns = { { name = "Nombre", width = 180, data = function (element) return getPlayerName ( element ) end }, { name = "Asesinato", width = 80, data = function (element) return ( getElementData ( element, "murders" ) or 0 ) end }, { name = "Z Asesinados", width = 80, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ) end }, { name = "Supervivencia", width = 80, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end }, { name = "Clan", width = 100, data = function (element) return getElementData ( element, "gang" ) or "None" end }, { name = "Ping", width = 60, data = function (element) return getPlayerPing ( element, "ping" ) end }, } local serverName = "ScoreBoard Argentina-America " -- название сервера local topsize = 60 -- величина шляпы local playersize = topsize-30 -- высота одной строки local panelsize = playersize*10 -- величина панели function calculateWidth() local width = 0 for key, value in ipairs( scoreboardColumns ) do width = width + value.width end return width + 60 end local max_players = 0 local ploff = 0 local width = calculateWidth() local baseX = sw/2-width/2 local baseY = sh/2-(panelsize+topsize)/2 addEventHandler( "onClientRender", root, function() if getKeyState( "tab" ) == false then ploff = 0; 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(231,119,0), 0.9, "default-bold" ) dxDrawRectangle ( baseX, baseY+topsize, width, panelsize, tocolor(0,0,0,150) ) dxDrawLine ( baseX, baseY+30, baseX+width, baseY+30, tocolor(100,100,100),0.8 ) dxDrawLine ( baseX, baseY+30, baseX, baseY+panelsize+topsize, tocolor(100,100,100),0.8 ) dxDrawLine ( baseX, baseY+panelsize+topsize, baseX+width, baseY+panelsize+topsize, tocolor(100,100,100),0.8 ) dxDrawLine ( baseX+40, baseY+30, baseX+40, baseY+panelsize+topsize, tocolor(100,100,100),0.8 ) dxDrawText ( "№", baseX, baseY+60, baseX+40, baseY+topsize-30, tocolor(0,186,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(100,100,100),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 playersTable = { localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer, localPlayer } dxDrawText ( "Jugadores: "..tostring(#playersTable), baseX+20, baseY+10, baseX+width-20, baseY+topsize, tocolor(0,186,255), 0.9, "default-bold", "right" ) local maxNum = #playersTable if maxNum > 10 then maxNum = 10 end for i = 1, maxNum do dxDrawLine ( baseX, baseY+topsize+playersize*i, baseX+width, baseY+topsize+playersize*i, tocolor(100,100,100),0.8 ) dxDrawText ( i+ploff, baseX, baseY+topsize+playersize*(i-1), baseX+40, baseY+topsize+playersize*i, tocolor(255,255,255), 1, "default-bold", "center", "center" ) if playersTable[i+ploff] == localPlayer then dxDrawRectangle ( baseX, baseY+topsize+playersize*(i-1), width, playersize, tocolor(112,112,112,100) ) end local xoff = 60 for c, d in ipairs ( scoreboardColumns ) do local data = d.data(playersTable[i+ploff]) local r,g,b = 43,250,86 if d.name == "Clan" and data == "None" then r,g,b = 255,0,0 data = "Sin Clan" end dxDrawText ( data, baseX+xoff, baseY+topsize+playersize*(i-1), baseX+xoff+d.width, baseY+topsize+playersize*i, tocolor(r,g,b), 1, "default-bold", "center", "center" ) xoff = xoff+d.width end end end end ) Link to comment
Tomas Posted July 26, 2015 Share Posted July 26, 2015 addEventHandler("onClientRender",root, function() if not tickDeInicio then tickDeInicio = getTickCount() end FPS = FPS + 1 tickDeFinalizacion = getTickCount() if tickDeInicio - tickDeFinalizacion >= 1000 then setElementData(localPlayer, "FPS", FPS) tickDeInicio = false end end ) Link to comment
Recommended Posts