Fabioxps Posted September 25, 2013 Posted September 25, 2013 podiumDisplay = textCreateDisplay () tournamentText = textCreateTextItem ( "Tournament Leaders", 0.45, 0.04, "high", 255, 127, 0, 255, 1.5 ) firstText = textCreateTextItem ( "1st:", 0.45, 0.08, "high", 255, 127, 0, 255, 1.5 ) secondText = textCreateTextItem ( "2nd:", 0.45, 0.12, "high", 255, 127, 0, 255, 1.5 ) thirdText = textCreateTextItem ( "3rd:", 0.45, 0.16, "high", 255, 127, 0, 255, 1.5 ) textDisplayAddText ( podiumDisplay, tournamentText ) textDisplayAddText ( podiumDisplay, firstText ) textDisplayAddText ( podiumDisplay, secondText ) textDisplayAddText ( podiumDisplay, thirdText ) ----------- --/DISPLAYS ----------- newTournament = true --Setup scoreboard and podium scores players = getElementsByType ( "player" ) gameOver = false for k,v in pairs(players) do textDisplayAddObserver ( podiumDisplay, v ) end --------------------------------------------------------------------------------------------- -- /END FALLING BOARD SCRIPT -- --------------------------------------------------------------------------------------------- function getPlayerPos(player) return exports.Race:getPlayerRank(player) end function updateTournamentLeaders() local top3 = {} -- { {player=p, ratio=r}, ... } for k,v in ipairs(players) do playerRank = getPlayerPos(source) wasAdded = false for i=1,#top3 do if playerRank > top3[i] then table.insert(top3,i,{player = v, pos = playerRank}) if #top3 > 3 then table.remove(top3) end wasAdded = true break end end if not wasAdded and #top3 < 3 then table.insert(top3,{player = v, pos = playerRank}) --end end end if ( top3[1] ) then textItemSetText ( firstText, "1st: " .. getPlayerName(top3[1].player) .. " " .. top3[1] ) else textItemSetText ( firstText, "1st:" ) end if ( top3[2] ) then textItemSetText ( secondText, "2nd: " .. getPlayerName(top3[2].player) .. " " .. top3[2] ) else textItemSetText ( secondText, "2nd:" ) end if ( top3[3] ) then textItemSetText ( thirdText, "3rd: "..getPlayerName (top3[3].player).." ".. top3[3] ) else textItemSetText ( thirdText, "3rd:" ) end end function PlayerJoin ( ) updateTournamentLeaders() end addEventHandler ( "onPlayerWasted", getRootElement(), PlayerJoin ) function PlayerQuit ( ) players = getElementsByType ( "player" ) -- Remove the player that is disconnecting for k, player in pairs(players) do if (player == source) then players[k] = nil break end end end addEventHandler ( "onPlayerQuit", root, PlayerQuit ) --function clientStoredBoardInformation () function emptyPodium () textItemSetText ( firstText, "1st:" ) --Avoid double entries on podium textItemSetText ( secondText, "2nd:" ) textItemSetText ( thirdText, "3rd:" ) firstScore = -1 secondScore = -1 thirdScore = -1 end
TheHeadHunter Posted September 25, 2013 Posted September 25, 2013 sory me no help wit ur problem me not knowing wat ur problem eez. GameNet.fi - Nevar Forget
K4stic Posted September 25, 2013 Posted September 25, 2013 Fabioxps you post only the code -.-" Explain please what's is your Problem with it and what errors show the DebugScript 3 Giving a Fuck? Nope, That isn't in My Skill Set
Fabioxps Posted September 25, 2013 Author Posted September 25, 2013 Fabioxps you post only the code -.-" Explain please what's is your Problem with it and what errors show the DebugScript 3 function updateTournamentLeaders() << does not work
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now