Custom Skins (Serverside)

Rick167

Member
Hello everyone,

I recently started renting a new DayZ Private Hive server. I've been reading for hours on different websites and forums about the different sections of code that you need to put in certain files to achieve custom skins. Some people say you must use the RMod, while some people say that you don't need it.

I've done plenty of searching and reading and I'm still scratching my head. After a few hours of experimentation with my server and lots of reading, I still can't seem to figure this one out.

I'm trying to get the skin "US_Soldier_EP1" for my clan members. From what I understand, I'd have to utilize their UUID's to assign that particular skin for them when they login and spawn. Unfortunately, I keep coming up with errors. Right away I came up with "Retrying Authentication" on the server. Then, it threw me into the debug plains and made me invisible.

Has anyone actually perfected this method yet? Preferably without the R Mod? If so, could anyone give me some advice on how to do so?

Thanks in advance for any helpful posts or contributions.

Rick
 
The RPT Log shows the following:

0:48:07 "ERROR: Cannot Sync Character [167th] Rick Grimes as no characterID"
0:48:08 "Player UID######### CID#? PID#1([167th] Rick Grimes) as Survivor1_DZ, logged off at Wilderness [-187:-106]"
0:48:08 "ERROR: Cannot Sync Character [167th] Rick Grimes as no characterID"
0:48:08 Client: Remote object 2:4 not found
0:48:08 Client: Remote object 2:5 not found
0:48:08 Client: Remote object 2:6 not found
0:48:08 Warning: Cleanup player - person 2:0 not found
0:48:10 Warning: Cleanup player - person 2:0 not found

Note: I blocked my UID out.
 
Thanks for the reply! Just so I'm perfectly clear before I go tinkering around in the server again, you're saying I should take the following steps:

