diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:24 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:24 +0300 |
| commit | 628d33984d9228f1781d13a65fbb80f35facc899 (patch) | |
| tree | cd909141f87e14f22c3511549a9bc067d9ff8b50 /Client/GUI/GUI_Menu_Voting.sqf | |
| download | a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.tar.gz a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.tar.bz2 a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.zip | |
init
Diffstat (limited to 'Client/GUI/GUI_Menu_Voting.sqf')
| -rw-r--r-- | Client/GUI/GUI_Menu_Voting.sqf | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Client/GUI/GUI_Menu_Voting.sqf b/Client/GUI/GUI_Menu_Voting.sqf new file mode 100644 index 0000000..987f40e --- /dev/null +++ b/Client/GUI/GUI_Menu_Voting.sqf @@ -0,0 +1,75 @@ +MenuAction = -1; //added-MrNiceGuy - Benny`s solution
+
+_voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+if (_voteTime <= 0) exitWith {};
+
+_name = "";
+_lastTeams = [];
+_lastTeam = -2;
+
+_lastVotes = [sideJoined] Call GetCommanderVotes;
+
+while {true} do {
+ sleep 0.1;
+
+ if (!(alive player) || Side player != sideJoined) exitWith {CloseDialog 0;_exit = true};
+ if !(dialog) exitWith {};
+
+ _commanderTeam = [sideJoined] Call GetCommanderFromVotes;
+ if (IsNull _commanderTeam) then {_name = Localize "STR_WF_AI"} else {_name = name leader _commanderTeam};
+
+ _voteTime = WF_Logic getVariable Format ["%1CommanderVoteTime",sideJoinedText];
+ ctrlSetText [10007,Format ["%1",_name]]; //changed-MrNiceGuy
+ ctrlSetText [10008,Format ["%2: %3",_name,Localize "STR_WF_VOTING_TimeLeft",_voteTime]]; //added-MrNiceGuy
+
+ if (_voteTime <= 0) exitWith {CloseDialog 0};
+
+ _refresh = false;
+ _playerSlots = [];
+ {
+ if !(isNil '_x') then {if (isPlayer (leader _x)) then {_playerSlots = _playerSlots + [_x]}};
+ } forEach clientTeams;
+
+ _count = 0;
+ _votes = [sideJoined] Call GetCommanderVotes;
+
+ {if (_x != (_votes Select _count)) then {_refresh = true};_count = _count + 1} ForEach _lastVotes;
+ {if !(_x In _lastTeams) then {_refresh = true}} ForEach _playerSlots;
+ {if !(_x In _playerSlots) then {_refresh = true}} ForEach _lastTeams;
+
+ if (_refresh) then {
+
+ _reselect = false;
+ _selected = lbCurSel 10006;
+ _selectedTeam = lbValue[10006,_selected];
+ _selectedText = lbText[10006,_selected];
+ _lastVotes = _votes;
+
+ if (_selected != -1) then {_reselect = true};
+
+ lbClear 10006;
+ _AI = lbAdd[10006,Format["%1 %2",_votes select 0,Localize "STR_WF_AI"]];
+ lbSetValue [10006,_AI,-1];
+
+ _count = 0;
+ _total = 1;
+
+ {
+ if !(isNil '_x') then {if (_x In _playerSlots) then {_total = _total + 1;_selection = lbAdd[10006,Format ["%1 %2",_votes select _count+1,name (leader _x)]];lbSetValue [10006,_selection,_count]}};_count = _count + 1;
+ } forEach clientTeams;
+ _lastTeams = +_playerSlots;
+
+ if (_reselect) then {
+ _selected = 0;
+ for [{_count = 0},{_count < _total},{_count = _count + 1}] do {if (lbValue[10006,_count] == _selectedTeam) then {_selected = _count}};
+ lbSetCurSel[10006,_selected];
+ };
+ };
+
+ _selected = lbCurSel 10006;
+ if (_selected != -1) then {
+ _selectedTeam = lbValue[10006,_selected];
+ if (_selectedTeam != _lastTeam) then {Call Compile Format["%1Team%2Vote = _selectedTeam;publicVariable '%1Team%2Vote';",sideJoinedText,clientID]};
+ _lastTeam = _selectedTeam;
+ };
+};
\ No newline at end of file |
