Skip to content

Commit 636f600

Browse files
committed
Added EventHandler for negative playerRating
When player rating goes below -2000, the player is deemed 'Traitor' and is treated as an enemy by ALL factions and KOS. This EH checks for negative rating (currently below zero) and resets back to zero. If the future rating value is negative, the rating change is set to zero else continues normally. Referencing: #151
1 parent 870b979 commit 636f600

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/INIT.sqf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,23 @@ if (isMultiplayer) then {
4242
};
4343

4444
if (_revive_activated == 1) then {execVM "duws_revive\reviveInit.sqf"};
45+
4546
PlayerKilledEH = player addEventHandler ["killed", {
4647
commandpointsblu1 = commandpointsblu1 - DUWSMP_CP_death_cost;
4748
publicVariable "commandpointsblu1";
4849
}];
50+
51+
PlayerBetrayerEH = player addEventHandler ["HandleRating", {
52+
// If playerRating is negative (traitor) then reset to zero
53+
_playerRating = rating _this select 0;
54+
if (_playerRating < 0) then {
55+
player addRating (0 - _playerRating);
56+
};
57+
// If final rating is positive, do not modify, else zero.
58+
_rating = _this select 1;
59+
[0,_rating] select (_playerRating - _rating) > 0);
60+
}];
61+
4962
"support_specialized_training_available" addPublicVariableEventHandler {lbSetColor [2103, 11, [0, 1, 0, 1]];};
5063
"support_armory_available" addPublicVariableEventHandler {
5164
hq_blu1 addaction ["<t color='#ff0066'>Armory (VA)</t>","bisArsenal.sqf", "", 0, true, true, "", "_this == player"];

0 commit comments

Comments
 (0)