.:HyPeX:. Posted March 25, 2014 Share Posted March 25, 2014 Hey guys, i'm setting an ElementData to a team upon me killing someone, and if i suicide its -1. But i reconnected and the data is lost. (All this data setting is done server-side). Any idea why is it lost? (The team is never deleted) Thanks HyPeX Link to comment
Castillo Posted March 25, 2014 Share Posted March 25, 2014 You are setting the data to the team element and not the player? Link to comment
.:HyPeX:. Posted March 25, 2014 Author Share Posted March 25, 2014 You are setting the data to the team element and not the player? Yeah. Link to comment
Castillo Posted March 26, 2014 Share Posted March 26, 2014 Are you sure that none of your scripts is removing the data somehow? does it happen to the team from the player that left the server? Link to comment
.:HyPeX:. Posted March 26, 2014 Author Share Posted March 26, 2014 Are you sure that none of your scripts is removing the data somehow? does it happen to the team from the player that left the server? Yeah, (i'm the only sole guy in the sv, i disconnect and when i come back its gone to 0) Link to comment
Moderators IIYAMA Posted March 26, 2014 Moderators Share Posted March 26, 2014 It must be, element data doesn't change automatic. Unless the teamscore get set at clientside with synchronisation to false, which would be a very strange habit. Link to comment
.:HyPeX:. Posted March 26, 2014 Author Share Posted March 26, 2014 Woops.. carefully reading found this in the middle of the BF3_Core_S script.. i didnt remember to add it thought.. function SetTeamValues() local deaths = 0 local kills = 0 local headshots = 0 local score = 0 for i,v in ipairs(getPlayersInTeam(ATeam)) do kills = getElementData(v, "Kills") deaths = getElementData(v, "Deaths") headshots = getElementData(v, "Headshots") score = kills * 100 end setElementData(ATeam, "Kills","#0046C8Total: "..kills) setElementData(ATeam, "Deaths", "#0046C8Total: "..deaths) setElementData(ATeam, "Headshots", "#0046C8Total: "..headshots) setElementData(ATeam, "Score", "#0046C8Total: "..score) setElementData(ATeam, "FPS", "-") setElementData(ATeam, "Ping", "-") setElementData(ATeam, "Country", "-") end function SetTeamValues2() local deaths = 0 local kills = 0 local headshots = 0 local score = 0 for i,v in ipairs(getPlayersInTeam(BTeam)) do local kills = getElementData(v, "Kills") local deaths = getElementData(v, "Deaths") local headshots = getElementData(v, "Headshots") local score = kills * 100 end setElementData(BTeam, "Kills", "#0046C8Total: "..kills) setElementData(BTeam, "Deaths", "#0046C8Total: "..deaths) setElementData(BTeam, "Headshots", "#0046C8Total: "..headshots) setElementData(BTeam, "Score", "#0046C8Total: "..score) setElementData(BTeam, "FPS", "-") setElementData(BTeam, "Ping", "-") setElementData(BTeam, "Country", "-") end timer = setTimer(SetTeamValues, 1000,0) timer = setTimer(SetTeamValues2, 1000,0) Guess its fixed Link to comment
WhoAmI Posted March 26, 2014 Share Posted March 26, 2014 I'd do this with tables, which is in my opinion better way. With loops this code would have half of his current lines. Link to comment
.:HyPeX:. Posted March 26, 2014 Author Share Posted March 26, 2014 I'd do this with tables, which is in my opinion better way. With loops this code would have half of his current lines. I'll do that once i need to lower down script consuption, and when its ready, for now i prefer easy understading and quick work. Thanks anyways. Link to comment
.:HyPeX:. Posted March 26, 2014 Author Share Posted March 26, 2014 I'd do this with tables, which is in my opinion better way. With loops this code would have half of his current lines. I'll do that once i need to lower down script consuption, and when its ready, for now i prefer easy understading and quick work. Thanks anyways. Link to comment
WhoAmI Posted March 26, 2014 Share Posted March 26, 2014 Don't use timer, use event onElementDataChange instead. If someone get kill you are setting the data, so the event would be triggered. Link to comment
.:HyPeX:. Posted March 26, 2014 Author Share Posted March 26, 2014 Don't use timer, use event onElementDataChange instead. If someone get kill you are setting the data, so the event would be triggered. I'd go with onPlayerWasted instead.. Link to comment
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