.:HyPeX:. Posted March 25, 2014 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 My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Castillo Posted March 25, 2014 Posted March 25, 2014 You are setting the data to the team element and not the player? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
.:HyPeX:. Posted March 25, 2014 Author Posted March 25, 2014 You are setting the data to the team element and not the player? Yeah. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Castillo Posted March 26, 2014 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? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
.:HyPeX:. Posted March 26, 2014 Author 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) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Moderators IIYAMA Posted March 26, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
.:HyPeX:. Posted March 26, 2014 Author 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 My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
WhoAmI Posted March 26, 2014 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.
.:HyPeX:. Posted March 26, 2014 Author 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
.:HyPeX:. Posted March 26, 2014 Author 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
WhoAmI Posted March 26, 2014 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.
.:HyPeX:. Posted March 26, 2014 Author 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.. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
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