[Help/Discussion] Zabns Take Clothes

I'll try installing overpoch tonight and trading out the script. I've tested it on overwatch and epoch with no issues so far. But then again I've been using the infistar extended tools to live test changes.
 
I don't see that being an issue. Overpoch is epoch for all intents and purposes. The fn_self actions must be hosed up and have cursor target within square brackets.
Check the add action line ... It has a lot of options and can get hosed.
Compare it with the one I posted back a bit because that was the original one and is correct.

s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\player_takeClothes.sqf",cursorTarget, -10, false, true, "",""];
};
 
Still getting a client error in Overpoch

Code:
Error in expression <othes;
s_player_clothes = -1;

_skin = (typeOf _body);

_Playerskin = (typeOf pl>
  Error position: <typeOf _body);

_Playerskin = (typeOf pl>
  Error typeof: Type Array, expected Object
File mpmissions\__CUR_MP.Chernarus\addons\player_takeClothes_V2.sqf, line 17

Are you talking about this post?

Well maybe thats why my edited takeclothes script has worked so well for all these ages. I removed all the crap and just switch the skins, works on any skin, at any time, anywhere

this is the ENTIRE script right here. This is all you need.

Code:
private["_skin","_body"];
_body = _this select 3;

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
[dayz_playerUID, dayz_characterID, _skin] spawn player_humanityMorph;

the fn_selfactions.sqf code .. I believe this is the default code
Code:
//CLOTHES*************************************************************
        _clothesTaken = cursorTarget getVariable["clothesTaken",false];
    // Take clothes by Zabn @ BalotaBuddies.net
    if (_isMan and !_isAlive and !_isZombie and !_isAnimal and !_clothesTaken) then {
        if (s_player_clothes < 0) then {
            s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\player_takeClothes.sqf",cursorTarget, -10, false, true, "",""];
        };
    } else {
        player removeAction s_player_clothes;
        s_player_clothes = -1;
        };
//**************************************************************

This doesn't put YOUR skin on the dead body or switch the gear. It just takes the skin and puts it on you. I never had anyone mention anything about it being different, nobody noticed.

Just reviewing the script and I see that we could limit the clothes to be taken by only one person by adding
Code:
cursorTarget setVariable["clothesTaken",true];
at the end of the 'take clothes' script.

Try looking at the body while choosing the option to take clothes, that may be the issue?[
 
THAT WAS IT!!! It was the cursorTarget being in brackets.

So this:

//Remove CLOTHES
_clothesTaken = _cursorTarget getVariable["clothesTaken",false];

// Take clothes by Zabn
if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
if (s_player_clothes < 0) then {
s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "addons\player_takeClothes_V2.sqf",cursorTarget, -10, false, true, "",""];
};
} else {
player removeAction s_player_clothes;
s_player_clothes = -1;
};

Plus this:

// By Zabn 2014
private["_itemNew","_isFemale","_PlayeritemNew","_PlayerokSkin","_Playerskin","_PlayeritemNewName","_result2","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result","_animState","_takeClothesUsageTime","_started","_finished","_takeClothesUseTime"];

if (!isNil "DZE_ActionInProgress") then { // check if this is dayz epoch
if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
};

_body = _this select 3;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can't perform this action while on a ladder!" , "PLAIN DOWN"]};

