Taviana 2.0 Custom Loadouts

Will695

Member
ok so last night i made a breakthrough with Custom Loadouts for unique ID's on taviana 2.0 (dayz.st)

So all i did was replace the server_playerLogin.sqf with this one

Code:
private["_int","_newModel","_doLoop","_wait","_hiveVer","_isHiveOk","_playerID","_playerObj","_randomSpot","_publishTo","_primary","_secondary","_key","_result","_charID","_playerObj","_playerName","_finished","_spawnPos","_spawnDir","_items","_counter","_magazines","_weapons","_group","_backpack","_worldspace","_direction","_newUnit","_score","_position","_isNew","_inventory","_backpack","_medical","_survival","_stats","_state"];
//Set Variables
 
diag_log ("STARTING LOGIN: " + str(_this));
 
_playerID = _this select 0;
_playerObj = _this select 1;
_playerName = name _playerObj;
_worldspace = [];
 
if (count _this > 2) then {
    dayz_players = dayz_players - [_this select 2];
};
 
//waitUntil{allowConnection};
 
//Variables
_inventory =    [];
_backpack =    [];
_items =        [];
_magazines =    [];
_weapons =        [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =        [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
 
if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;
};
 
if ((_playerID == "") or (isNil "_playerID")) exitWith {
    diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
};
 
// Make Players Wait 60 if Alt F4 Bot detected
 
if (_playerID in botPlayers) then {
    botPlayers = botPlayers - [_playerID];
};
 
endLoadingScreen;
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);
 
_key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
_primary = [_key,false,dayZ_hivePipeAuth] call server_hiveReadWrite;
 
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
    diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj));
};
 
if ((_primary select 0) == "ERROR") exitWith {
    diag_log format ["LOGIN RESULT: Exiting, failed to load _primary: %1 for player: %2 ",_primary,_playerID];
};
 
//Process request
_newPlayer  = _primary select 1;
//_isNew      = count _primary < 6;
_isNew = count (_primary select 3) == 0;
_charID    = _primary select 2;
_randomSpot = false;
_hiveVer    = 0;
 
//Set character variables
_inventory = _primary select 4;
_backpack  = _primary select 5;
_survival  = _primary select 6;
_model    = _primary select 7;
_hiveVer  = _primary select 8;
 
// Check custom inventory for new characters
if (_model == "") then {
    _key = format["CHILD:999:select replace(cl.`inventory`, '""', '""""') inventory, replace(cl.`backpack`, '""', '""""') backpack, replace(coalesce(cl.`model`, 'Survivor2_DZ'), '""', '""""') model from `cust_loadout` cl join `cust_loadout_profile` clp on clp.`cust_loadout_id` = cl.`id` where clp.`unique_id` = '?':[%1]:",str(_playerID)];
    _data = "HiveEXT" callExtension _key;
 
    //Process result
    _result = call compile format ["%1", _data];
    _status = _result select 0;
 
    if (_status == "CustomStreamStart") then {
        if ((_result select 1) > 0) then {
            _data = "HiveEXT" callExtension _key;
            _result = call compile format ["%1", _data];
            _inventory = call compile (_result select 0);
            _backpack = call compile (_result select 1);
            _model = call compile (_result select 2);
            _isNew = false;
        };
    };
};
 
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Survivor3_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","Bandit1_DZ","BanditW1_DZ","Rocket_DZ"])) then {
    _model = "Survivor2_DZ";
};
 
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
 
_isHiveOk = false;
if (_hiveVer >= dayz_hiveVersionNo) then {
    _isHiveOk = true;
};
 
_clientID = owner _playerObj;
dayzPlayerLogin = [_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer];
_clientID publicVariableClient "dayzPlayerLogin";
 
//_playerObj enableSimulation false;

Please note that there is anti combat logging mod on line 39

Code:
// Make Players Wait 60 if Alt F4 Bot detected
 
if (_playerID in botPlayers) then {
botPlayers = botPlayers - [_playerID];
};

but i don't see why you can't just take that ^ bit out.

As I was editing late last night i don't think I edited the servercleanup as it seems to be the same as the previous mod i did but i'll put it on anyway.

The main thing that is different and i that i had to put in was right after
Code:
  _backpack = call compile (_result select 1);
            _model = call compile (_result select 2);
was
Code:
_isNew = false;
so it looks like
Code:
  if (_status == "CustomStreamStart") then {
        if ((_result select 1) > 0) then {
            _data = "HiveEXT" callExtension _key;
            _result = call compile format ["%1", _data];
            _inventory = call compile (_result select 0);
            _backpack = call compile (_result select 1);
            _model = call compile (_result select 2);
            _isNew = false; //the newly added line
        };
    };
};

Also i messed up the custom loadout in the database, i ticked the description as null but when i reviewed the video tutorial on how do it, it wasn't ticked.

I've only tested this out on myself at the min with 2 loadouts and they work, the skins only work with the ones in the playerlogin but i'm sure you can put more in (not got time to test that yet)

Here's a list of skins that you could put in (i don't know if some of them have radios so be careful)

Code:
"SurvivorW2_DZ","Survivor2_DZ","Survivor3_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","Bandit1_DZ","Rocket_DZ","TK_CIV_Takistani01_EP1","TK_CIV_Takistani05_EP1","TK_INS_Soldier_EP1","CZ_Soldier_DES_EP1","US_Soldier_EP1","BAF_Soldier_MTP","BAF_Soldier_DDPM","BAF_Soldier_L_MTP","BAF_Soldier_L_DDPM","BAF_Soldier_Officer_MTP","BAF_Soldier_Officer_DDPM","BAF_Soldier_Sniper_MTP","BAF_Soldier_SniperH_MTP","BAF_Soldier_SniperN_MTP","Villager1","Worker1","Citi"

So there you go tested and working on my dayz.st server.

This is a quick video tutorial on how to use it kindly done by aviationguy1980


I can only give limited support on this as i've not ran into any issues yet to work out a fix.

Hope it works for you, MAKE BACKUPS BEFORE TRYING THIS and if it breaks your server i'm not responsible.

Thanks,
 
Back
Top