Jump to content

The inidbi2 public variable is overwritten!

Recommended Posts

I used the example in


but it is normal when I go in, but when new players enter the server, they will all remove the equipment and cycle through the equipment. How to solve this?

After the player enters, all players are naked!

How can I solve this problem?


  waitUntil {time > 0};
// --------------------------------------------------------------------checking the database-----------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------
"un_database_check" addPublicVariableEventHandler {
private ["_packet"];
  _packet = _this select 1;
  _dataplayrowner = _packet select 0;
  _dataplayrname = _packet select 1;
  _dataplayruid = _packet select 2;
  _datanamearray = format ["%1_%2_mycustommissionname", _dataplayrname, _dataplayruid];
  _databasename = _datanamearray;
  _inidbiUN = ["new", _databasename] call OO_INIDBI;
  _databasefind = "exists" call _inidbiUN;
// ------------------------------------------------------cant find the database saveing new players name and uid---------------------------------------------------
  if (!_databasefind) then {
  ["write", ["INFO", "Name", _dataplayrname]] call _inidbiUN;
  ["write", ["INFO", "UID", _dataplayruid]] call _inidbiUN;
  "welcome new spawn" remoteExec ["hint"];
// --------------------------------------------------------found the database now loading data to send to player---------------------------------------------------
  if (_databasefind) then {
  "found the database" remoteExec ["hint"];
    _readpos = ["read", ["POSITION", "Position", []]] call _inidbiUN;   
    _readdir = ["read", ["POSITION", "Direction", ""]] call _inidbiUN;
    _readdamage = ["read", ["INFO", "Health", ""]] call _inidbiUN;
    _readloadout = ["read", ["GEAR", "Loadout", []]] call _inidbiUN;
    un_database_load = [_readpos,
    _dataplayrowner publicVariableClient "un_database_load";
  un_database_check = nil;
// --------------------------------------------------player sent save game data to server - saving it to database--------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------
"un_database_save" addPublicVariableEventHandler {
private ["_packet"];
    _packet = _this select 1;
    _datanamearray = format ["%1_%2_mycustommissionname", _packet select 0, _packet select 1];
    _databasename = _datanamearray;
    _inidbiUN = ["new", _databasename] call OO_INIDBI;
    ["write", ["INFO", "Name", _packet select 0]] call _inidbiUN;
    ["write", ["INFO", "UID", _packet select 1]] call _inidbiUN;
    ["write", ["POSITION", "Position", _packet select 2]] call _inidbiUN;
    ["write", ["POSITION", "Direction", _packet select 3]] call _inidbiUN;
    ["write", ["INFO", "Health", _packet select 4]] call _inidbiUN;
    ["write", ["GEAR", "Loadout", _packet select 5]] call _inidbiUN;
    "Progress Saved" remoteExec ["hint"];
// MrJizz - Factionfinderdotcom

  waitUntil {time > 10};
// -------------------------------------------------------send name and uid to server to check for database--------------------------------------------------------
if (!isNil "un_database_check") then {
un_database_check = nil;
sleep 1;
if (isNil "un_database_check") then {
_dataplayrowner = clientOwner;
_dataplayrname = profileName;
_dataplayruid = getPlayerUID player;
un_database_check = [_dataplayrowner,_dataplayrname,_dataplayruid];
publicVariableServer "un_database_check";
// ------------------------------------------------------server found database and now sent us the data to load----------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------
"un_database_load" addPublicVariableEventHandler {
private ["_ppacket"];
  _ppacket = _this select 1;
  _readpos = _ppacket select 0;
  _readdir = _ppacket select 1;
  _readdamage = _ppacket select 2;
  _readloadout = _ppacket select 3;
  _passtheparcel = [_readpos,
  _Null = _passtheparcel call FN_loaddata;
// -----------------------------------------------applying the data sent to player - magazine loaded work around-------------------------------------------------
FN_loaddata = {
params ["_readpos",
hint "all your shit has loaded";
// Clear player gear
  removeAllAssignedItems player;
  removeAllItems player;
  clearAllItemsFromBackpack player;
  removeBackpack player;
  removeUniform player;
  removeVest player;
  removeHeadgear player;
  removeGoggles player;
  removeAllWeapons player;
  removeAllPrimaryWeaponItems player;
  removeAllHandgunItems player;
  cash = 0;
  killcount = 0; 
// Add player gear
  player setPosATL _readpos;
  player setDir _readdir;
  player setDamage _readdamage;
  player setUnitLoadout _readloadout;
  un_database_load = nil;
  publicVariable "un_database_load";
// ---------------------------------------------------------request to save game - send data to server-------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------
UN_savedata = {
_dataplayrname = profileName;
_dataplayruid = getPlayerUID player;
_dataplayrpos = getPosATL player;
_dataplayrdir = direction player;
_dataplayrdamage = damage player;
_dataplayrloadout = getUnitLoadout player;
un_database_save = [_dataplayrname,
publicVariableServer "un_database_save";
hint "saveing game";
// ------------------------------------------------------------addaction to player to save data--------------------------------------------------------------------
player addAction ["<t color='#38BAFF'>Save Game</t>", {[] call UN_savedata;}];
// MrJizz - Factionfinderdotcom


Edited by LONG QI

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now