If you are using the custom skins in your classes:
1. Open dayz_server\compile\server_playerLogin.sqf​
Find:​
Code:
if (!(_model in ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ"])) then {
    _model = "Survivor2_DZ";
  };
You need to add the additional skins you will be using on your server. Here is a list which includes all the skins used in the classes I provided:
Code:
if (!(_model in ["SurvivorW2_DZ","TK_INS_Soldier_EP1","CZ_Soldier_DES_EP1","US_Soldier_EP1","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ","Rocket_DZ","BAF_Soldier_MTP","BAF_Soldier_L_MTP","BAF_Soldier_Officer_MTP","BAF_Soldier_Sniper_MTP","Worker1","Soldier_Crew_AllWeaponSlots_PMC","Villager1","Citizen3","TK_CIV_Takistani05_EP1","TK_CIV_Takistani01_EP1"])) then {
    _model = "Survivor2_DZ";
  };
2. Open your BattlEye\selectplayer.txt​
Add the additional skins you will be using to line 1 like this:​
Code:
5 "" !"SurvivorW2_DZ"  !"Survivor1_DZ" !"Survivor2_DZ" !"Survivor3_DZ" !"Sniper1_DZ" !"Camo1_DZ" !"BanditW1_DZ" !"Bandit1_DZ" !"SurvivorW2_DZ" !"Soldier1_DZ" !"TK_INS_Soldier_EP1" !"CZ_Soldier_DES_EP1" !"US_Soldier_EP1" !"Rocket_DZ" !"BAF_Soldier_MTP" !"BAF_Soldier_L_MTP" !"BAF_Soldier_L_DDPM" !"BAF_Soldier_Officer_DDPM" !"BAF_Soldier_DDPM" !"BAF_Soldier_Officer_MTP" !"BAF_Soldier_Sniper_MTP" !"Worker1" !"Soldier_Crew_AllWeaponSlots_PMC" !"Villager1" !"Citizen3" !"TK_CIV_Takistani05_EP1" !"TK_CIV_Takistani01_EP1"

From what I understand, in order to spawn as the desired skin, I'll have to use the following code in my server_playerLogin.sqf:

Code:
if(_playerID == "00000000") then { // put your uuid instead of the 0
    _model = "US_Soldier_EP1";

Is that correct?

My concern is implementing the changes, getting the "retrying authentication" message again, then spawning back in the debug forest while invisible.

I did modify the server_playerLogin.sqf in a similar manner to what you described, however, I didn't realize I had to make a change in BattlEye. Could that have been causing the authentication issue / debug spawn?

If I do get spawned back in debug, is there a way for me to put myself back on the map rather than having to wipe the database?

Thanks,

Rick
 
Shoot. I decided to give it a try and it gave me the same Requesting Authentication / Retrying Authentication issue. After 30 seconds passed, I spawned invisible in debug.

Here is my server_playerLogin.sqf file:

Code:
private["_botActive","_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

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"

#ifdef LOGIN_DEBUG
diag_log ("STARTING LOGIN: " + str(_this));
#endif

_playerID = _this select 0;
_playerObj = _this select 1;
_playerName = name _playerObj;
_worldspace = [];

if (_playerName == '__SERVER__' || _playerID == '' || local player) exitWith {};

// Cancel any login until server_monitor terminates. 
// This is mandatory since all vehicles must be spawned before the first players spawn on the map.
// Otherwise, all vehicle event handlers won't be created on players' client side.
if (isNil "sm_done") exitWith { diag_log ("Login cancelled, server is not ready. " + str(_playerObj)); };


if (count _this > 2) then {
    dayz_players = dayz_players - [_this select 2];
};

//Variables
_inventory =    [];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;

if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;
};

if ((_playerID == "") or (isNil "_playerID")) exitWith {
    diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
};

//??? endLoadingScreen;
#ifdef LOGIN_DEBUG
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);
#endif

//Do Connection Attempt
_doLoop = 0;
while {_doLoop < 5} do {
    _key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
    _primary = _key call server_hiveReadWrite;
    if (count _primary > 0) then {
        if ((_primary select 0) != "ERROR") then {
            _doLoop = 9;
        };
    };
    _doLoop = _doLoop + 1;
};

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; //_result select 1;
_charID =         _primary select 2;
_randomSpot = false;

//diag_log ("LOGIN RESULT: " + str(_primary));

/* PROCESS */
_hiveVer = 0;

if (!_isNew) then {
    //RETURNING CHARACTER        
    _inventory =     _primary select 4;
    _backpack =     _primary select 5;
    _survival =        _primary select 6;
    _model =        _primary select 7;
    _hiveVer =        _primary select 8;
    
    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);
            };
if(_playerID == "********") then { // put your uuid instead of the 0
    _model = "US_Soldier_EP1";
};
    };
if (!(_model in ["SurvivorW2_DZ","TK_INS_Soldier_EP1","CZ_Soldier_DES_EP1","US_Soldier_EP1","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ","Rocket_DZ","BAF_Soldier_MTP","BAF_Soldier_L_MTP","BAF_Soldier_Officer_MTP","BAF_Soldier_Sniper_MTP","Worker1","Soldier_Crew_AllWeaponSlots_PMC","Villager1","Citizen3","TK_CIV_Takistani05_EP1","TK_CIV_Takistani01_EP1"])) then {
    _model = "Survivor2_DZ";
    };
    
} else {
    _model =        _primary select 3;
    _hiveVer =        _primary select 4;
    if (isNil "_model") then {
        _model = "Survivor2_DZ";
    } else {
if (!(_model in ["SurvivorW2_DZ","TK_INS_Soldier_EP1","CZ_Soldier_DES_EP1","US_Soldier_EP1","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ","Rocket_DZ","BAF_Soldier_MTP","BAF_Soldier_L_MTP","BAF_Soldier_Officer_MTP","BAF_Soldier_Sniper_MTP","Worker1","Soldier_Crew_AllWeaponSlots_PMC","Villager1","Citizen3","TK_CIV_Takistani05_EP1","TK_CIV_Takistani01_EP1"])) then {
    _model = "Survivor2_DZ";
        };
    };

    //Record initial inventory
    _config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
    _mags = getArray (_config >> "magazines");
    _wpns = getArray (_config >> "weapons");
    _bcpk = getText (_config >> "backpack");
    _randomSpot = true;
    
    //Wait for HIVE to be free
    _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]];
    _key call server_hiveWrite;
    
};
#ifdef LOGIN_DEBUG
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));
#endif

