Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------------------------
- Bullet Check
- Player Fired Event: _this = [unit, weapon, muzzle, mode, ammo, magazine, projectile]
- ---------------------------------------------------------------------------*/
- p2_bulletCheck = {
- if (vehicle player != player) exitWith {};
- _unit = _this select 0;
- _weapon = _this select 1;
- _magazine = _this select 2;
- _projectile = _this select 3;
- _muzzle = _this select 4;
- //Check the speed the velocity is currently travelling
- _currentBulletSpeed = velocity _projectile;
- //Check the max velocity this projectile should be travelling
- _maxBulletSpeed = (getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"));
- {
- if (_x > (_maxBulletSpeed + 50)) then {
- 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])];
- publicVariableServer 'P2DZ_fire';
- [] spawn P2DZ_AHKick;
- };
- } count _currentBulletSpeed;
- //Get the projectile type
- _projectileType = (typeOf (_projectile));
- //Check if the magazine supports that projectile type
- _magAmmoText = (getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"));
- if ({_x == _magAmmoText} count [_projectileType] < 1) exitWith {
- 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])];
- publicVariableServer 'P2DZ_fire';
- [] spawn P2DZ_AHKick;
- };
- //Check if the gun supports that magazine
- _wepMagText = (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"));
- if ({_x == _magazine} count _wepMagText < 1 && !(count (getArray (configFile >> "cfgWeapons" >> _weapon >> "muzzles")) > 1)) exitWith {
- 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])];
- publicVariableServer 'P2DZ_fire';
- [] spawn P2DZ_AHKick;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment