Julian09123 Posted May 13, 2016 Share Posted May 13, 2016 Hola, amigos tengo este codigo el cual anda bien pero quiero que al que no haya nadie en el tab, se salga el team osea el nombre, como podria hacerlo? function createAdminTeamOnStart () team = createTeam ( "uR# Underground Riders", 81, 91, 111 )-- create a new team and named it 'Admin' end addEventHandler("onResourceStart", resourceRoot, createAdminTeamOnStart) -- add an event handler function setAdminTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("#uR")) then setPlayerTeam(source, team) end end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) -- add an event handler function getOutFromTeam() if source then setPlayerTeam(source, nil) end end addEventHandler("onPlayerLogout",getRootElement(),getOutFromTeam) Link to comment
Tomas Posted May 13, 2016 Share Posted May 13, 2016 Linea ~400, dxscoreboard_client: if column.name == "name" then local teamName = getTeamName( team ) local teamMemberCount = #getPlayersInTeam( team ) if (teamMemberCount == 0) then return end 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 Link to comment
Julian09123 Posted May 13, 2016 Author Share Posted May 13, 2016 Que se supone que haga? Aca esta la linea 400, y ahora? http://oi63.tinypic.com/2elw6fr.jpg Link to comment
Castillo Posted May 13, 2016 Share Posted May 13, 2016 Queres que los teams no aparezcan si no tienen jugadores? Link to comment
Tomas Posted May 13, 2016 Share Posted May 13, 2016 Que se supone que haga? Aca esta la linea 400, y ahora? http://oi63.tinypic.com/2elw6fr.jpg Entonces está editada, busca: " column.name == 'Team' ", y agrega debajo de la variable teamMemberCount: if (teamMemberCount == 0) then return end Link to comment
Julian09123 Posted May 13, 2016 Author Share Posted May 13, 2016 Sigue apareciendo -- 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" ) if (teamMemberCount == 0) then return end 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 Link to comment
Tomas Posted May 14, 2016 Share Posted May 14, 2016 local teamMemberCount = #getPlayersInTeam( team ) if (teamMemberCount == 0) then return end Justo debajo de esa. Link to comment
Julian09123 Posted May 15, 2016 Author Share Posted May 15, 2016 Le di restart y abre el rectangulo del scoreboard y no sale nada solo lo negro osea, le doy /logout y sale todo negro Link to comment
Tomas Posted May 15, 2016 Share Posted May 15, 2016 Le di restart y abre el rectangulo del scoreboard y no sale nada solo lo negroosea, le doy /logout y sale todo negro No estás modificando la linea del team, debes estar tocando otra. Link to comment
Julian09123 Posted May 21, 2016 Author Share Posted May 21, 2016 Tengo estas lineas 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 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 ) else content = getElementData( player, column.name ) end Link to comment
Recommended Posts