.:HyPeX:. Posted March 14, 2014 Posted March 14, 2014 Game-state doesnt recognize player's score, help? Score setting: function CountScores() local ATeam = getTeamFromName(TeamA) local BTeam = getTeamFromName(TeamB) local APlayers = getPlayersInTeam(ATeam) local BPlayers = getPlayersInTeam(BTeam) ScoreAPoints = 0 ScoreBPoints = 0 Winner = nil for i, v in ipairs(APlayers) do if not getElementData(v,"Kills") then setElementData(v, "Kills", 0) end Kills = getElementData(v, "Kills") setPlayerAnnounceValue(v, "Score", Kills * 100) ScoreAPoints = ScoreAPoints + getElementData(v, "Kills") setElementData(v, "Score", Kills * 100) end for i, v in ipairs(BPlayers) do if not getElementData(v,"Kills") then setElementData(v, "Kills", 0) end Kills = getElementData(v, "Kills") setPlayerAnnounceValue(v, "Score", Kills * 100) setElementData(v, "Score", Kills * 100) ScoreBPoints = ScoreBPoints + getElementData(v, "Kills") end if ScoreAPoints > ScoreBPoints then Winner = ATeam elseif ScoreBPoints > ScoreAPoints then Winner = BTeam end return Winner, ScoreAPoints, ScoreBPoints end function CountCurrent() local Winner, TeamAPoints, TeamBPoints = CountScores() triggerClientEvent("SetCurrent", getRootElement(), TeamAPoints, TeamBPoints) end timer = setTimer(CountCurrent, 1000, 0)
.:HyPeX:. Posted March 15, 2014 Author Posted March 15, 2014 Is TeamA and TeamB defined somewhere? Yes, everything works perfectly (i get the total scores client-side displayed), but announce is kinda not working.
Moderators Citizen Posted March 15, 2014 Moderators Posted March 15, 2014 you have to use the key "score" with a minus s
.:HyPeX:. Posted March 15, 2014 Author Posted March 15, 2014 you have to use the key "score" with a minus s Thanks!, i'll check out later it it works
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