Xeno69 / Domination

Domination - A MP mission for Arma 3
84 stars 35 forks source link

Playerscore total gets added to DB instead of score difference on disconnect #32

Closed Auge103 closed 5 years ago

Auge103 commented 5 years ago

Well, I noticed that when I disconnect, the currently shown ingame score gets added to the database score instead of the current difference of scores. This was working in 0.95 which was my last used version.

The issue happens everytime when I go back to the lobby, but the ingame shown score gets only updated after a complete mission restart.
So when I connect with 2000 points in the DB, lose 50 points and disconnect with 1950 points, the database gets a score of 3950 points. And adds an additional 1950 every time I go back to the lobby.

So we have https://github.com/Xeno69/Domination/blob/46b830bb383d91efc93a773055ad684391df37fb/co30_Domination.Altis/x_server/x_f/fn_playerdisconnected.sqf#L48 changed since 0.95 which now allows direct saving of scores. It should be then {_scpl - (_t_ps # 5)} I'll make a merge request in order to fix this issue.

//Edit: Apparently this works when going back to the lobby. ~~But in another instance this didn't work: I loaded into the game on slot 1, got a few points, back to lobby (progress was saved correctly, yay), into slot 2, lost a few points, back to lobby, exit from server. Points got doubled on the DB. Strange indeed. Is there another instance where it modifies the score?~~

Ok, so part 2: Sometimes the _unit is not d_alpha_1 for instance, but a NULL-object . I coulnd't find the root cause for this, but it sometimes happens if you switch slots and reconnect a lot. In this case it just overwrites the first statement and still adds the totalscore to the database. So, it doesn't work at all.

Xeno69 commented 5 years ago

Sometimes the game has problems with variable names (like d_alpha_1) in multiplayer. It can't make a reference to the object for whatever reason (ooooold Arma bug)