player2_dz

Untitled

Feb 7th, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.13 KB | None | 0 0
  1. /*---------------------------------------------------------------------------
  2. Bullet Check
  3.         Player Fired Event: _this = [unit, weapon, muzzle, mode, ammo, magazine, projectile]
  4.  
  5. ---------------------------------------------------------------------------*/
  6. p2_bulletCheck = {
  7.     if (vehicle player != player) exitWith {};
  8.     _unit = _this select 0;
  9.     _weapon = _this select 1;
  10.     _magazine = _this select 2;
  11.     _projectile = _this select 3;
  12.     _muzzle = _this select 4;
  13.  
  14.     //Check the speed the velocity is currently travelling
  15.     _currentBulletSpeed = velocity _projectile;
  16.  
  17.     //Check the max velocity this projectile should be travelling
  18.     _maxBulletSpeed = (getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"));
  19.  
  20.     {
  21.         if (_x > (_maxBulletSpeed + 50)) then {
  22.             P2DZ_fire = format["NAME:   (%1)    UID: (%2)   COMMAND USED:   (%3)    PARAMS USED:    (%4)",name _unit, getPlayerUID _unit, 'Bullet Check: Velocity too High.', ([str _currentBulletSpeed, str _maxBulletSpeed])];
  23.             publicVariableServer 'P2DZ_fire';
  24.             [] spawn P2DZ_AHKick;
  25.         };
  26.     } count _currentBulletSpeed;
  27.  
  28.     //Get the projectile type
  29.     _projectileType = (typeOf (_projectile));
  30.     //Check if the magazine supports that projectile type
  31.     _magAmmoText = (getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"));
  32.  
  33.     if ({_x == _magAmmoText} count [_projectileType] < 1) exitWith {   
  34.         P2DZ_fire = format["NAME:   (%1)    UID: (%2)   COMMAND USED:   (%3)    PARAMS USED:    (%4)",name _unit, getPlayerUID _unit, 'Bullet Check: Bullet Doesnt Match Magazine', ([str _magAmmoText, str _projectileType])];
  35.         publicVariableServer 'P2DZ_fire';
  36.         [] spawn P2DZ_AHKick;
  37.     };
  38.  
  39.     //Check if the gun supports that magazine
  40.     _wepMagText = (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
  41.  
  42.     if ({_x == _magazine} count _wepMagText < 1 && !(count (getArray (configFile >> "cfgWeapons" >> _weapon >> "muzzles")) > 1)) exitWith {
  43.         P2DZ_fire = format["NAME:   (%1)    UID: (%2)   COMMAND USED:   (%3)    PARAMS USED:    (%4)",name _unit, getPlayerUID _unit, 'Bullet Check: Magazine Does not Match Weapon', ([str _magazine, str _wepMagText])];
  44.         publicVariableServer 'P2DZ_fire';
  45.         [] spawn P2DZ_AHKick;
  46.     };
  47. }
Advertisement
Add Comment
Please, Sign In to add comment