Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _mode = _this select 0;
- //1 : Add Inventory
- //2 : Del Inventory
- //3 : Check Item
- //4 : Check Weight
- //5 : Change Item
- //6 : Change Weight
- //7 : Show Inventory
- //8 : Show Item
- //9 : Show Weight
- //10: Update Item
- //11: Update Inventory
- switch(_mode) do {
- case 1 : {
- _Item = _this select 1;
- _Nbr = _this select 2;
- //3
- if (_Ok)
- then {
- Inventaire pushback [__item,_Nbr]//finir poids
- true;
- } else {
- false;
- };
- };
- case 2 : {
- _Item = _this select 1;
- _Nbr = _this select 2
- //3
- if (_Ok)
- then {
- {
- if ((_x select 0) isEqualto _Item)
- then {
- Inventaire - _x;
- true;
- };
- } forEach Inventaire
- } else {
- false;
- };
- };
- case 3:{
- _Item =_this select 1;
- _Nbr =_this select 2;
- if (_Item in Inventaire)
- then {
- _a = Inventaire find _Item;
- if ((a select 1) >= _Nbr)
- then {
- true;
- } else {
- false;
- };
- } else {
- false;
- };
- };
- case 4 : {
- _Weight =_this select 1;
- if (_Weight + ((Inventaire select 0) select 0)) <= ((Inventaire select 0) select 1)) && (((Inventaire select 0) select 0) + _Weight >= 0))
- then {
- true;
- } else {
- false;
- };
- };
- case 5 : {
- _Item = _this select 1;
- _Nbr = _this select 2;
- //3
- if (_Ok)
- then {
- _index = Inventaire find _Item;
- _a = Inventaire select _index;
- if ((_a select 1) + _Nbr >= 0)
- then {
- if ((_a select 1) + _Nbr isEqualto 0)
- then {
- //2
- } else {
- _a set[1,(_a select 1) + _Nbr];
- Inventaire set [_index,_a];
- true;
- };
- } else {
- false ;
- };
- } else {
- false;
- };
- };
- case 6 :{
- _Weight = _this select 1;
- //4
- if (_Ok)
- then {
- Inventaire set [0,[((Inventaire select 0)select 0) + _Nbr,((Inventaire select 0)select 1)]];
- true;
- } else {
- false;
- };
- };
- case 7 :{
- _return = Iventaire - (Inventaire select 0);
- _return;
- };
- case 8 :{
- _Item = _this select 1;
- //3
- if (_Ok)
- then {
- _index = Inventaire find _Item;
- _a = Inventaire select _index;
- _a;
- } else {
- false;
- };
- };
- case 9 :{
- _Weight = Inventaire select 0;
- _Weight;
- };
- case 10:{
- _Item =_this select 1;
- //Val
- (_Val select 0) ;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement