Jump to content

Team Data?


.:HyPeX:.

Recommended Posts

Posted

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

gKhdyRJ.png

Posted

You are setting the data to the team element and not the player?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

gKhdyRJ.png

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

gKhdyRJ.png

  • Moderators
Posted

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 

  Tutorials  4x 

 

Posted

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 :lol:

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
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

gKhdyRJ.png

Posted
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

gKhdyRJ.png

Posted
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

gKhdyRJ.png

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...