player2_dz

p2_checkWepBpSlot

Aug 31st, 2014
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.25 KB | None | 0 0
  1. /*---------------------------------------------------------------------------
  2. p2_checkWepBpSlot
  3.  
  4. Description:
  5. Checks if a weapon with given classname uses the backpack slot of a unit
  6.  
  7. Input: Weapon classname (string)
  8. Output: True if weapon takes backpack slot,
  9. false if weapon does not take backpack slot
  10.  
  11. Useage Instructions:
  12.  
  13.     Add this line in your init.sqf or wherever:
  14.  
  15.     p2_checkWepBpSlot = compile preprocessFileLineNumbers "compile\p2_checkWepBpSlot.sqf";
  16.  
  17.     Then Call it like this for example:
  18.  
  19.     _gun = "M4A1";
  20.     _result = [_gun] call p2_checkWepBpslot;
  21.     if (_result) then {
  22.         diag_log("Warning: Gun " + str(_gun) + " takes backpack slot!");
  23.     } else {
  24.         diag_log("Gun does not take backpackslot!");
  25.     };
  26.  
  27. Author: Player2 (www.ZombZ.net)
  28. ---------------------------------------------------------------------------*/
  29.  
  30.  
  31. private ["_result","_weapon_classname","_weapon_config_typeValue"];
  32. _result = false;
  33. _weapon_classname = _this select 0;
  34. if (!isNil _weapon_classname) then {
  35.     _weapon_config_typeValue = getNumber (configFile >> "CfgWeapons" >> _weapon_classname >> "type");
  36.     if (!isNil _weapon_config_typeValue) then {
  37.         if (_weapon_config_typeValue == 5) then {
  38.             _result = true;
  39.         } else {
  40.             _result = false;
  41.         };
  42.     };
  43. };
  44.  
  45. _result
Advertisement
Add Comment
Please, Sign In to add comment