Jump to content
SoulStalker

Help to Tweak to the Hackers Mission

Recommended Posts

Looking for a piece of code that will prevent money being taken from players in the same INDEPENDENT group.

Currently members in the same independent group lose money from there bank accounts when the hackers is completed by a member of the same group, not ideal.

 

I think the code works for BLUFOR and OPFOR with the inclusion of the if - else script below

 

I know the default section below needs a similar conditional if - else script to determine if players are in the same group and not to take money from their bank accounts, but just not sure how to code it.

 

I can only hazard a guess at something like this  if  (side _x == INDEPENDENT && ? ) then {} where the ? is the missing piece of code

 

Any help would be appreciated, Thanks

 



// Give Reward to the hacker
      _totalMoney = 0;
      _playerSide = side player;
      switch (_playerSide) do {
      
   case BLUFOR: 
   {   
      {    
         if (isPlayer _x) then {
         if  (side _x == BLUFOR) then {}
         else {
         _bmoney = _x getVariable ["bmoney",0];
         if ( _bmoney > 0 ) then { //might as well check for zero's
         _fivePercent = round(0.035*_bmoney);
         _x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
         [] spawn fn_savePlayerData;
         _totalMoney = _totalMoney + _fivePercent;
      }
         }
            }
      } forEach playableUnits;
   }; 
   
   case OPFOR: 
   {   
      {    
         if (isPlayer _x) then {
         if  (side _x == OPFOR) then {}
         else {
         _bmoney = _x getVariable ["bmoney",0];
         if ( _bmoney > 0 ) then { //might as well check for zero's
         _fivePercent = round(0.035*_bmoney);
         _x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
         [] spawn fn_savePlayerData;
         _totalMoney = _totalMoney + _fivePercent;
      }
         }
            }   
      } forEach playableUnits;
   };       
   default
   {
      {    
         if (isPlayer _x) then {
         _bmoney = _x getVariable ["bmoney",0];
         if ( _bmoney > 0 ) then { //might as well check for zero's
         _fivePercent = round(0.035*_bmoney);
         _x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
         [] spawn fn_savePlayerData;
         _totalMoney = _totalMoney + _fivePercent;
      }
         }
      } forEach playableUnits;
   
         }; 
                     };
         
         if (_totalMoney > 1850000) then {
         player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + _totalMoney, true];
         [] spawn fn_savePlayerData;
         systemChat format["You have hacked players bank accounts to the value of $%1",_totalMoney];   
         }
      else    {
         player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + 1850000, true];
         [] spawn fn_savePlayerData;
         systemChat format["You have hacked players bank accounts to the value of $1.250.000"];            
            };
         };
               
         ctrlSetText [ 8002, format [ "%1 kb/s", _dlRate ] ];      
         ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];            
         
         sleep 1;
      };
      
      T8_varDiagAbort = false;
      
      closeDialog 0;

      _laptop setVariable [ "InUse", false, true];   
   };
};

downloadDataDONE = true;



this is the code from the hacking of the laptop, need to change it so it doesnt take money from members of the same group.

thanks

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×