diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:38:09 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:38:09 +0300 |
| commit | a3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch) | |
| tree | a554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Server/Server_VoteForCommander.sqf | |
| download | a2wf_chernarus-main.tar.gz a2wf_chernarus-main.tar.bz2 a2wf_chernarus-main.zip | |
Diffstat (limited to '')
| -rw-r--r-- | Server/Server_VoteForCommander.sqf | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Server/Server_VoteForCommander.sqf b/Server/Server_VoteForCommander.sqf new file mode 100644 index 0000000..6a4d2a4 --- /dev/null +++ b/Server/Server_VoteForCommander.sqf @@ -0,0 +1,38 @@ +Private ['_aibase','_commanderTeam','_comVoteTime','_delay','_side','_sideText'];
+_side = _this select 0;
+_sideText = _side;
+
+_comVoteTime = 'WFBE_VOTETIME' Call GetNamespace;
+WF_Logic setVariable [Format["%1CommanderVoteTime",_sideText],_comVoteTime,true];
+
+while {_comVoteTime > 0} do {
+ sleep 1;
+ _comVoteTime = _comVoteTime - 1;
+ WF_Logic setVariable [Format["%1CommanderVoteTime",_sideText],_comVoteTime,true];
+};
+
+WF_Logic setVariable [Format["%1CommanderVoteTime",_sideText],_comVoteTime,true];
+
+_commanderTeam = [_side] Call GetCommanderFromVotes;
+if (!IsNull _commanderTeam) then {WF_Logic setVariable [Format ["%1CommanderTeam",_sideText],_commanderTeam,true]} else {WF_Logic setVariable [Format ["%1CommanderTeam",_sideText],objNull,true]};
+
+_delay = 0;
+if (_side == East) then {_delay = 1};
+
+sleep _delay;
+
+WFBE_CommanderVote = [_side,'CLTFNCCOMMANDERVOTE',_commanderTeam];
+publicVariable 'WFBE_CommanderVote';
+if (isHostedServer) then {[_side,'CLTFNCCOMMANDERVOTE',_commanderTeam] Spawn HandlePVF};
+
+[Format["WFBE_%1_LastCommander",_sideText],_commanderTeam,true] Call SetNamespace;
+
+_aibase = Format["WFBE_%1_AIBase",_sideText] Call GetNamespace;
+// if (isNull _commanderTeam && paramAIcom && !_aibase) then {[_side] ExecFSM "Server\FSM\aibase.fsm"};
+if (isNull _commanderTeam && paramAIcom && !_aibase) then {[_side] ExecFSM "Server\FSM\aicommander.fsm"};
+
+if (isNull _commanderTeam) then {
+ diag_log Format["[WFBE (INFORMATION)][frameno:%2 | ticktime:%3] Server_VoteForCommander: %1 Commander = AI Commander.",_sideText,diag_frameno,diag_tickTime];
+} else {
+ diag_log Format["[WFBE (INFORMATION)][frameno:%3 | ticktime:%4] Server_VoteForCommander: %1 Commander = %2.",_sideText,name (leader _commanderTeam),diag_frameno,diag_tickTime];
+};
\ No newline at end of file |
