SOLVED. I added a table to the DB and now it doesn't load the account.

  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 77
  • Editor de Profesión - ArmA III Admin from Cuba
this was something that I avoided as much as possible; but the circumstances force me to experiment and learn to modify the DB sooner or later.
@agentRev had already suggested that need by adding the BackpackOnChest addon to the ArmA3_A3Wasteland; but I refused and now here I am.
the thing is, I added three new tables to "playersave": backpackonchest (string), backpackonchestitem (array) and backpackonchestmags (array).
and I gave identical properties to the tables that contain similar elements, that is, the same characteristics of the backpack table for the backpackonchest table, the same for backpackitems and backpackmagazines.
in the getplayerdata.sqf file I added the code
Code: [Select]
_zade_backpack = [_player] call zade_boc_fnc_chestpack;
_zade_backpackItem= [_player, false] call zade_boc_fnc_chestpackItem;
_zade_backpackMags = [_player] call zade_boc_fnc_chestpackMagazines;
{ _data pushBack _x } forEach
[ [ "Backpackonchest", _zade_backpack],
[ "Backpackonchestitem", _zade_backpackitem],
[ "Backpackonchestmags", _zade_backpackmags] ];

I also added
Code: [Select]
["Backpackonchest", "STRING"] call _getValue;

["Backpackonchestitem", "ARRAY"] call _getValue;

["Backpackonchestmags", "ARRAY"] call _getValue;

in the default\LoadAccount.sqf file

And
Code: [Select]
"Backpackonchest",
"Backpackonchestitem",
"Backpackonchestmags",

in the extDB\LoadAcount.sqf file; the one who says "the order of these values is EXTREMELY IMPORTANT!"

All this worked perfectly to save the info correctly in the Database, but does not apply it to the player

Now, in the applyplayerdata.sqf file I put:

Code: [Select]
Case "Backpackonchest": { if (_value !="") then { [player, _value] call zade_boc_fnc_addChestpack } };

Case "Backpackonchestitem": { { if (_value !="") then { [player, _x] call zade_boc_fnc_addChestpack } forEach _value } };

Case "Backpackonchestmags": { { if (_value !="") then { [player, _x] call zade_boc_fnc_addMagToChestpack } forEach _value } };
But it does not work. the client stays on the Loading Preview Location screen forever
Please, help!

by the way, absolutely nothing related appears in the .rpt file. Everything seems to be normal.


(Note, I used Google Translate to create this post, and I wrote the codes manually here, they are not copy and paste from the actual files, because I'm using my phone rigth now)
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 77
  • Editor de Profesión - ArmA III Admin from Cuba

Re: I added a table to the DB and now it doesn't load the account.

« Reply #1 posted: Oct 28, 2019, 04:48 PM »
update:
I needed a few semicolons on a cople of line of the ApplyPlayerData.sqf file, and now the client starts well.

BUT, although it is loading well the backpack-on-chest, not the items and magazines. I know that the backpack works, but it appears empty when reconnecting to the server.

so I guess what I have to work on is the two lines that read the DB and apply the items and magazines to the players.

the array of the items and magazines of this addon in the DB are identical to the current arrays for saving backpackitem and backpackmags; the same as the way to write the classname of the backpacks, in the current database; so I assume that the way to call the functions zade_cod_fnc_additemtobackpack and zade_cod_fnc_addmagstobackpack are similar if not identical to the current method (with its obvious differences). no?

I realy need some help here
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 77
  • Editor de Profesión - ArmA III Admin from Cuba

Re: I added a table to the DB and now it doesn't load the account.

« Reply #2 posted: Oct 28, 2019, 07:44 PM »
update:

I already found the problem and I don't know how to fix it.

the error is that the function 'zade_boc_fnc_chestpackitems' returns an array with the format
Code: [Select]
["item", "item", "item", "item2", "item2", "item3", "item3"];
 but the function 'zade_boc_fnc_addItemToChest' needs the array in a format
 
Code: [Select]
[["item", 3], ["item2",2], ["item3",2]];
to effectively add the items to the chest bag.

What should I do to save the array in that format in DB to be able to restore it correctly?
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.
  • Offline Animatek
  • SNET Admin
  • First Blood
  • ***
  • Posts: 77
  • Editor de Profesión - ArmA III Admin from Cuba

Re: I added a table to the DB and now it doesn't load the account.

« Reply #3 posted: Oct 28, 2019, 09:04 PM »
resolved.

In the ApplyPlayerData.sqf file I wrote, taken from the addon code itself:

Code: [Select]
case "BackpackOnChestItem": {
{
if (typeName _x is EqualTo "STRING") then {
[player, _x] call zade_boc_fnc_addItemToChestpack;
} else {
private _itemclass = _x select 0;
private _itemAmount = _x select 1;
 [player, Itemclass, itemamount] call zade_boc_fnc_additemtochestpack;
};
} forEach _value;
};



And it works perfectly. Thank you all for reading. so whoever wants to use DerZade's Backpack On Chest addon, already knows what to do to add it to ArmA3 A3Wasteland and have persistence.
Soy administrador de ArmA III en una intranet en Cuba. No tengo experiencia en códigos ni programación, pero con ayuda he logrado un servicio eficiente y duradero, todo offline y sin internet.