Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Suicide Count #124

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Changed Suicide Count
Also the way the event handler is used has changed.
  • Loading branch information
y0014984 committed Jun 26, 2019
commit 81d6e0874cff613d866c36e59c89ddd5b91da9db
2 changes: 1 addition & 1 deletion addons/pps_main/functions/fn_animalInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (isMultiplayer) then

_killerUid = getPlayerUID _killer;

if (_killerUid != "") then
if (_killerUid != "" && PPS_AllowSendingData && PPS_SendingInfantryData) then
{
_playerUid = _killerUid;
_source = "A3";
Expand Down
90 changes: 34 additions & 56 deletions addons/pps_main/functions/fn_unitInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,82 +29,60 @@ if (isMultiplayer) then
{
params ["_unit", "_killer", "_instigator", "_useEffects"];

if (local _unit) then
{
_unit removeAllEventHandlers "HitPart";
_unit removeAllEventHandlers "HitPart";

_unitUid = getPlayerUID _unit;
_killerUid = getPlayerUID _killer;

if (getClientState == "BRIEFING READ" && PPS_AllowSendingData && PPS_SendingInfantryData) then
{
_source = "A3";
_value = 1;
_type = 2;
_formatType = 0;

_unitUid = getPlayerUID _unit;
_killerUid = getPlayerUID _killer;
_playerUid = "";
_key = "";
_formatString = "";

if (local _unit) then
if (_killerUid == _unitUid) then
{
_playerUid = _killerUid;
_key = "countPlayerSuicides";
_formatString = "STR_PPS_Main_Statistics_Count_Player_Suicides";
}
else
{
if (getClientState == "BRIEFING READ" && PPS_AllowSendingData && PPS_SendingInfantryData) then
switch (true) do
{
if (_unitUid != "") then
case (_unitUid != ""):
{
_playerUid = _unitUid;
_source = "A3";
_key = "countPlayerDeaths";
_value = 1;
_type = 2;
_formatType = 0;
_formatString = "STR_PPS_Main_Statistics_Count_Player_Deaths";

_updatedData = [_playerUid, [[_key, _value, _type, _formatType, _formatString, _source]]];
_update = _playerUid + "-updateStatistics";
missionNamespace setVariable [_update, _updatedData, false];
publicVariableServer _update;
};

if (_killerUid != "") then
case ((_unitUid == "") && (_killerUid != "") && ((side group _unit) != (side group _killer))):
{
_playerUid = _killerUid;
_source = "A3";
_key = "countPlayerKills";
_value = 1;
_type = 2;
_formatType = 0;
_formatString = "STR_PPS_Main_Statistics_Count_Player_Kills";

_updatedData = [_playerUid, [[_key, _value, _type, _formatType, _formatString, _source]]];
_update = _playerUid + "-updateStatistics";
missionNamespace setVariable [_update, _updatedData, false];
publicVariableServer _update;
_formatString = "STR_PPS_Main_Statistics_Count_Player_Kills";
};

if (_killerUid == _unitUid) then
case ((_killerUid != "") && ((side group _unit) == (side group _killer))):
{
_playerUid = _killerUid;
_source = "A3";
_key = "countPlayerSuicides";
_value = 1;
_type = 2;
_formatType = 0;
_formatString = "STR_PPS_Main_Statistics_Count_Player_Suicides";

_updatedData = [_playerUid, [[_key, _value, _type, _formatType, _formatString, _source]]];
_update = _playerUid + "-updateStatistics";
missionNamespace setVariable [_update, _updatedData, false];
publicVariableServer _update;
};

if (_killerUid != _unitUid && _killerUid != "" && ((side group _unit) == (side group _killer))) then
{
_playerUid = _killerUid;
_source = "A3";
_key = "countPlayerTeamKills";
_value = 1;
_type = 2;
_formatType = 0;
_formatString = "STR_PPS_Main_Statistics_Count_Player_Team_Kills";

_updatedData = [_playerUid, [[_key, _value, _type, _formatType, _formatString, _source]]];
_update = _playerUid + "-updateStatistics";
missionNamespace setVariable [_update, _updatedData, false];
publicVariableServer _update;
};
};
};

if (_playerUid != "") then
{
_updatedData = [_playerUid, [[_key, _value, _type, _formatType, _formatString, _source]]];
_update = _playerUid + "-updateStatistics";
missionNamespace setVariable [_update, _updatedData, false];
publicVariableServer _update;
};
};
}];

Expand Down