if (vehicle player != player) exitWith {cutText ["You may not take clothes while in a vehicle", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
// get skin of player
_Playerskin = (typeOf player);
_itemNew = _skin;
//
_PlayeritemNew = _Playerskin;
// lets exit script if player is already wearing the skin he is trying to steal...
if (_skin == _Playerskin) exitwith {cutText [format["You are already wearing this skin!"], "PLAIN DOWN"];};

switch (_itemNew) do {
case "Survivor3_DZ": {
_itemNew = "Survivor2_DZ";
};
case "Bandit1_DZ": {
_itemNew = "Survivor2_DZ";
};
};
// switching humanity models that have no parcel for giving back parcels on non supported skins,
// add aditional above and below if additional skin parcels exist.
switch (_PlayeritemNew) do {
case "Survivor3_DZ": {
_PlayeritemNew = "Survivor2_DZ";
};
case "Bandit1_DZ": {
_PlayeritemNew = "Survivor2_DZ";
};
};
// female check on player
_isFemale = ((_Playerskin == "SurvivorW2_DZ") || (_Playerskin == "BanditW1_DZ"));
_itemNew = "Skin_" + _itemNew;
// Adding parcel name value
_PlayeritemNew = "Skin_" + _PlayeritemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);
// checking new name against configs
_PlayerokSkin = isClass (configFile >> "CfgMagazines" >> _PlayeritemNew);

_takeClothesUseTime = 6;

r_interrupt = false;
r_doLoop = true;
_takeClothesUsageTime = time;
_animState = animationState player;
_started = false;
_finished = false;
// if body skin has parcel, or player is not a female.
if((_okSkin) || (!_isFemale)) then {
_clothesTaken = _body getVariable["clothesTaken",false];
if(!_clothesTaken) then {
while {r_doLoop} do {
private ["_isMedic"];

_clothesTaken = _body getVariable["clothesTaken",false];
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if(_clothesTaken) then {
r_doLoop = false;
};
if (_isMedic) then {
_started = true;
};
if(!_isMedic && !r_interrupt && (time - _takeClothesUsageTime) < _takeClothesUseTime) then {
player playActionNow "Medic";
_isMedic = true;
};
if (_started && !_isMedic && (time - _takeClothesUsageTime) > _takeClothesUseTime) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
if(_finished) then {
// If skin has parcel. Add parcel to body.
if (_okSkin) then {
_itemNewName = getText (configFile >> "CfgMagazines" >> _itemNew >> "displayName");
_result = [player,_itemNew] call BIS_fnc_invAdd;
if (_result) then {
_body setVariable["clothesTaken",true,true];
cutText [format["One %1 has been added to your inventory!",_itemNewName], "PLAIN DOWN"];
} else {

};
} else {
// If no parcel can be obtained from body, humanitymorph to directly wear skin.
// Checking if current player skin can be moved to inventory and player not female.
if (_PlayerokSkin && !_isFemale) then {
_PlayeritemNewName = getText (configFile >> "CfgMagazines" >> _PlayeritemNew >> "displayName");
_result2 = [player,_PlayeritemNew] call BIS_fnc_invAdd;
// If parcel can be made from currently worn skin, added to inventory and humanitymorph to new skin.
if (_result2) then {
cutText [format["You have packed your %1 up and decided to try on your new clothes instead!",_PlayeritemNewName], "PLAIN DOWN"];
sleep 0.5;
_body setVariable["clothesTaken",true,true];
// maybe add something that changes model of body to regular survivor so players don't try multiple uses?
[dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
} else {
cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
};
} else {
// If parcel from players worn skin cannot be found, humanity morph and lose skin player was wearing.
cutText [format["You lost your %1 you were wearing, but you atleast put on your new clothes!",_Playerskin], "PLAIN DOWN"];
sleep 0.5;
_body setVariable["clothesTaken",true,true];
// maybe add something that changes model of body to what player was wearing?
[dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
};
};
} else {
if(_clothesTaken) then {
player switchMove "";
player playActionNow "stop";
cutText ["This Skin has already been taken!", "PLAIN DOWN"];
} else {
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
cutText [format["You have interrupted taking clothes!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
};
};
} else {
cutText ["This Skin has already been taken!", "PLAIN DOWN"];
};
} else {
cutText [format["Currently %1 is not supported by the steal skin script.",_skin], "PLAIN DOWN"];
};

Works perfectly in Overpoch! I tested multiple skins and they all work. The only caveat is that some skins tend to eat your backpack, but that's a problem with the skin itself, not this script. Thanks to everyone for the help!
 
THAT WAS IT!!! It was the cursorTarget being in brackets.

So this:

//Remove CLOTHES
_clothesTaken = _cursorTarget getVariable["clothesTaken",false];

// Take clothes by Zabn
if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
if (s_player_clothes < 0) then {
s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "addons\player_takeClothes_V2.sqf",cursorTarget, -10, false, true, "",""];
};
} else {
player removeAction s_player_clothes;
s_player_clothes = -1;
};

Plus this:

// By Zabn 2014
private["_itemNew","_isFemale","_PlayeritemNew","_PlayerokSkin","_Playerskin","_PlayeritemNewName","_result2","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result","_animState","_takeClothesUsageTime","_started","_finished","_takeClothesUseTime"];

if (!isNil "DZE_ActionInProgress") then { // check if this is dayz epoch
if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
};

_body = _this select 3;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can't perform this action while on a ladder!" , "PLAIN DOWN"]};

if (vehicle player != player) exitWith {cutText ["You may not take clothes while in a vehicle", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
// get skin of player
_Playerskin = (typeOf player);
_itemNew = _skin;
//
_PlayeritemNew = _Playerskin;
// lets exit script if player is already wearing the skin he is trying to steal...
if (_skin == _Playerskin) exitwith {cutText [format["You are already wearing this skin!"], "PLAIN DOWN"];};

switch (_itemNew) do {
case "Survivor3_DZ": {
_itemNew = "Survivor2_DZ";
};
case "Bandit1_DZ": {
_itemNew = "Survivor2_DZ";
};
};
// switching humanity models that have no parcel for giving back parcels on non supported skins,
// add aditional above and below if additional skin parcels exist.
switch (_PlayeritemNew) do {
case "Survivor3_DZ": {
_PlayeritemNew = "Survivor2_DZ";
};
case "Bandit1_DZ": {
_PlayeritemNew = "Survivor2_DZ";
};
};
// female check on player
_isFemale = ((_Playerskin == "SurvivorW2_DZ") || (_Playerskin == "BanditW1_DZ"));
_itemNew = "Skin_" + _itemNew;
// Adding parcel name value
_PlayeritemNew = "Skin_" + _PlayeritemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);
// checking new name against configs
_PlayerokSkin = isClass (configFile >> "CfgMagazines" >> _PlayeritemNew);

_takeClothesUseTime = 6;

r_interrupt = false;
r_doLoop = true;
_takeClothesUsageTime = time;
_animState = animationState player;
_started = false;
_finished = false;
// if body skin has parcel, or player is not a female.
if((_okSkin) || (!_isFemale)) then {
_clothesTaken = _body getVariable["clothesTaken",false];
if(!_clothesTaken) then {
while {r_doLoop} do {
private ["_isMedic"];

_clothesTaken = _body getVariable["clothesTaken",false];
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if(_clothesTaken) then {
r_doLoop = false;
};
if (_isMedic) then {
_started = true;
};
if(!_isMedic && !r_interrupt && (time - _takeClothesUsageTime) < _takeClothesUseTime) then {
player playActionNow "Medic";
_isMedic = true;
};
if (_started && !_isMedic && (time - _takeClothesUsageTime) > _takeClothesUseTime) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
if(_finished) then {
// If skin has parcel. Add parcel to body.
if (_okSkin) then {
_itemNewName = getText (configFile >> "CfgMagazines" >> _itemNew >> "displayName");
_result = [player,_itemNew] call BIS_fnc_invAdd;
if (_result) then {
_body setVariable["clothesTaken",true,true];
cutText [format["One %1 has been added to your inventory!",_itemNewName], "PLAIN DOWN"];
} else {

};
} else {
// If no parcel can be obtained from body, humanitymorph to directly wear skin.
// Checking if current player skin can be moved to inventory and player not female.
if (_PlayerokSkin && !_isFemale) then {
_PlayeritemNewName = getText (configFile >> "CfgMagazines" >> _PlayeritemNew >> "displayName");
_result2 = [player,_PlayeritemNew] call BIS_fnc_invAdd;
// If parcel can be made from currently worn skin, added to inventory and humanitymorph to new skin.
if (_result2) then {
cutText [format["You have packed your %1 up and decided to try on your new clothes instead!",_PlayeritemNewName], "PLAIN DOWN"];
sleep 0.5;
_body setVariable["clothesTaken",true,true];
// maybe add something that changes model of body to regular survivor so players don't try multiple uses?
[dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
} else {
cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
};
} else {
// If parcel from players worn skin cannot be found, humanity morph and lose skin player was wearing.
cutText [format["You lost your %1 you were wearing, but you atleast put on your new clothes!",_Playerskin], "PLAIN DOWN"];
sleep 0.5;
_body setVariable["clothesTaken",true,true];
// maybe add something that changes model of body to what player was wearing?
[dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
};
};
} else {
if(_clothesTaken) then {
player switchMove "";
player playActionNow "stop";
cutText ["This Skin has already been taken!", "PLAIN DOWN"];
} else {
r_interrupt = false;
player switchMove "";
player playActionNow "stop";
cutText [format["You have interrupted taking clothes!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
};
};
} else {
cutText ["This Skin has already been taken!", "PLAIN DOWN"];
};
} else {
cutText [format["Currently %1 is not supported by the steal skin script.",_skin], "PLAIN DOWN"];
};

Works perfectly in Overpoch! I tested multiple skins and they all work. The only caveat is that some skins tend to eat your backpack, but that's a problem with the skin itself, not this script. Thanks to everyone for the help!
Glad you got it working for ya. Thought I messed up on something, cause it was working fine for me on different mods. I might be able to add a check for if the skin is compatible with backpacks and cancel taking the skin if it has no backpack compatibility.
 
That would be absolutely outstanding! Otherwise I'm going to have to go through a long, tedious process of trial and error to see which skins are compatible and removing the ones that aren't. There's also the issue of skins setting players to the wrong "side" (east vs. west) and AI units consequently not firing at players after they switch skins. The Overpoch skins are turning out to be a huge pain in the arse.
 
That would be absolutely outstanding! Otherwise I'm going to have to go through a long, tedious process of trial and error to see which skins are compatible and removing the ones that aren't. There's also the issue of skins setting players to the wrong "side" (east vs. west) and AI units consequently not firing at players after they switch skins. The Overpoch skins are turning out to be a huge pain in the arse.
Nothing I can do about the different sides, but I'll try to add a check for backpacks.
 
As for setting the 'sides'. In Arma, you ARE what you WEAR. The only way to change that is the skin config files have to be edited to set that skin to West. That is what they did with the overwatch and epoch skins that spawn as parcels, they set the side of those skins to West. So any skin that doesn't spawn as a parcel will change the player to whatever side that skin is on. So if you stick to using all the skins that spawn, then those are all set to west and will not affect the player-ai relations.

I have heard that if you put on an East skin and are therefore set to east, if you create a West leader AI and join your player into the West leaders group, it will switch your side to West. Then you delete the leader and you will stay West. Or something like that, but they say its possible to force a specific side.

This page has a list of the Arma2 skins and what side they are on https://community.bistudio.com/wiki/ArmA_2:_Infantry
What I did on my server when we allowed stealing or using any skin was in the debug monitor I would show players what side they were on. And when it would change to East, they would get a hint message saying that they are dressed in the enemies clothes and will probably be mistaken as an enemy.
 
This should add a check to exit the script if it is a skin that does not support backpacks, I added a side check as well and if the side of the skin isn't west it will warn the player. Added an additional chunk if you want it to exit the script for each one.

Code:
// By Zabn 2014
private["_itemNew","_isFemale","_losebackpack","_sidecheck","_PlayeritemNew","_PlayerokSkin","_Playerskin","_PlayeritemNewName","_result2","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result","_animState","_takeClothesUsageTime","_started","_finished","_takeClothesUseTime"];

if (!isNil "DZE_ActionInProgress") then { // check if this is dayz epoch
    if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
};

_body = _this select 3;

_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can't perform this action while on a ladder!" , "PLAIN DOWN"]};
if (vehicle player != player) exitWith {cutText ["You may not take clothes while in a vehicle", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
// get skin of player
_Playerskin = (typeOf player);

//--- backpack check exits and side check warns ---
_losebackpack = getNumber (configFile >> "CfgVehicles" >> _skin >> "canCarryBackPack");
if (_losebackpack == 0) exitwith {cutText [format["This skin is not supported, you will lose your backpack from wearing this skin!"], "PLAIN DOWN"]; };
_sidecheck = getNumber (configFile >> "CfgVehicles" >> _skin >> "side");
if (_sidecheck != 1) then { cutText [format["This skin will change your side. It may cause issues!"], "PLAIN DOWN"];};
// ------------------------------------------------

// -- Alternatively backpack and side check exit --
//_losebackpack = getNumber (configFile >> "CfgVehicles" >> _skin >> "canCarryBackPack");
//if (_losebackpack == 0) exitwith {cutText [format["This skin is not supported, you will lose your backpack from wearing this skin!"], "PLAIN DOWN"]; };
//_sidecheck = getNumber (configFile >> "CfgVehicles" >> _skin >> "side");
// side west = 1
//if (_sidecheck != 1) exitwith {cutText [format["This skin is disabled and will change your side."], "PLAIN DOWN"];};
// -------------------------------------------------



_itemNew = _skin;
//
_PlayeritemNew = _Playerskin;
// lets exit script if player is already wearing the skin he is trying to steal...
if (_skin == _Playerskin) exitwith {cutText [format["You are already wearing this skin!"], "PLAIN DOWN"];};


switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
};
// switching humanity models that have no parcel for giving back parcels on non supported skins,
// add aditional above and below if additional skin parcels exist.
switch (_PlayeritemNew) do {
    case "Survivor3_DZ": {
        _PlayeritemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _PlayeritemNew = "Survivor2_DZ";
    };
};
// female check on player
_isFemale = ((_Playerskin == "SurvivorW2_DZ") || (_Playerskin == "BanditW1_DZ"));
_itemNew = "Skin_" + _itemNew;
// Adding parcel name value
_PlayeritemNew = "Skin_" + _PlayeritemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);
// checking new name against configs
_PlayerokSkin = isClass (configFile >> "CfgMagazines" >> _PlayeritemNew);

_takeClothesUseTime = 6;

r_interrupt = false;
r_doLoop = true;
_takeClothesUsageTime = time;
_animState = animationState player;
_started = false;
_finished = false;
// if body skin has parcel, or player is not a female.
if((_okSkin) || (!_isFemale)) then {
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) then {
        while {r_doLoop} do {
            private ["_isMedic"];
         
            _clothesTaken = _body getVariable["clothesTaken",false];
            _animState = animationState player;
            _isMedic = ["medic",_animState] call fnc_inString;
            if(_clothesTaken) then {
                r_doLoop = false;
            };
            if (_isMedic) then {
                _started = true;
            };
            if(!_isMedic && !r_interrupt && (time - _takeClothesUsageTime) < _takeClothesUseTime) then {
                player playActionNow "Medic";
                _isMedic = true;
            };
            if (_started && !_isMedic && (time - _takeClothesUsageTime) > _takeClothesUseTime) then {
                r_doLoop = false;
                _finished = true;
            };
            if (r_interrupt) then {
                r_doLoop = false;
            };
            sleep 0.1;
        };
        r_doLoop = false;
        if(_finished) then {
            // If skin has parcel. Add parcel to body.
            if (_okSkin) then {
            _itemNewName = getText (configFile >> "CfgMagazines" >> _itemNew >> "displayName");
            _result = [player,_itemNew] call BIS_fnc_invAdd;
            if (_result) then {
                _body setVariable["clothesTaken",true,true];
                cutText [format["One %1 has been added to your inventory!",_itemNewName], "PLAIN DOWN"];
            } else {
             
            };
            } else {
                // If no parcel can be obtained from body, humanitymorph to directly wear skin.
                // Checking if current player skin can be moved to inventory and player not female.
                if (_PlayerokSkin && !_isFemale) then {
                _PlayeritemNewName = getText (configFile >> "CfgMagazines" >> _PlayeritemNew >> "displayName");
                _result2 = [player,_PlayeritemNew] call BIS_fnc_invAdd;
                    // If parcel can be made from currently worn skin, added to inventory and humanitymorph to new skin.
                    if (_result2) then {
                        cutText [format["You have packed your %1 up and decided to try on your new clothes instead!",_PlayeritemNewName], "PLAIN DOWN"];
                        sleep 0.5;
                        _body setVariable["clothesTaken",true,true];
                        // maybe add something that changes model of body to regular survivor so players don't try multiple uses?
                        [dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
                    } else {
                        cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
                    };
                } else {
                        // If parcel from players worn skin cannot be found, humanity morph and lose skin player was wearing.
                        cutText [format["You lost your %1 you were wearing, but you atleast put on your new clothes!",_Playerskin], "PLAIN DOWN"];
                        sleep 0.5;
                        _body setVariable["clothesTaken",true,true];
                        // maybe add something that changes model of body to what player was wearing?
                        [dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
                };
            };
        } else {
            if(_clothesTaken) then {
                player switchMove "";
                player playActionNow "stop";
                cutText ["This Skin has already been taken!", "PLAIN DOWN"];
            } else {
                r_interrupt = false;
                player switchMove "";
                player playActionNow "stop";
                cutText [format["You have interrupted taking clothes!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
            };
        };
    } else {
        cutText ["This Skin has already been taken!", "PLAIN DOWN"];
    };
} else {
    cutText [format["Currently %1 is not supported by the steal skin script.",_skin], "PLAIN DOWN"];
};
 
This should add a check to exit the script if it is a skin that does not support backpacks, I added a side check as well and if the side of the skin isn't west it will warn the player. Added an additional chunk if you want it to exit the script for each one.

Code:
// By Zabn 2014
private["_itemNew","_isFemale","_losebackpack","_sidecheck","_PlayeritemNew","_PlayerokSkin","_Playerskin","_PlayeritemNewName","_result2","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result","_animState","_takeClothesUsageTime","_started","_finished","_takeClothesUseTime"];

if (!isNil "DZE_ActionInProgress") then { // check if this is dayz epoch
    if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
};

_body = _this select 3;

_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText ["You can't perform this action while on a ladder!" , "PLAIN DOWN"]};
if (vehicle player != player) exitWith {cutText ["You may not take clothes while in a vehicle", "PLAIN DOWN"]};

player removeAction s_player_clothes;
s_player_clothes = -1;

_skin = (typeOf _body);
// get skin of player
_Playerskin = (typeOf player);

//--- backpack check exits and side check warns ---
_losebackpack = getNumber (configFile >> "CfgVehicles" >> _skin >> "canCarryBackPack");
if (_losebackpack == 0) exitwith {cutText [format["This skin is not supported, you will lose your backpack from wearing this skin!"], "PLAIN DOWN"]; };
_sidecheck = getNumber (configFile >> "CfgVehicles" >> _skin >> "side");
if (_sidecheck != 1) then { cutText [format["This skin will change your side. It may cause issues!"], "PLAIN DOWN"];};
// ------------------------------------------------

// -- Alternatively backpack and side check exit --
//_losebackpack = getNumber (configFile >> "CfgVehicles" >> _skin >> "canCarryBackPack");
//if (_losebackpack == 0) exitwith {cutText [format["This skin is not supported, you will lose your backpack from wearing this skin!"], "PLAIN DOWN"]; };
//_sidecheck = getNumber (configFile >> "CfgVehicles" >> _skin >> "side");
// side west = 1
//if (_sidecheck != 1) exitwith {cutText [format["This skin is disabled and will change your side."], "PLAIN DOWN"];};
// -------------------------------------------------



_itemNew = _skin;
//
_PlayeritemNew = _Playerskin;
// lets exit script if player is already wearing the skin he is trying to steal...
if (_skin == _Playerskin) exitwith {cutText [format["You are already wearing this skin!"], "PLAIN DOWN"];};


switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
};
// switching humanity models that have no parcel for giving back parcels on non supported skins,
// add aditional above and below if additional skin parcels exist.
switch (_PlayeritemNew) do {
    case "Survivor3_DZ": {
        _PlayeritemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _PlayeritemNew = "Survivor2_DZ";
    };
};
// female check on player
_isFemale = ((_Playerskin == "SurvivorW2_DZ") || (_Playerskin == "BanditW1_DZ"));
_itemNew = "Skin_" + _itemNew;
// Adding parcel name value
_PlayeritemNew = "Skin_" + _PlayeritemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);
// checking new name against configs
_PlayerokSkin = isClass (configFile >> "CfgMagazines" >> _PlayeritemNew);

_takeClothesUseTime = 6;

r_interrupt = false;
r_doLoop = true;
_takeClothesUsageTime = time;
_animState = animationState player;
_started = false;
_finished = false;
// if body skin has parcel, or player is not a female.
if((_okSkin) || (!_isFemale)) then {
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) then {
        while {r_doLoop} do {
            private ["_isMedic"];
        
            _clothesTaken = _body getVariable["clothesTaken",false];
            _animState = animationState player;
            _isMedic = ["medic",_animState] call fnc_inString;
            if(_clothesTaken) then {
                r_doLoop = false;
            };
            if (_isMedic) then {
                _started = true;
            };
            if(!_isMedic && !r_interrupt && (time - _takeClothesUsageTime) < _takeClothesUseTime) then {
                player playActionNow "Medic";
                _isMedic = true;
            };
            if (_started && !_isMedic && (time - _takeClothesUsageTime) > _takeClothesUseTime) then {
                r_doLoop = false;
                _finished = true;
            };
            if (r_interrupt) then {
                r_doLoop = false;
            };
            sleep 0.1;
        };
        r_doLoop = false;
        if(_finished) then {
            // If skin has parcel. Add parcel to body.
            if (_okSkin) then {
            _itemNewName = getText (configFile >> "CfgMagazines" >> _itemNew >> "displayName");
            _result = [player,_itemNew] call BIS_fnc_invAdd;
            if (_result) then {
                _body setVariable["clothesTaken",true,true];
                cutText [format["One %1 has been added to your inventory!",_itemNewName], "PLAIN DOWN"];
            } else {
            
            };
            } else {
                // If no parcel can be obtained from body, humanitymorph to directly wear skin.
                // Checking if current player skin can be moved to inventory and player not female.
                if (_PlayerokSkin && !_isFemale) then {
                _PlayeritemNewName = getText (configFile >> "CfgMagazines" >> _PlayeritemNew >> "displayName");
                _result2 = [player,_PlayeritemNew] call BIS_fnc_invAdd;
                    // If parcel can be made from currently worn skin, added to inventory and humanitymorph to new skin.
                    if (_result2) then {
                        cutText [format["You have packed your %1 up and decided to try on your new clothes instead!",_PlayeritemNewName], "PLAIN DOWN"];
                        sleep 0.5;
                        _body setVariable["clothesTaken",true,true];
                        // maybe add something that changes model of body to regular survivor so players don't try multiple uses?
                        [dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
                    } else {
                        cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
                    };
                } else {
                        // If parcel from players worn skin cannot be found, humanity morph and lose skin player was wearing.
                        cutText [format["You lost your %1 you were wearing, but you atleast put on your new clothes!",_Playerskin], "PLAIN DOWN"];
                        sleep 0.5;
                        _body setVariable["clothesTaken",true,true];
                        // maybe add something that changes model of body to what player was wearing?
                        [dayz_playerUID,dayz_characterID,_skin] spawn player_humanityMorph;
                };
            };
        } else {
            if(_clothesTaken) then {
                player switchMove "";
                player playActionNow "stop";
                cutText ["This Skin has already been taken!", "PLAIN DOWN"];
            } else {
                r_interrupt = false;
                player switchMove "";
                player playActionNow "stop";
                cutText [format["You have interrupted taking clothes!"], "PLAIN DOWN"]; //display text at bottom center of screen on interrupt
            };
        };
    } else {
        cutText ["This Skin has already been taken!", "PLAIN DOWN"];
    };
} else {
    cutText [format["Currently %1 is not supported by the steal skin script.",_skin], "PLAIN DOWN"];
};



Doesn't work. No matter what skin you try to take it says that it will take your backpack and then exits there. On line 34 there is a ; missing after the side check. I fixed that but no dice. I didn't test it on a "regular" skin to see if it works on those though.
 
Can I use an array here
case "<SKIN CLASSNAME>": {
_itemNew = "disabled";
};
EG...
case "bandit","man","girl","vaginaboob": {
_itemNew = "disabled";
};
 
OK got it working ok. Couple of issues though. When the player takes a sking the AI ignore them. This is due to the player taking on the "EAST" side from the playermorph. Any fixes for this?
 
I'm not sure what's wrong but the script is working perfectly except for the scroll wheel option, it seems to flash in and out of the scroll wheel menu when looking straight at a body, as soon as I look up at the sky and the rest of the options for a body disappear the take clothes option stays steady.
 
Make sure that you place the:
Code:
//Remove CLOTHES
_clothesTaken = _cursorTarget getVariable["clothesTaken",false];

// Take clothes by Zabn
if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
if (s_player_clothes < 0) then {
s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "addons\player_takeClothes_V2.sqf",cursorTarget, -10, false, true, "",""];
};
} else {
player removeAction s_player_clothes;
s_player_clothes = -1;
};
at the very end of the curserTarget part of the Fn_selfactions.sqf

Also make sure you add !_isAnimal otherwise you will have "cows with guns..."
 
The Battleye part of instructions does not match the version I have
Epoch 1.05.1

) Battleye filters: open your setvariable.txt and at line 1 add to the end of the line this:

Code (Text):
!="clothesTaken"

All mine look like this , not the string he shows in the install info

//1 not the string form with all the variables separated by coma

So I am assuming it would be //1="clothesTaken" just double checking
 
All mine look like this , not the string he shows in the install info

//1 not the string form with all the variables separated by coma
So I am assuming it would be //1="clothesTaken" just double checking

So all yours are commented out and therefore disabled? And since its a 1, they will just be logged anyways so not a big deal if you don't have the clothestaken exception.
This is line 1 of the setvariable.txt ...
Code:
1 "" !="drn_AskServerDynamicWeatherEventArgs" !="dayzLogin" !="dayzLogin2" !="dayzLoginRecord" !="dayzCharDisco" !="dayzPlayerSave" !="usecBleed" !="dayzHit" !="usecTransfuse" !="usecBandage" !="dayzPlayerMorph" !="usecPainK" !="usecEpi" !="dayzPublishObj" !="dayzRoadFlare" !="dayzDiscoAdd" !="dayzGutBody" !="dayzHideBody" !="dayzDeleteObj" !="dayzUpdateVehicle" !="dayzSetFix" !="dayzHumanity" !="dayzDiscoRem" !="usecMorphine" !="dayzSetFuel" !="dayzFlies" !="changeCharacter" !="dayzSwitch" !="dayzFire" !="norrnRaDrag" !="norrnR180" !="norrnRalie" !="norrnRALW" !="norrnRACarUp" !="norrnRAPicUp" !="norrnRnoAnim" !="remExField" !="BIS_MPF_logic" !="remExFP" !="dayzDeath" !="player" !="drn_DynamicWeatherEventArgs" !="dayzSetDate" !="rsay" !="rland" !="rsetdir" !"\"zombiespawn\" = " !"\"targets\" = [<NULL-object>]" !"\"targets\" = []" !"\"zombied\" = <NULL-object>" !"\"startcombattimer\" = " !"\"posforceupdate\" = " !"\"combattimeout\" = " !"\"messing\" = ["  !="_this spawn fnc_plyrHit;"

They changed the way battleye filters worked a while back so ... update your battleye? http://opendayz.net/threads/a-guide-to-battleye-filters.21066/ ebays tutorial on filters can help a LOT.
My tutorial can help MORE.
1: Open up your Battleye folder on your server.
2: Select ALL files that have the .txt file extension.
3: Press Delete key.

seriously. ... save yourself hours and hours of work and debugging and worry and let that ONE hacker that the BE filters will catch in the next year play the game.
 
Back
Top