_isHiveOk = false;    //EDITED
if (_hiveVer >= dayz_hiveVersionNo) then {
    _isHiveOk = true;
};
//diag_log ("SERVER RESULT: " + str("X") + " " + str(dayz_hiveVersionNo));

//Server publishes variable to clients and WAITS
//_playerObj setVariable ["publish",[_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer],true];

dayzPlayerLogin = [_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer];
(owner _playerObj) publicVariableClient "dayzPlayerLogin";

Here is my BattlEye/selectplayer.txt file:

Code:
5 "" !"SurvivorW2_DZ"  !"Survivor1_DZ" !"Survivor2_DZ" !"Survivor3_DZ" !"Sniper1_DZ" !"Camo1_DZ" !"BanditW1_DZ" !"Bandit1_DZ" !"SurvivorW2_DZ" !"Soldier1_DZ" !"TK_INS_Soldier_EP1" !"CZ_Soldier_DES_EP1" !"US_Soldier_EP1" !"Rocket_DZ" !"BAF_Soldier_MTP" !"BAF_Soldier_L_MTP" !"BAF_Soldier_L_DDPM" !"BAF_Soldier_Officer_DDPM" !"BAF_Soldier_DDPM" !"BAF_Soldier_Officer_MTP" !"BAF_Soldier_Sniper_MTP" !"Worker1" !"Soldier_Crew_AllWeaponSlots_PMC" !"Villager1" !"Citizen3" !"TK_CIV_Takistani05_EP1" !"TK_CIV_Takistani01_EP1"

Did I do something wrong?
 
You're not alone. Have the same problem too. Also configured scroll wheel skin quick change and it works well for the regular DayZ skins - custom skins causes a BE kick: selectPlayer! even when i set the 5 to 1 in selectplayer.txt
 
I'm pretty sure that the code I added:

