Looney;3

Members
  • Content Count

    41
  • Joined

  • Last visited

Community Reputation

5 Neutral

1 Follower

About Looney;3

  • Rank
    Rat

Details

  • Gang
    Insane Style Gamers

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Looney;3

    [SELL]Youtube Request Radio

    QUEUE IN CHAT COMMANDS /skip - Skip current sound /queue - Show queue sounds list BINDS F10 - Open the panel F7 - Preview Sound M - Switch to sounds Price: [SELLED]
  2. Looney;3

    [MTA CRASHING]

    Fixed CRASH now sorry ejejeje
  3. Looney;3

    [MTA CRASHING]

    ¿MTA is crashing when you enter to server? or ¿Your error is as this? LIBCEF.DLL?..... OK WHA THE :O?
  4. Looney;3

    [RACE]Userpanel + Race + Toptimes

    Hey, i come here to show you my little great project, I was advancing it with my little free time RACE CONCEPT: https://imgur.com/KFp14Uc USERPANEL CONCEPT: https://imgur.com/I99yU9c
  5. Hola vengo a compartirles un pequeño gran proyecto en el cual estuve trabajando hace mucho tiempo y con el poco tiempo que pude fui adelantando y modificando fue creado a base de un concepto creado por uno de los lideres de la comunidad Insane Style Gamers RACE CONCEPT: https://imgur.com/KFp14Uc USERPANEL CONCEPT: https://imgur.com/I99yU9c Lo que logre hasta ahora
  6. Looney;3

    [Help] Sound Fetch from YouTube

    wow thanks bro, but why that will break? :C
  7. Looney;3

    [Help] Sound Fetch from YouTube

    oh hahah im stupid thanks <3
  8. Looney;3

    [Help] Sound Fetch from YouTube

    Thanks but now fetchRemote send error #1006 1006: Destination IP not allowed u know why?
  9. Looney;3

    [Help] Sound Fetch from YouTube

    link = "https://www.youtube.com/watch?v=WAT47vPfs04" function onResourceStart() playingSound = playSound("http://www.convertmp3.io/fetch/?video="..link) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart) why don't work this?
  10. Hola Soy nuevo con esto de los Scoreboards y nececito ayuda estoy haciendo uno pero la verdad no me sale muy bien que digamos jaja Client.lua local sX,sY = guiGetScreenSize() function Background() if not getKeyState("tab") then return end dxDrawRectangle(0*sX,0*sY,sX,0.1*sY,tocolor(0,0,0,200)) dxDrawRectangle(0*sX,0.095*sY,sX,0.005*sY,tocolor(0,130,255,200)) dxDrawImage(0.42*sX, -0.04*sY, sX/7, sY/7,"files/logo.png",0,0,0,tocolor(22,22,22,255)) dxDrawText ("INSANE STYLE GAMERS",0.05*sX, 0.025*sY, 0*sX, 0*sY, tocolor(0, 130, 255), 2*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawText ("NEVER LOSE HOPE",0.55*sX, 0.025*sY, 0*sX, 0*sY, tocolor(255, 80, 80), 2*sX/sY*scale, font,'left', 'top', false,false,false,true) for i, name in ipairs (getElementsByType("player")) do local r,g,b = getTeamColor(getPlayerTeam(name)) dxDrawRectangle(0.25*sX,0.4*sY+((0.03*sY)*i),0.5*sX,0.03*sY,tocolor(11,11,11,200)) dxDrawText (""..(getElementData(name,"ID") or 0),0.26*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawText (""..string.format("#%02x%02x%02x",r,g,b)..(getPlayerNametagText(name) or "Anonymous"),0.28*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) -- dxDrawText (""..(getElementData(nick,"Cash") or "Guest"),0.35*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawText (""..(getElementData(name,"Points") or "Guest"),0.41*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawText (""..(getElementData(name,"Rank") or "Guest"),0.47*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) --dxDrawText (""..(getElementData(nick,"State") or "Guest"),0.53*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) --dxDrawText (""..(getElementData(nick,"Country") or "Narnia"),0.59*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawImage ( 0.59*sX, 0.402*sY+((0.03*sY)*i), 0.03*sX, 0.025*sY,":admin/client/images/flags/"..(getElementData(name,"country") or "Narnia"):lower()..".png", 0, 0, 0, tocolor (255,255,255,255), false ) dxDrawText (""..(getElementData(name,"FPS") or "Guest"),0.65*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) dxDrawText (""..(getPlayerPing(name) or "Guest"),0.71*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(255, 255, 255), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) if (tostring(getElementData(name, "state")) == "alive") then dxDrawImageSection ( 0.53*sX, 0.399*sY+((0.03*sY)*i), 0.02*sX, 0.03*sY, 3, 0, 115, 115,"files/alive.png", 0, 0, 0, tocolor (255,22,22,255), false ) else dxDrawImageSection ( 0.53*sX, 0.399*sY+((0.03*sY)*i), 0.02*sX, 0.03*sY, 3, 0, 115, 115,"files/alive.png", 0, 0, 0, tocolor (255,55,55,100), false ) end end for i, team in ipairs (getElementsByType("team")) do local PlayersWithTeam = getPlayersInTeam(team) if #PlayersWithTeam == 0 then else local teamName = getTeamName(team) local r,g,b = getTeamColor(team) dxDrawRectangle(0.25*sX,0.4*sY+((0.03*sY)*i),0.5*sX,0.03*sY,tocolor(11,11,11,220)) dxDrawText (""..teamName,0.26*sX, 0.405*sY+((0.03*sY)*i), 0*sX, 0*sY, tocolor(r,g,b), 0.65*sX/sY*scale, font,'left', 'top', false,false,false,true) end end end function StartDates() for i, name in ipairs (getElementsByType("player")) do nick = name i = nameid end end function Start() addEventHandler("onClientRender",getRootElement(),StartDates) addEventHandler("onClientRender",root,Background) end addEventHandler("onClientResourceStart",root,Start)
  11. Looney;3

    [SHOW]Clan War Script Insane Style Gamers

    Practicamente se lo usa para el enfrentamiento de dos clanes distintos y te dice los players que hay en cada team y si esta vivo o muerto, los puntos de cada uno y los mapas que faltan por jugar, tambien dice si esta en juego o hay que esperar
  12. Hola solo queria compartir imagenes de este script que a pesar de no ser muy complicado de hacer me costo su tiempo n.n
  13. Looney;3

    [AYUDA]Scoreboard+Flags

    Muchisimas gracias y como podria ocultar los Teams que estan sin players? lo intente varias veces pero aun no encuentro como -- THESE CAN BE CHANGED triggerKey = "tab" -- default button to open/close scoreboard settingsKey = "F7" -- default button to open the settings window drawOverGUI = true -- draw scoreboard over gui? seperationSpace = 80 -- the space between top/bottom screen and scoreboard top/bottom in pixels local sX, sY = guiGetScreenSize() local fScale = 0.0013*sY -- BUT DON'T TOUCH THESE scoreboardToggled = false scoreboardForced = false scoreboardDrawn = false forceScoreboardUpdate = false useAnimation = true scoreboardIsToggleable = false showServerInfo = false showGamemodeInfo = false showTeams = true useColors = true drawSpeed = 1 scoreboardScale = 1 teamHeaderFont = "default-bold" contentFont = "default-bold" columnFont = "default-bold" serverInfoFont = "default-bold" rmbFont = "default-bold" cBlack = tocolor( 0, 0, 0 ) cWhite = tocolor( 255, 255, 255 ) cSettingsBox = tocolor( 255, 255, 255, 150 ) MAX_PRIRORITY_SLOT = 500 scoreboardColumns = {} resourceColumns = {} scoreboardDimensions = { ["width"] = 0, ["height"] = 0, ["phase"] = 1, ["lastSeconds"] = 0 } scoreboardTicks = { ["lastUpdate"] = 0, ["updateInterval"] = 500 } scoreboardContent = {} firstVisibleIndex = 1 sortBy = { ["what"] = "__NONE__", ["dir"] = -1 } -- -1 = dec, 1 = asc sbOutOffset, sbInOffset = 1, 1 sbFont = "clear" sbFontScale = 0.68 serverInfo = {} fontScale = { -- To make all fonts be equal in height ["default"] = 1.0, ["default-bold"] = 1.0, ["clear"] = 1.0, ["arial"] = 1.0, ["sans"] = 1.0, ["pricedown"] = 0.5, ["bankgothic"] = 0.5, ["diploma"] = 0.5, ["beckett"] = 0.5 } selectedRows = {} addEvent( "onClientPlayerScoreboardClick" ) local fpsTick = getTickCount() local fps = 1 function getFPSForPlayer() fps = fps + 1 if getTickCount()-fpsTick>=1000 then fpsTick = getTickCount() setElementData(localPlayer,"fps",fps) fps = 1 end end addEventHandler("onClientRender",getRootElement(),getFPSForPlayer) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( resource ) cScoreboardBackground = tocolor( defaultSettings.bg_color.r, defaultSettings.bg_color.g, defaultSettings.bg_color.b, defaultSettings.bg_color.a ) cSelection = tocolor( defaultSettings.selection_color.r, defaultSettings.selection_color.g, defaultSettings.selection_color.b, defaultSettings.selection_color.a ) cHighlight = tocolor( defaultSettings.highlight_color.r, defaultSettings.highlight_color.g, defaultSettings.highlight_color.b, defaultSettings.highlight_color.a ) cHeader = tocolor( defaultSettings.header_color.r, defaultSettings.header_color.g, defaultSettings.header_color.b, defaultSettings.header_color.a ) cTeam = tocolor( defaultSettings.team_color.r, defaultSettings.team_color.g, defaultSettings.team_color.b, defaultSettings.team_color.a ) cBorder = tocolor( defaultSettings.border_color.r, defaultSettings.border_color.g, defaultSettings.border_color.b, defaultSettings.border_color.a ) cServerInfo = tocolor( defaultSettings.serverinfo_color.r, defaultSettings.serverinfo_color.g, defaultSettings.serverinfo_color.b, defaultSettings.serverinfo_color.a ) cContent = tocolor( defaultSettings.content_color.r, defaultSettings.content_color.g, defaultSettings.content_color.b, defaultSettings.content_color.a ) bindKey( triggerKey, "down", "Toggle scoreboard", "1" ) bindKey( triggerKey, "up", "Toggle scoreboard", "0" ) bindKey( settingsKey, "down", "Open scoreboard settings", "1" ) addEventHandler( "onClientRender", getRootElement(), drawScoreboard ) triggerServerEvent( "onClientDXScoreboardResourceStart", getRootElement() ) readScoreboardSettings() triggerServerEvent( "requestServerInfo", getRootElement() ) scoreboardAddColumn( "id", 20, "ID" ) scoreboardAddColumn( "name", 180, "Name" ) scoreboardAddColumn( "fps", 25, "FPS" ) scoreboardAddColumn( "state", 70, "State" ) scoreboardAddColumn( "country", 80, "Country" ) colorPicker.constructor() end ) addEventHandler( "onClientPlayerQuit", getRootElement(), function() selectedRows[source] = nil end ) function sendServerInfo( output ) serverInfo = output end addEvent( "sendServerInfo", true ) addEventHandler( "sendServerInfo", getResourceRootElement( getThisResource() ), sendServerInfo ) function toggleScoreboard( _, state ) state = iif( state == "1", true, false ) if scoreboardIsToggleable and state then scoreboardToggled = not scoreboardToggled elseif not scoreboardIsToggleable then scoreboardToggled = state end end addCommandHandler( "Toggle scoreboard", toggleScoreboard ) function openSettingsWindow() if scoreboardDrawn then local sX, sY = guiGetScreenSize() if not (windowSettings and isElement( windowSettings ) and guiGetVisible( windowSettings )) then --createScoreboardSettingsWindow( sX-323, sY-350 ) --showCursor( true ) elseif isElement( windowSettings ) then destroyScoreboardSettingsWindow() end end end addCommandHandler( "Open scoreboard settings", openSettingsWindow ) addCommandHandler( "scoreboard", function () scoreboardToggled = not scoreboardToggled end ) function iif( cond, arg1, arg2 ) if cond then return arg1 end return arg2 end function doDrawScoreboard( rtPass, onlyAnim, sX, sY ) if #scoreboardColumns ~= 0 then -- -- In/out animation -- local currentSeconds = getTickCount() / 3000 local deltaSeconds = currentSeconds - scoreboardDimensions.lastSeconds scoreboardDimensions.lastSeconds = currentSeconds deltaSeconds = math.clamp( 0, deltaSeconds, 1/25 ) if scoreboardToggled or scoreboardForced then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if not useAnimation then scoreboardDimensions.width = calculateWidth() scoreboardDimensions.height = calculateHeight() scoreboardDimensions.phase = #phases end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToWidth - scoreboardDimensions.width, maxChange ) local maxHeightDiff = math.clamp( -maxChange, phases[scoreboardDimensions.phase].incToHeight - scoreboardDimensions.height, maxChange ) if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = scoreboardDimensions.width + maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end elseif scoreboardDimensions.width > phases[scoreboardDimensions.phase].incToWidth and not scoreboardDrawn then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].incToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].incToWidth end end if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = scoreboardDimensions.height + maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end elseif scoreboardDimensions.height > phases[scoreboardDimensions.phase].incToHeight and not scoreboardDrawn then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].incToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].incToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].incToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].incToHeight then if phases[scoreboardDimensions.phase + 1] then scoreboardDimensions.phase = scoreboardDimensions.phase + 1 else if not scoreboardDrawn then bindKey( "mouse2", "both", showTheCursor ) bindKey( "mouse_wheel_up", "down", scrollScoreboard, -1 ) bindKey( "mouse_wheel_down", "down", scrollScoreboard, 1 ) addEventHandler( "onClientClick", getRootElement(), scoreboardClickHandler ) if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end triggerServerEvent( "requestServerInfo", getRootElement() ) end scoreboardDrawn = true end end elseif scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then local phases = { [1] = { ["width"] = s(10), ["height"] = s(5), ["incToWidth"] = s(10), ["incToHeight"] = s(5), ["decToWidth"] = 0, ["decToHeight"] = 0 }, [2] = { ["width"] = s(40), ["height"] = s(5), ["incToWidth"] = calculateWidth(), ["incToHeight"] = s(5), ["decToWidth"] = s(10), ["decToHeight"] = s(5) }, [3] = { ["width"] = calculateWidth(), ["height"] = s(30), ["incToWidth"] = calculateWidth(), ["incToHeight"] = calculateHeight(), ["decToWidth"] = calculateWidth(), ["decToHeight"] = s(5) } } if scoreboardDrawn then unbindKey( "mouse2", "both", showTheCursor ) unbindKey( "mouse_wheel_up", "down", scrollScoreboard, -1 ) unbindKey( "mouse_wheel_down", "down", scrollScoreboard, 1 ) removeEventHandler( "onClientClick", getRootElement(), scoreboardClickHandler ) if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end end scoreboardDrawn = false if not useAnimation then scoreboardDimensions.width = 0 scoreboardDimensions.height = 0 scoreboardDimensions.phase = 1 end local maxChange = deltaSeconds * 30*drawSpeed local maxWidthDiff = math.clamp( -maxChange, scoreboardDimensions.width - phases[scoreboardDimensions.phase].decToWidth, maxChange ) local maxHeightDiff = math.clamp( -maxChange, scoreboardDimensions.height - phases[scoreboardDimensions.phase].decToHeight, maxChange ) if scoreboardDimensions.width > phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width < phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].decToWidth end elseif scoreboardDimensions.width < phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = scoreboardDimensions.width - maxWidthDiff * phases[scoreboardDimensions.phase].width if scoreboardDimensions.width > phases[scoreboardDimensions.phase].decToWidth then scoreboardDimensions.width = phases[scoreboardDimensions.phase].decToWidth end end if scoreboardDimensions.height > phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height < phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].decToHeight end elseif scoreboardDimensions.height < phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = scoreboardDimensions.height - maxHeightDiff * phases[scoreboardDimensions.phase].height if scoreboardDimensions.height > phases[scoreboardDimensions.phase].decToHeight then scoreboardDimensions.height = phases[scoreboardDimensions.phase].decToHeight end end if scoreboardDimensions.width == phases[scoreboardDimensions.phase].decToWidth and scoreboardDimensions.height == phases[scoreboardDimensions.phase].decToHeight and scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then scoreboardDimensions.phase = scoreboardDimensions.phase - 1 if scoreboardDimensions.phase < 1 then scoreboardDimensions.phase = 1 end end end -- -- Draw scoreboard background -- if (not rtPass or onlyAnim) and scoreboardDimensions.width ~= 0 and scoreboardDimensions.height ~= 0 then dxDrawRectangle( (sX/2)-(scoreboardDimensions.width/2), (sY/2)-(scoreboardDimensions.height/2)-0.02*sY, scoreboardDimensions.width, scoreboardDimensions.height+0.02*sY, tocolor(0,0,0,150), drawOverGUI ) end -- Check if anything else to do if not scoreboardDrawn or onlyAnim then return end -- -- Update the scoreboard content -- local currentTick = getTickCount() if (currentTick - scoreboardTicks.lastUpdate > scoreboardTicks.updateInterval and (scoreboardToggled or scoreboardForced)) or forceScoreboardUpdate then forceScoreboardUpdate = false scoreboardContent = {} local index = 1 local sortTableIndex = 1 local sortTable = {} local players = getElementsByType( "player" ) for key, player in ipairs( players ) do if not getPlayerTeam( player ) or not (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) or serverInfo.forcehideteams then sortTable[sortTableIndex] = {} for key, column in ipairs( scoreboardColumns ) do local content if column.name == "name" then local playerName = getPlayerName( player ) if serverInfo.allowcolorcodes then if string.find( playerName, "#%x%x%x%x%x%x" ) then local colorCodes = {} while( string.find( playerName, "#%x%x%x%x%x%x" ) ) do local startPos, endPos = string.find( playerName, "#%x%x%x%x%x%x" ) if startPos then colorCode = string.sub( playerName, startPos, endPos ) table.insert( colorCodes, { { getColorFromString( colorCode ) }, startPos } ) playerName = string.gsub( playerName, "#%x%x%x%x%x%x", "", 1 ) end end content = { playerName, colorCodes } else content = playerName end else content = playerName end elseif column.name == "ping" then content = getPlayerPing( player ) elseif column.name == "fps" then content = getElementData(player,"fps") or "Nil" elseif column.name == "rank" then content = getElementData(player,"Rank") or "Nil" elseif column.name == "points" then content = getElementData(player,"Points") or "Nil" elseif column.name == "cash" then content = getElementData(player,"Cash") or "Nil" elseif column.name == "state" then content = getElementData(player,"state") or "Nil" elseif column.name == "id" then content = getElementData(player,"ID") or "Nil" elseif column.name == "country" then local countryCode = getElementData(player,"country") local yva = getElementData(player,"Yvalor") local flagURL = "client/images/flags/"..countryCode:lower()..".png" if fileExists(flagURL) then dxDrawImage(0.81*sX,yva,sX*0.05,sY*0.1,flagURL,0,0,0,tocolor(255,255,255,255),drawOverGUI) end content = getElementData(player,"countryCode") or "Narnia" content = getElementData(player,"country") or "Narnia" else content = getElementData( player, column.name ) end content = iif( content and column.name ~= "name" and type( content ) ~= "table", tostring( content ), content ) if column.textFunction then if content and column.name == "name" and type( content ) == "table" then content[1] = column.textFunction( content[1], player ) else content = column.textFunction( content, player ) end end sortTable[sortTableIndex][column.name] = content sortTable[sortTableIndex]["__SCOREBOARDELEMENT__"] = player end sortTableIndex = sortTableIndex + 1 end end if sortBy.what ~= "__NONE__" then table.sort( sortTable, scoreboardSortFunction ) end for key, value in ipairs( sortTable ) do scoreboardContent[index] = value index = index + 1 end if (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) and not serverInfo.forcehideteams then -- And then the teams local teamSortTableIndex = 1 local teamSortTable = {} sortTableIndex = 1 sortTable = {} local teams = getElementsByType( "team" ) for key, team in ipairs( teams ) do -- Add teams to sorting table first teamSortTable[teamSortTableIndex] = {} for key, column in ipairs( scoreboardColumns ) do local content if column.name == "name" then local teamName = getTeamName( team ) local teamMemberCount = #getPlayersInTeam( team ) teamName = iif( teamName, tostring( teamName ), "-" ) teamMemberCount = iif( teamMemberCount, tostring( teamMemberCount ), "0" ) teamName = teamName .. " (" .. teamMemberCount .. " player" .. iif( teamMemberCount == "1", "", "s" ) .. ")" if serverInfo.allowcolorcodes then if string.find( teamName, "#%x%x%x%x%x%x" ) then local colorCodes = {} while( string.find( teamName, "#%x%x%x%x%x%x" ) ) do local startPos, endPos = string.find( teamName, "#%x%x%x%x%x%x" ) if startPos then colorCode = string.sub( teamName, startPos, endPos ) table.insert( colorCodes, { { getColorFromString( colorCode ) }, startPos } ) teamName = string.gsub( teamName, "#%x%x%x%x%x%x", "", 1 ) end end content = { teamName, colorCodes } else content = teamName end else content = teamName end else content = getElementData( team, column.name ) end content = iif( content and column.name ~= "name" and type( content ) ~= "table", tostring( content ), content ) if column.textFunction then if content and column.name == "name" and type( content ) == "table" then content[1] = column.textFunction( content[1], team ) else content = column.textFunction( content, team ) end end teamSortTable[teamSortTableIndex][column.name] = content teamSortTable[teamSortTableIndex]["__SCOREBOARDELEMENT__"] = team end teamSortTableIndex = teamSortTableIndex + 1 -- and then the players sortTableIndex = 1 sortTable[team] = {} local players = getPlayersInTeam( team ) for key, player in ipairs( players ) do sortTable[team][sortTableIndex] = {} for key, column in ipairs( scoreboardColumns ) do local content if column.name == "name" then local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) -- NameTeam = getTeamName(team) playerName = RGBToHex(r,g,b)..getPlayerNametagText( player ) else playerName = "#FFFFFF"..getPlayerNametagText( player ) -- NameTeam = "" end content = playerName elseif column.name == "ping" then content = getPlayerPing( player ) elseif column.name == "fps" then content = getElementData(player,"fps") or "Nil" elseif column.name == "rank" then content = getElementData(player,"rank") or "Nil" elseif column.name == "points" then content = getElementData(player,"points") or "Nil" elseif column.name == "cash" then content = getElementData(player,"cash") or "Nil" elseif column.name == "state" then content = getElementData(player,"state") or "Nil" elseif column.name == "id" then content = getElementData(player,"id") or "Nil" elseif column.name == "country" then local countryCode = getElementData(player,"country") local yva = getElementData(player,"Yvalor") local flagURL = "client/images/flags/"..countryCode:lower()..".png" if fileExists(flagURL) then dxDrawImage(0.81*sX,yva,sX*0.05,sY*0.1,flagURL,0,0,0,tocolor(255,255,255,255),drawOverGUI) end content = getElementData(player,"countryCode") or "Narnia" content = getElementData(player,"country") or "Narnia" else content = getElementData( player, column.name ) end content = iif( content and column.name ~= "name" and type( content ) ~= "table", tostring( content ), content ) if column.textFunction then if content and column.name == "name" and type( content ) == "table" then content[1] = column.textFunction( content[1], player ) else content = column.textFunction( content, player ) end end sortTable[team][sortTableIndex][column.name] = content sortTable[team][sortTableIndex]["__SCOREBOARDELEMENT__"] = player end sortTableIndex = sortTableIndex + 1 end if sortBy.what ~= "__NONE__" then table.sort( sortTable[team], scoreboardSortFunction ) end end if sortBy.what ~= "__NONE__" then table.sort( teamSortTable, scoreboardSortFunction ) end for key, content in ipairs( teamSortTable ) do local team = content["__SCOREBOARDELEMENT__"] scoreboardContent[index] = content index = index + 1 for key, value in ipairs( sortTable[team] ) do scoreboardContent[index] = value index = index + 1 end end end scoreboardTicks.lastUpdate = currentTick end -- -- Draw scoreboard content -- if scoreboardDrawn then scoreboardDimensions.height = calculateHeight() scoreboardDimensions.width = calculateWidth() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() if firstVisibleIndex > #scoreboardContent-maxPerWindow+1 then firstVisibleIndex = 1 end if firstVisibleIndex > 1 then dxDrawImage( sX/2-8, topY-15, 17, 11, "arrow.png", 0, 0, 0, cWhite, drawOverGUI ) end if firstVisibleIndex+maxPerWindow <= #scoreboardContent and #scoreboardContent > maxPerWindow then dxDrawImage( sX/2-8, topY+scoreboardDimensions.height+4, 17, 11, "arrow.png", 180, 0, 0, cWhite, drawOverGUI ) end local y = topY+s(5) local c, a = guiGetScreenSize() -- if serverInfo.server and showServerInfo then dxDrawText( "#0088FFServer: #FFFFFF" .. serverInfo.server or "None", 0.01*sX, y-0.15*sY, 0, 0, cWhite, 0.0012*a, "default-bold", "left", "top", false, false, drawOverGUI,true ) -- end -- if serverInfo.players and showServerInfo then local players = getElementsByType( "player" ) local text = "#0088FFPlayers: #FFFFFF" .. tostring( #players ) .. "/" .. serverInfo.players local textWidth = dxGetTextWidth( text:gsub("#%x%x%x%x%x%x",""), fScale, serverInfoFont ) dxDrawText( text, topX+scoreboardDimensions.width-s(5)-textWidth, y-0.15*sY, 0, 0, cWhite, fScale, rmbFont, "left", "top", false, false, drawOverGUI,true ) -- end if (serverInfo.server or serverInfo.players) and showServerInfo then y = y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end -- if serverInfo.gamemode and showGamemodeInfo then --dxDrawText( "Gamemode: " .. serverInfo.gamemode, topX+s(5), y, topX+scoreboardDimensions.width-s(10), y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ), cWhite, fScale, rmbFont, "left", "top", false, false, drawOverGUI,true ) -- end -- if serverInfo.map and showGamemodeInfo then local text = "Map: " .. serverInfo.map local textWidth = dxGetTextWidth( text, fScale, serverInfoFont ) --dxDrawText( text, topX+scoreboardDimensions.width-s(5)-textWidth, y, topX+scoreboardDimensions.width-s(5), y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ), cWhite, fScale, rmbFont, "left", "top", false, false, drawOverGUI,true ) -- end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end y = y+s(3) local textLength = dxGetTextWidth( "Scoreboard #0088FFInsane Style Gamers #FFFFFF2.0", fScale, rmbFont ) local textHeight = dxGetFontHeight( fScale, rmbFont ) dxDrawText( "Scoreboard #0088FFInsane Style Gamers #FFFFFF2.0", 0.3*sX, topY+scoreboardDimensions.height-textHeight-s(2), sX/2+(textLength/2), topY+scoreboardDimensions.height-s(2), cWhite, fScale, rmbFont, "left", "top", false, false, drawOverGUI,true ) --[[ local bottomX, bottomY = topX+scoreboardDimensions.width, topY+scoreboardDimensions.height textLength = dxGetTextWidth( "settings...", fontscale(sbFont, s(sbFontScale)), sbFont ) textHeight = dxGetFontHeight( fontscale(sbFont, s(sbFontScale)), sbFont ) dxDrawText( "settings...", bottomX-s(sbOutOffset+1+sbInOffset)-textLength, bottomY-s(sbOutOffset+1+sbInOffset)-textHeight, bottomX-s(sbOutOffset+1+sbInOffset), bottomY-s(sbOutOffset+1+sbInOffset), cSettingsBox, fontscale(sbFont, s(sbFontScale)), sbFont, "left", "top", false, false, drawOverGUI ) dxDrawLine( bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI ) dxDrawLine( bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI ) dxDrawLine( bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight, cSettingsBox, 1, drawOverGUI ) dxDrawLine( bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength, bottomY-s(sbOutOffset+1), bottomX-s(sbOutOffset+1), bottomY-s(sbOutOffset+1), cSettingsBox, 1, drawOverGUI )]] local x = s(10) for key, column in ipairs( scoreboardColumns ) do if x ~= s(10) then local height = s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then height = height+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then height = height+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end height = height+s(3) dxDrawLine( topX+x-s(5), y+s(1), topX+x-s(5), y+scoreboardDimensions.height-height-s(2)-textHeight-s(5), cBorder, s(1), drawOverGUI ) end if sortBy.what == column.name then local _, _, _, a = fromcolor( cHeader ) dxDrawText( column.friendlyName or "-", topX+x+s(1+9), y+s(1), topX+x+s(1+column.width), y+s(1)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), tocolor( 0, 0, 0, a ), fScale, "default-bold", "left", "top", true, false, drawOverGUI ) dxDrawText( column.friendlyName or "-", topX+x+s(9), y, topX+x+s(column.width), y+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), cHeader, fScale, "default-bold", "left", "top", true, false, drawOverGUI ) --dxDrawRectangle( topX+x, iif( sortBy.dir == 1, y+s(8), y+s(6) ), s(5), s(1), cWhite, drawOverGUI ) --dxDrawRectangle( topX+x+s(1), y+s(7), s(3), s(1), cWhite, drawOverGUI ) --dxDrawRectangle( topX+x+s(2), iif( sortBy.dir == 1, y+s(6), y+s(8) ), s(1), s(1), cWhite, drawOverGUI ) else local _, _, _, a = fromcolor( cHeader ) dxDrawText( column.friendlyName or "-", topX+x+s(1), y+s(1), topX+x+s(1+column.width), y+s(1)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), tocolor( 0, 0, 0, a ), fScale, "default-bold", "left", "top", true, false, drawOverGUI ) dxDrawText( column.friendlyName or "-", topX+x, y, topX+x+s(column.width), y+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), cHeader, fScale, "default-bold", "left", "top", true, false, drawOverGUI ) end x = x + s(column.width + 10) end dxDrawLine( topX+s(5), y+s(1)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), topX+scoreboardDimensions.width-s(5), y+s(1)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ), cBorder, s(1), drawOverGUI ) y = y+s(5)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ) while ( index < firstVisibleIndex+maxPerWindow and scoreboardContent[index] ) do local x = s(10) local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] local team, player if element and isElement( element ) and getElementType( element ) == "team" then --dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ), tocolor(33,33,33,100), drawOverGUI ) -- Highlight the the row on which the cursor lies on if checkCursorOverRow( rtPass, topX+s(5), topX+scoreboardDimensions.width-s(5), y, y+dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) ) then --dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ), cHighlight, drawOverGUI ) end -- Highlight selected row if selectedRows[element] then --dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ), cHighlight, drawOverGUI ) end for key, column in ipairs( scoreboardColumns ) do local r, g, b, a = fromcolor( cContent ) if not useColors then r, g, b = 255, 255, 255 end local theX = x local content = scoreboardContent[index][column.name] if content and column.name == "name" then if useColors then r, g, b = getTeamColor( element ) end theX = x - s(3) end if content then if serverInfo.allowcolorcodes and type( content ) == "table" and column.name == "name" then elseif type( content ) == "table" and column.name ~= "name" then if content.type == "image" and content.src then local itemHeight = dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) content.height = content.height or itemHeight content.width = content.width or itemHeight local itemWidth = content.height/itemHeight * content.width content.color = content.color or tocolor(255,255,255,255) content.rot = content.rot or 0 content.rotOffX = content.rotOffX or 0 content.rotOffY = content.rotOffY or 0 dxDrawImage ( topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color,drawOverGUI ) end else dxDrawText( content, topX+theX+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ), tocolor( 0, 0, 0, a or 255 ),fScale, "default-bold", "left", "top", true, false,drawOverGUI,true ) dxDrawText( content, topX+theX, y, topX+x+s(column.width), y+dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ), tocolor( r or 255, g or 255, b or 255, a or 255 ), fScale, "default-bold", "left", "top", true, false, drawOverGUI,true ) end end x = x + s(column.width + 10) end elseif element and isElement( element ) and getElementType( element ) == "player" then -- Highlight local player's name if element == getLocalPlayer() then -- dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), tocolor(33,33,33,100), drawOverGUI ) end -- Highlight the the row on which the cursor lies on if checkCursorOverRow( rtPass, topX+s(5), topX+scoreboardDimensions.width-s(5), y, y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ) ) then --dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), cHighlight, drawOverGUI ) end -- Highlight selected row if selectedRows[element] then --dxDrawRectangle( topX+s(5), y, scoreboardDimensions.width-s(10), dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), cHighlight, drawOverGUI ) end for key, column in ipairs( scoreboardColumns ) do local r, g, b, a = fromcolor( cContent ) if not useColors then r, g, b = 255, 255, 255 end local theX = x local content = scoreboardContent[index][column.name] if content and column.name == "name" then if useColors then r, g, b = getPlayerNametagColor( element ) end if getPlayerTeam( element ) and (showTeams or (serverInfo.forceshowteams and not serverInfo.forcehideteams)) and not serverInfo.forcehideteams then theX = x + s(12) end end if content then if serverInfo.allowcolorcodes and type( content ) == "table" and column.name == "name" then elseif type( content ) == "table" and column.name ~= "name" then if content.type == "image" and content.src then local itemHeight = dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ) content.height = content.height or itemHeight content.width = content.width or itemHeight local itemWidth = itemHeight/content.height * content.width content.color = content.color or tocolor(255,255,255,255) content.rot = content.rot or 0 content.rotOffX = content.rotOffX or 0 content.rotOffY = content.rotOffY or 0 dxDrawImage ( topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color, drawOverGUI ) end else dxDrawText( content:gsub("#%x%x%x%x%x%x",""), topX+theX+s(1), y+s(1), topX+x+s(1+column.width), y+s(11)+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), tocolor( 0, 0, 0, a or 255 ), fScale, "default-bold", "left", "top", true, false, drawOverGUI,true ) dxDrawText( content, topX+theX, y, topX+x+s(column.width), y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), tocolor( r or 255, g or 255, b or 255, a or 255 ), fScale, "default-bold", "left", "top", true, false, drawOverGUI,true ) setElementData(localPlayer,"Yvalor",y) end end x = x + s(column.width + 10) end end local font = iif( element and isElement( element ) and getElementType( element ) == "team", teamHeaderFont, contentFont ) y = y + dxGetFontHeight( fontscale(font, scoreboardScale), font ) index = index + 1 end index = 1 end end end -- FUNCTIONS -- addColumn function scoreboardAddColumn( name, width, friendlyName, priority, textFunction, fromResource ) if type( name ) == "string" then width = width or 70 friendlyName = friendlyName or name priority = tonumber( priority ) or getNextFreePrioritySlot( scoreboardGetColumnPriority( "name" ) ) fixPrioritySlot( priority ) textFunction = textFunction or nil fromResource = sourceResource or fromResource or nil if not (priority > MAX_PRIRORITY_SLOT or priority < 1) then for key, value in ipairs( scoreboardColumns ) do if name == value.name then return false end end table.insert( scoreboardColumns, { ["name"] = name, ["width"] = width, ["friendlyName"] = friendlyName, ["priority"] = priority, ["textFunction"] = textFunction } ) table.sort( scoreboardColumns, function ( a, b ) return a.priority < b.priority end ) if fromResource then if not resourceColumns[fromResource] then resourceColumns[fromResource] = {} end table.insert ( resourceColumns[fromResource], name ) end return true end end return false end addEvent( "doScoreboardAddColumn", true ) addEventHandler( "doScoreboardAddColumn", getResourceRootElement(), function ( name, width, friendlyName, priority, fromResource ) scoreboardAddColumn( name, width, friendlyName, priority, nil, fromResource ) end ) -- removeColumn function scoreboardRemoveColumn( name ) if type( name ) == "string" then for key, value in ipairs( scoreboardColumns ) do if name == value.name then table.remove( scoreboardColumns, key ) for resource, content in pairs( resourceColumns ) do table.removevalue( content, name ) end return true end end end return false end addEvent( "doScoreboardRemoveColumn", true ) addEventHandler( "doScoreboardRemoveColumn", getResourceRootElement(), function ( name ) scoreboardRemoveColumn( name ) end ) -- clearColumns function scoreboardClearColumns() while ( scoreboardColumns[1] ) do table.remove( scoreboardColumns, 1 ) resourceColumns = {} end return true end addEvent( "doScoreboardClearColumns", true ) addEventHandler( "doScoreboardClearColumns", getResourceRootElement(), function () scoreboardClearColumns() end ) -- resetColumns function scoreboardResetColumns( fromServer ) while ( scoreboardColumns[1] ) do table.remove( scoreboardColumns, 1 ) resourceColumns = {} end if not fromServer then scoreboardAddColumn( "name", 200, "Name" ) scoreboardAddColumn( "ping", 40, "Ping" ) scoreboardAddColumn( "fps", 40, "FPS" ) end return true end addEvent( "doScoreboardResetColumns", true ) addEventHandler( "doScoreboardResetColumns", getResourceRootElement(), function ( fromServer ) scoreboardResetColumns( iif( fromServer == nil, true, fromServer ) ) end ) -- setForced function scoreboardSetForced( forced ) scoreboardForced = forced end addEvent( "doScoreboardSetForced", true ) addEventHandler( "doScoreboardSetForced", getResourceRootElement(), function ( forced ) scoreboardSetForced( forced ) end ) --Compability setScoreboardForced = scoreboardSetForced --setSortBy function scoreboardSetSortBy( name, desc ) if name then if type( name ) == "string" then local exists = false for key, value in ipairs( scoreboardColumns ) do if name == value.name then exists = true end end if exists then desc = iif( type( desc ) == "boolean" and not desc, 1, -1 ) sortBy.what = name sortBy.dir = desc end end return false else sortBy.what = "__NONE__" sortBy.dir = -1 return true end end addEvent( "doScoreboardSetSortBy", true ) addEventHandler( "doScoreboardSetSortBy", getResourceRootElement(), function ( name, desc ) scoreboardSetSortBy( name, desc ) end ) --getColumnPriority function scoreboardGetColumnPriority( name ) if type( name ) == "string" then for key, value in ipairs( scoreboardColumns ) do if name == value.name then return value.priority end end end return false end --setColumnPriority function scoreboardSetColumnPriority( name, priority ) if type( name ) == "string" and type( priority ) == "number" then if not (priority > MAX_PRIRORITY_SLOT or priority < 1) then local columnIndex = false for key, value in ipairs( scoreboardColumns ) do if name == value.name then columnIndex = key end end if columnIndex then scoreboardColumns[columnIndex].priority = -1 -- To empty out the current priority fixPrioritySlot( priority ) scoreboardColumns[columnIndex].priority = priority table.sort( scoreboardColumns, function ( a, b ) return a.priority < b.priority end ) return true end end end return false end addEvent( "doScoreboardSetColumnPriority", true ) addEventHandler( "doScoreboardSetColumnPriority", getResourceRootElement(), function ( name, priority ) scoreboardSetColumnPriority( name, priority ) end ) --getColumnCount function scoreboardGetColumnCount() return #scoreboardColumns end --setColumnTextFunction function scoreboardSetColumnTextFunction( name, func ) if type( name ) == "string" then for key, value in ipairs( scoreboardColumns ) do if name == value.name then scoreboardColumns[key].textFunction = func return true end end end return false end function scoreboardGetTopCornerPosition() if scoreboardDrawn then local sX, sY = guiGetScreenSize() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) topY = topY - 15 -- Extra 15 pixels for the scroll up button return math.floor(topX), math.floor(topY+1) end return false end function scoreboardGetSize() if scoreboardDrawn then local width, height = calculateWidth(), calculateHeight() return width, height end return false end function scoreboardGetSelectedRows() local rows = {} for k, v in pairs( selectedRows ) do table.insert( rows, k ) end return rows end -- Other function calculateWidth() local width = 0 for key, value in ipairs( scoreboardColumns ) do width = width + s(value.width + 10)+0*sX end return width + s(10) end function calculateHeight() local sX, sY = guiGetScreenSize() local maxPerWindow = getMaxPerWindow() local index = firstVisibleIndex local height = s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then height = height+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then height = height+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end height = height+s(3) height = height+s(5)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ) height = height+s(5)+dxGetFontHeight( fontscale(rmbFont, s(0.75)), rmbFont ) height = height+s(2) while ( index < firstVisibleIndex+maxPerWindow and scoreboardContent[index] ) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] if element and isElement( element ) and getElementType( element ) == "team" then height = height + dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) else height = height + dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ) end index = index + 1 end return height end function showTheCursor( _, state ) if state == "down" then showCursor( true ) else if not (windowSettings and isElement( windowSettings )) then showCursor( false ) end end end function scrollScoreboard( _, _, upOrDown ) if isCursorShowing() then local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() local highestIndex = #scoreboardContent - maxPerWindow + 1 if index >= 1 and index <= highestIndex then local newIndex = math.max(1,math.min(index + upOrDown * serverInfo.scrollStep,highestIndex)) if index ~= newIndex then firstVisibleIndex = newIndex bForceUpdate = true end end end end function math.clamp( low, value, high ) return math.max( low, math.min( value, high ) ) end function fromcolor( color ) -- Propably not the most efficient way, but only way it works local colorCode = string.format( "%x", color ) local a = string.sub( colorCode, 1, 2 ) or "FF" local r = string.sub( colorCode, 3, 4 ) or "FF" local g = string.sub( colorCode, 5, 6 ) or "FF" local b = string.sub( colorCode, 7, 8 ) or "FF" a = tonumber( "0x" .. a ) r = tonumber( "0x" .. r ) g = tonumber( "0x" .. g ) b = tonumber( "0x" .. b ) return r, g, b, a end function scale( value ) return value*scoreboardScale end s = scale function fontscale( font, value ) return value*fontScale[font] end function scoreboardSortFunction( a, b ) local firstContent, secondContent local sortByA if a[sortBy.what] and type( a[sortBy.what] ) == "table" and sortBy.what == "name" then sortByA = a[sortBy.what][1] else sortByA = a[sortBy.what] end local sortByB if b[sortBy.what] and type( b[sortBy.what] ) == "table" and sortBy.what == "name" then sortByB = b[sortBy.what][1] else sortByB = b[sortBy.what] end if tonumber( sortByA ) then firstContent = tonumber( sortByA ) else if sortByA then firstContent = string.lower( tostring( sortByA ) ) else firstContent = "" end end if tonumber( sortByB ) then secondContent = tonumber( sortByB ) else if sortByB then secondContent = string.lower( tostring( sortByB ) ) else secondContent = "" end end if type( sortBy.dir ) == "number" then if type( firstContent ) == type( secondContent ) then else firstContent = string.lower( tostring( firstContent ) ) secondContent = string.lower( tostring( secondContent ) ) end return iif( sortBy.dir == 1, firstContent > secondContent, firstContent < secondContent ) end return false end function getMaxPerWindow() local sX, sY = guiGetScreenSize() local availableHeight = sY-(seperationSpace*2)-s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then availableHeight = availableHeight-dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then availableHeight = availableHeight-dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end availableHeight = availableHeight-s(3) availableHeight = availableHeight-s(5)-dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ) availableHeight = availableHeight-s(5)-dxGetFontHeight( fontscale(rmbFont, s(0.75)), rmbFont ) availableHeight = availableHeight-s(2) local index = firstVisibleIndex local count = 0 local height = 0 while ( scoreboardContent[index] ) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] if element and isElement( element ) and getElementType( element ) == "team" then height = height + dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) else height = height + dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ) end if height >= availableHeight then return count end index = index + 1 count = count + 1 end return count end function scoreboardClickHandler( button, state, cX, cY ) if scoreboardDrawn and button == "left" and state == "down" then local sX, sY = guiGetScreenSize() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local xMin, xMax, yMin, yMax = topX, topX+calculateWidth(), topY, topY+calculateHeight() local maxPerWindow = getMaxPerWindow() local clickedColumn = false --This var is used if we clicked *anywhere* in the column if cX >= xMin and cX <= xMax and cY >= yMin and cY <= yMax then local clickedOnColumnHeader = false --This var is used if we clicked on the column header itself local x = s(10) local y = s(5)+s(3) if (serverInfo.server or serverInfo.players) and showServerInfo then y = y + dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y + dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end for key, column in ipairs( scoreboardColumns ) do if cX >= topX+x and cX <= topX+x+s(column.width) then clickedColumn = column.name if cY >= topY+y and cY <= topY+y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ) then clickedOnColumnHeader = column.name end end x = x + s(column.width + 10) end if clickedOnColumnHeader then if sortBy.what == clickedOnColumnHeader then -- last click was this column sortBy.dir = sortBy.dir + 2 if sortBy.dir > 1 then sortBy.what = "__NONE__" sortBy.dir = -1 end else sortBy.what = clickedOnColumnHeader sortBy.dir = -1 end forceScoreboardUpdate = true end -- Settings button --[[ local bottomX, bottomY = topX+calculateWidth(), topY+calculateHeight() textLength = dxGetTextWidth( "settings...", fontscale(sbFont, s(sbFontScale)), sbFont ) textHeight = dxGetFontHeight( fontscale(sbFont, s(sbFontScale)), sbFont ) if cX >= bottomX-s(sbOutOffset+2*sbInOffset+2)-textLength and cX <= bottomX-s(sbOutOffset+1) and cY >= bottomY-s(sbOutOffset+2*sbInOffset+1)-textHeight and cY <= bottomY-s(sbOutOffset+1) then if not (windowSettings and isElement( windowSettings ) and guiGetVisible( windowSettings )) then createScoreboardSettingsWindow( sX-323, sY-350 ) elseif isElement( windowSettings ) then destroyScoreboardSettingsWindow() end end]] end -- Scroll buttons if firstVisibleIndex > 1 then if cX >= sX/2-8 and cX <= sX/2-8+17 and cY >= topY-15 and cY <= topY-15+11 then scrollScoreboard( nil, nil, -1 ) end end if firstVisibleIndex+maxPerWindow <= #scoreboardContent and #scoreboardContent > maxPerWindow then if cX >= sX/2-8 and cX <= sX/2-8+17 and cY >= topY+calculateHeight()+4 and cY <= topY+calculateHeight()+4+11 then scrollScoreboard( nil, nil, 1 ) end end -- Player/team click local y = topY+s(5) if (serverInfo.server or serverInfo.players) and showServerInfo then y = y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end if (serverInfo.gamemode or serverInfo.map) and showGamemodeInfo then y = y+dxGetFontHeight( fontscale(serverInfoFont, scoreboardScale), serverInfoFont ) end y = y+s(3) y = y+s(5)+dxGetFontHeight( fontscale(columnFont, scoreboardScale), columnFont ) if cY >= y and cX then local index = firstVisibleIndex local maxPerWindow = getMaxPerWindow() local topX, topY = (sX/2)-(calculateWidth()/2), (sY/2)-(calculateHeight()/2) local width = calculateWidth() while ( index < firstVisibleIndex+maxPerWindow and scoreboardContent[index] ) do local element = scoreboardContent[index]["__SCOREBOARDELEMENT__"] local font = iif( element and isElement( element ) and getElementType( element ) == "team", teamHeaderFont, contentFont ) if cX >= topX+s(5) and cX <= topX+width-s(5) and cY >= y and cY <= y+dxGetFontHeight( fontscale(font, scoreboardScale), font ) then local selected = (not selectedRows[element]) == true local triggered = triggerEvent( "onClientPlayerScoreboardClick", element, selected, cX, cY, clickedColumn ) if triggered then selectedRows[element] = not selectedRows[element] end end y = y + dxGetFontHeight( fontscale(font, scoreboardScale), font ) index = index + 1 end end end end function removeResourceScoreboardColumns( resource ) if resourceColumns[resource] then while resourceColumns[resource][1] do local success = scoreboardRemoveColumn( resourceColumns[resource][1] ) if not success then break end end resourceColumns[resource] = nil end end addEventHandler( "onClientResourceStop", getRootElement(), removeResourceScoreboardColumns ) function scoreboardForceUpdate () bForceUpdate = true return true end function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end
  14. Looney;3

    [AYUDA]Scoreboard+Flags

    Este es un Scoreboard Default donde le agregue codigo para que funcione de manera que consiga los datos representados Mi problema es en las imagenes del Country alguno podria decirme como solucionarlo? Gracias. Client. local players = getElementsByType( "player" ) for key, player in ipairs( players ) do local countryCode = getElementData(player,"country") local flagURL = "client/images/flags/"..countryCode:lower()..".png" if fileExists(flagURL) then dxDrawImage(0.83*sX,((0.12*sY)*key)+y,sX*0.05,sY*0.1,flagURL,0,0,0,tocolor(255,255,255,255),drawOverGUI) end end