Advertisement
Guest User

teamBalance.sqf

a guest
Jan 29th, 2019
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.81 KB | None | 0 0
  1. //  @file Name: teamBalance.sqf
  2.  
  3. // Teambalancer
  4. _uid = getPlayerUID player;
  5. _teamBal = ["A3W_teamBalance", 1] call getPublicVar;
  6. //donator
  7. waitUntil {(player getVariable ["donator",-1])!=-1};
  8. private _donator = player getVariable "donator";
  9. if (_donator == 1) exitWith
  10.     {
  11.         _text = "Team balancing doesn't apply to donators.";
  12.         [_text, 10] call mf_notify_client;
  13.     };
  14. if (playerSide in [BLUFOR,OPFOR] && _teamBal > 0) then{
  15.     private ["_justPlayers", "_serverCount", "_sideCount"];
  16.     _justPlayers = allPlayers - entities "HeadlessClient_F";
  17.     _serverCount = count _justPlayers;
  18.     _sideCount = playerSide countSide _justPlayers;
  19.     _opposingSide = [BLUFOR, OPFOR] select (playerSide==BLUFOR);
  20.     _opposingCount = _opposingSide countSide _justPlayers;
  21.     if (_serverCount >= 15 && (_sideCount > (_teamBal/100) * _serverCount) && ((_sideCount-_opposingCount)) > 3 ) then{
  22.         if !(_uid call isAdmin) then {
  23.             _kick = true;
  24.             _prevSide = [pvar_teamSwitchList, _uid] call fn_getFromPairs;
  25.             if(!isNil "_prevSide")then{
  26.                 if(_prevSide == playerSide)then{
  27.                     //If player is locked to the side that is unbalanced, move their lock to indie
  28.                     /*pvar_teamSwitchUnlock = _uid;
  29.                     publicVariableServer "pvar_teamSwitchUnlock";
  30.                     pvar_teamSwitchLock = [_uid, INDEPENDENT];
  31.                     publicVariableServer "pvar_teamSwitchLock";*/
  32.                     _kick = false;
  33.                 };
  34.             };
  35.             if(_kick) then {
  36.                 ["TeamBalance",false,1] call BIS_fnc_endMission;
  37.             };
  38.         } else {
  39.             cutText ["You have used your admin to join a stacked team. Only do this for admin duties.", "PLAIN DOWN", 1];
  40.         };
  41.     };
  42. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement