Guest User

Untitled

a guest
Apr 20th, 2013
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. count player magazines with ammo count
  3. value = call player_countmagazines;
  4. return all player magazines with ammo count
  5. */
  6. private ["_dialog","_control","_magazineArray","_item","_val","_max","_created"];
  7. disableSerialization;
  8. disableUserInput true;
  9. _dialog = findDisplay 106;
  10. _created = false;
  11. if ( isNull _dialog ) then {
  12. //startLoadingScreen [""];
  13. createGearDialog [player, "RscDisplayGear"];
  14. _dialog = findDisplay 106;
  15. _created = true;
  16. };
  17.  
  18. _magazineArray = [];
  19. for "_i" from 109 to 120 do
  20. {
  21. _control = _dialog displayCtrl _i;
  22. _item = gearSlotData _control;
  23. _val = gearSlotAmmoCount _control;
  24. _max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
  25. if (_item != "") then {
  26. if (_val != _max) then {
  27. _magazineArray set [count _magazineArray,[_item,_val]];
  28. } else {
  29. _magazineArray set [count _magazineArray,_item];
  30. };
  31. };
  32. };
  33.  
  34. for "_i" from 122 to 129 do
  35. {
  36. _control = _dialog displayCtrl _i;
  37. _item = gearSlotData _control;
  38. _val = gearSlotAmmoCount _control;
  39. _max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
  40. if (_item != "") then {
  41. if (_val != _max) then {
  42. _magazineArray set [count _magazineArray,[_item,_val]];
  43. } else {
  44. _magazineArray set [count _magazineArray,_item];
  45. };
  46. };
  47. };
  48. if ( _created ) then {
  49. closeDialog 0;
  50. //endLoadingScreen;
  51. };
  52. disableUserInput false;
  53. dayz_Magazines=_magazineArray;
  54. _magazineArray
RAW Paste Data