Code:
if(_playerID == "00000000") then { // put your uuid instead of the 0
    _model = "US_Soldier_EP1";

may have screwed the whole thing up. As soon as I reset my server_playerLogin.sqf file back to default, my friends and I all spawned in the correct areas.

Does anyone have any idea how I could fix this particular issue?

All help would be appreciated.
 
I did as you advised and removed the code from the server_playerLogin.sqf and I changed my model through the database table "survivors".

How would I implement a more permanent version of this? Through customloadout? If so, how would I format the table? (My customloadout has no entires)

Thanks!

Rick
 
Alright. So I managed to figure out how it's supposed to work, but for some reason the users don't spawn in as US_Soldier_EP1. The custom startgear works, but the skin does not. Any ideas? =\
 
Alright. So I managed to figure out how it's supposed to work, but for some reason the users don't spawn in as US_Soldier_EP1. The custom startgear works, but the skin does not. Any ideas? =\

you have to do it the player login way, it will force the players to be set to the skin when they login everytime though, so if you want them to be able to change skins and not force you could do something like..

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they are a fresh spawn then
 
if (dayzPlayerLogin2 select 2) then {
player setmodel "US_Soldier_EP1";
};

That basically says when they are a fresh spawn set their player model to that.. paste at the bottem of init.sqf btw
**not sure if that actually works - wrote it without testing it..
 
Well, let me back up and explain what I'm trying to do and what I've already done.

What I'm trying to do is setup custom loadouts for my clan members. Essentially, I want my clan members to spawn in US_SoldierEP1 skins every time they respawn. As a test, I also changed their backpack to an ACU backpack.

I have the custom loadout profiles linked to UID's in the database and those players spawn with the ACU backpacks, but they don't spawn in as US_Soldier_EP1. This leads me to believe I did the database part correctly.

I modified my server_playerLogin.sqf file to include the US_Soldier_EP1 skin in the list, and I created the file Battleye/selectplayer.txt and added the list of skins there.

Is there something I may have missed? I am able to change clan member's skins manually in the Survivor database table, but I have to keep repeating this process every time they die.

Thanks,

Rick
 
Well, let me back up and explain what I'm trying to do and what I've already done.

What I'm trying to do is setup custom loadouts for my clan members. Essentially, I want my clan members to spawn in US_SoldierEP1 skins every time they respawn. As a test, I also changed their backpack to an ACU backpack.

I have the custom loadout profiles linked to UID's in the database and those players spawn with the ACU backpacks, but they don't spawn in as US_Soldier_EP1. This leads me to believe I did the database part correctly.

I modified my server_playerLogin.sqf file to include the US_Soldier_EP1 skin in the list, and I created the file Battleye/selectplayer.txt and added the list of skins there.

Is there something I may have missed? I am able to change clan member's skins manually in the Survivor database table, but I have to keep repeating this process every time they die.

Thanks,

Rick

I know what you have done and I have tried all of it, the database doesnt recognize the us_soldier_ep1 as a skin for the custom loadouts and to put that on the skin because maybe how its written I am not sure, but the only way is to set it via player login, or try how I told you, but setting the skin wont work via database, you didnt miss anything, it just doesn't work, let me know if you need any help
 
Using your method, would I be able to make it so only my clan members spawn in with the soldier skin? I'm not very experienced in coding, but what you suggested sounds like it would make everyone in the server spawn in as a soldier. Am I wrong?​
Thanks,​
Rick​
 
that is correct, to set uids do something like this
Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they're a bambi
 
if (dayzPlayerLogin2 select 2) then {
 
if ((getPlayerUID player) in ["***"]) then {
 
Would I want to do it exactly like this:

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they're a bambi
 
if (dayzPlayerLogin2 select 2) then {
 
if ((getPlayerUID player) in ["***"]) then {

Or would I want to do it like this?

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they are a fresh spawn then
 
if (dayzPlayerLogin2 select 2) then {

if ((getPlayerUID player) in ["########"]) then {
player setmodel "US_Soldier_EP1";
};
 
Would I want to do it exactly like this:

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they're a bambi
 
if (dayzPlayerLogin2 select 2) then {
 
if ((getPlayerUID player) in ["***"]) then {

Or would I want to do it like this?

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they are a fresh spawn then
 
if (dayzPlayerLogin2 select 2) then {
 
if ((getPlayerUID player) in ["########"]) then {
player setmodel "US_Soldier_EP1";
};

should try the second one, I would test it out first though, not sure if it works like that
 
I tried a couple different things and they don't seem to be working. Here is what I tried:

Pasted this code at the end of init.sqf:

Code:
waitUntil { !isNil ("PVDZ_plr_LoginRecord") and
!(player getVariable ["humanity",0] > 5000 and
typeOf player == "Survivor2_DZ") and
!(player getVariable ["humanity",0] < -2000 and
(typeOf player == "Survivor2_DZ" or
typeOf player == "SurvivorW2_DZ") ) and
!(player getVariable ["humanity",0] > 0 and
(typeOf player == "Bandit1_DZ" or
typeOf player == "BanditW1_DZ") ) };
//if they are a fresh spawn then
 
if (dayzPlayerLogin2 select 2) then {
 
if ((getPlayerUID player) in ["########"]) then {
player setmodel "US_Soldier_EP1";
};

After this not working properly, I decided to try to give my clan members the DayZ Soldier parcel as a spawn item.

I followed this guide: http://opendayz.net/threads/random-clothing-parcels.8423/

Upon putting the clothing on, it still used the DayZ Soldier Skin, rather than the US_Solder_EP1 skin that I set it to use.
 
Back
Top