EpochModTeam / DayZ-Epoch

Experimental DayZ Mod for Arma 2
http://epochmodteam.github.io/DayZ-Epoch
227 stars 398 forks source link

Localised Global Variable Issue #2045

Closed IsGoose closed 4 years ago

IsGoose commented 4 years ago

The r_player_bloodTotal variable is local to client (set in variables.sqf - https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_code/init/variables.sqf#L190)

But it is also needed on the server when server_playerSync is called: https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/compile/server_playerSync.sqf#L109 https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_code/init/compiles.sqf#L757-L789

EDIT: this causes the players blood to save as "any" in the database.

worldwidesorrow commented 4 years ago

Good eye. That variable shouldn't be used there for a default. The client sends the server the information to set the USEC_BloodQty variable every 10 seconds and sets the variable for itself here: https://github.com/EpochModTeam/DayZ-Epoch/blob/0c2080552489c7050f69533e888e1eeb2bf88b10/SQF/dayz_code/system/scheduler/sched_medical.sqf#L8-L12

The global variable does not get updated server side with any functions. The default value should be the value stored in the original variable, which is 12000.

IsGoose commented 4 years ago

I only managed to recreate this by spawning a new character, then logging out, which synced the characters blood level to "any" since it defaulted to r_player_blood which was not defined on the server when calling player_sumMedical

worldwidesorrow commented 4 years ago

Fixed here, thanks. https://github.com/EpochModTeam/DayZ-Epoch/commit/e96be4b484e1920bb5b05de90be93986c2351715