Advertisement
InnovativeStudios

fn_loadPlayer.sqf

Jan 14th, 2023
2,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.67 KB | None | 0 0
  1. span class="re5"> params ["_items", "_clothes", "_weapons", "_position", "_cash", "_bank", "_bankAccount"];
  2.  
  3. player setPosATL _position;
  4.  
  5. removeAllItems player;
  6. removeAllContainers player;
  7. removeAllWeapons player;
  8. removeAllAssignedItems player;
  9. removeUniform player;
  10. removeVest player;
  11. removeBackpack player;
  12. removeHeadgear player;
  13.  
  14. if ((count _weapons) > 0) then {
  15.     {
  16.         switch (_x select 0) do {
  17.             case 0: {
  18.                 player addWeapon (_x select 1);
  19.                 player addPrimaryWeaponItem ((_x select 2) select 0);
  20.                 {player addPrimaryWeaponItem _x;} count (_x select 3);
  21.                 player setAmmo [primaryWeapon player, (_x select 4)];
  22.             };
  23.             case 1: {
  24.                 player addWeapon (_x select 1);
  25.                 player addSecondaryWeaponItem ((_x select 2) select 0);
  26.                 {player addSecondaryWeaponItem _x;} count (_x select 3);
  27.                 player setAmmo [secondaryWeapon player, (_x select 4)];
  28.             };
  29.             case 2: {
  30.                 player addWeapon (_x select 1);
  31.                 player addHandgunItem ((_x select 2) select 0);
  32.                 {player addHandgunItem _x;} count (_x select 3);
  33.                 player setAmmo [handgunWeapon player, (_x select 4)];
  34.             };
  35.         };
  36.     } forEach _weapons;
  37. };
  38.  
  39. player addUniform (_clothes select 0);
  40. player addVest (_clothes select 1);
  41. player addBackpack (_clothes select 2);
  42. player addHeadgear (_clothes select 3);
  43.  
  44. {player addItemToUniform _x} count (_items select 0);
  45. {player addItemToVest _x} count (_items select 1);
  46. {player addItemToBackpack _x} count (_items select 2);
  47. {player addItem _x; player assignItem _x} count (_items select 3);
  48.  
  49. player setVariable ["cash", _cash, true];
  50. player setVariable ["bank", _bank, true];
  51. player setVariable ["bankAccount", _bankAccount, true];
  52. player setVariable ["loadedIn", true, true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement