[Request] How to read a variables from the database?

FGLock

New Member
How to transfer into the game total_zombie_kills variable from the database? I want to display a "total_zombie_kills" in my debug monitor.

I read the stats in server_playerSetup.sqf

Code:
while {_doLoop < 5} do {
_key = format["CHILD:102:%1:", _characterID];
_primary = _key call server_hiveReadWrite;
if (count _primary > 0) then { if ((_primary select 0) != "ERROR") then { _doLoop = 9; }; };
_doLoop = _doLoop + 1;
};

get it

Code:
["PASS",
[false,false,false,false,false,false,true,12000,[],[0,0],0,[0,0]],
[0,0,0,0], //Stats: kills,hkills,bkills,headshots
["MeleeCrowbar","amovpercmstpsraswrfldnon_gear",36],
[228,[2026.93,12546.3,0.001]],
0]

But how to read "total_zombie_kills"? Is that possible?
 
Thank you very much.
But i have crash server or do not get the data in diag_log :

Code:
while {_doLoop < 5} do {
    _key = format ["CHILD:999:select cl.`total_zombie_kills` from `profile` where clp.`unique_id` = '%1':[]:", _playerID];
    _primary = _key call server_hiveReadWrite;
    if (count _primary > 0) then { if ((_primary select 0) != "ERROR") then { _doLoop = 9; }; };
    _doLoop = _doLoop + 1;
};
diag_log ("PLAYERSETUP : KEY : total_zombie_kills : " + str(_primary));

How to write correctly?
 
to use child:999, you make an sql query (you got that part right) and the returned data is of type config. To convert it into usable data, call-compile-format it and it will become a 2d array. The first element of the array is an array containing 2 elements. The first element is of type string and tells you whether the child:999 is successful or not. The second element is the number of elements returned by the sql query.

example:
Code:
_key = format["CHILD:999:select `id` from survivor where `unique_id` = '?' LIMIT 1:[%1]:",_playerID];
_data = "HiveEXT" callExtension _key;         
_result = call compile format ["%1", _data];
_status = _result select 0;
    if (_status == "CustomStreamStart") then {
        _temp = _result select 1;
        _usrAgrment = _this select 2;
        if (_temp == 0 and isNil ("_usrAgrment")) exitWith
        {
            _allowContinue = false;
            diag_log ("Player Agreement");
            remExField = [nil, nil, ";dayz_clientPreload = true; closedialog 0; cutText ["""",""PLAIN"",0]; endLoadingScreen; userHaveNotAgree = true; ""Omer Rulez"" hintC [""Hackers Only"",""No PVP""];
                USER_AGRMENT =
                [
                    [""Do you agree?"",false],
                    [""Yes"", [0], """", -5, [[""expression"", ""userHaveNotAgree = false; [""""dayzLogin"""",[getPlayerUID player,player, true]] call callRpcProcedure; hint """"END1""""; ""]], ""1"", ""1""],
                    [""No"", [0], """", -5, [[""expression"", ""userHaveNotAgree = false; endMission """"END1""""; ""]], ""1"", ""1""]
                ];
 
                [] spawn { while {userHaveNotAgree} do { showCommandingMenu ""#USER:USER_AGRMENT""; sleep 5; }; };
            "];
            (owner _playerObj) publicVariableClient "remExField";
        };
 
        "HiveEXT" callExtension _key; //discard rest of data
    };
 
Back
Top