[Help/Discussion] Zabns Take Clothes

fn_SelfActions.sqf

Line 692ish


Code:
    //Sleep
    if(_isTent and _ownerID == dayz_characterID) then {
        if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
            s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_sleep;
        s_player_sleep = -1;
    };
        _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>"), "custom\player_takeClothes_v2.sqf",_cursorTarget, -10, false, true, "",""];
        };
    } else {
        player removeAction s_player_clothes;
        s_player_clothes = -1;
        };
  
    //Repairing Vehicles
    if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
            s_player_repairActions set [count s_player_repairActions,_menu];
            s_player_repairActions set [count s_player_repairActions,_menu1];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };

fn_SelfActions.sqf
line 890ish

Code:
    player removeAction s_player_fillfuel;
    s_player_fillfuel = -1;
    player removeAction s_player_studybody;
    s_player_studybody = -1;
    player removeAction s_player_clothes;
    s_player_clothes = -1;

downloaded code is in the right place, Take Clothes shows up when its supposed to but when you click it nothing happens and no error in RPT.
 
Oooohhh, this is version 2. I have the previous version working on my servers. I gave the new version a try just now, but for some reason the new one won't work for me either. Although I do have to admit it's near midnight and I'm not sure I should be messing with my servers right now :). Right now I have this:

SelfActions:

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

I use this mainly to get zombie skins, so I had to remove !_isZombie to get it to show up when I wanted. I added !_isAnimal to stop the option from showing up for animals. If you don't want zombie skins, don't change this :).

And:

Code:
player removeAction s_player_fillfuel;
    s_player_fillfuel = -1;
    player removeAction s_player_clothes;
    s_player_clothes = -1;
    player removeAction s_player_studybody;
    s_player_studybody = -1;

And my player_takeClothes.sqf:

Code:
// By Zabn 2013 @ BalotaBuddies.net
private["_itemNew","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result"];
_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);

_itemNew = _skin;

switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "z_soldier": {
        _itemNew = "Soldier1_DZ";
    };
    case "z_soldier_heavy": {
        _itemNew = "Soldier1_DZ";
    };
    case "z_suit1": {
        _itemNew = "Functionary1_EP1_DZ";
    };
    case "z_suit2": {
    _itemNew = "Functionary1_EP1_DZ";
    };
    case "z_policeman": {
    _itemNew = "RU_Policeman_DZ";
    };
    case "z_worker1": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_worker2": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_worker3": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_villager1": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_villager2": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_villager3": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_teacher": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_doctor": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_priest": {
    _itemNew = "Priest_DZ";
    };
    case "z_hunter": {
    _itemNew = "Survivor2_DZ";
    };
    case "zZombie_Base": {
    _itemNew = "Survivor2_DZ";
    };
    case "z_soldier_pilot": {
    _itemNew = "Soldier1_DZ";
    };
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if(_okSkin) then {
    player playActionNow "Medic";
    sleep 3;
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) 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 {
            cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
        };
    } 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"];
};

I kept getting the 'this skin is not supported' message, so I added "switch (_itemNew) do {" for all the skins. It's like a bounty for each zombie kill :). If you don't want zombie skins, you won't need lines 23-79, so you're left with:

Code:
// By Zabn 2013 @ BalotaBuddies.net
private["_itemNew","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result"];
_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);

_itemNew = _skin;

switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if(_okSkin) then {
    player playActionNow "Medic";
    sleep 3;
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) 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 {
            cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
        };
    } 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 works perfectly for me on both my Epoch 1.0.4.2. servers (Chernarus and Taviana) for both zombie and player skins. It may be worth a try to see if the 'old' version works for you. Tomorrow I'll give the new version another try. I am certainly no expert, but so far I have gotten everything to work on my servers, so I'll give it my best and get back to you.
 
Yes take clothes 2.0 do not works on Epoch 1.0.4.2. This skript has no function :-/ Is the script tested? Tthe menu appears, but when you click it nothing happens.
 
sadly with 1.8.0.3 vanilla the same, i hadnt had time to take a look on the script, but maybe Zabn can get this done :)
 
Can Somebody tell me how to get the version 2.0 runnin on epoch 1.0.4.2 or give me the link to the 1.0 script?

Would be very nice, thank u

yes it would :)

I already did a few posts back (#104) [insert stern look here] ;-). I posted the Zabn's Take Clothes codes I have on my server. I can confirm these work on epoch 1.0.4.2.

The Take Clothes code you need would be this:

Code:
// By Zabn 2013 @ BalotaBuddies.net
private["_itemNew","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result"];
_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);

_itemNew = _skin;

switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if(_okSkin) then {
    player playActionNow "Medic";
    sleep 3;
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) 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 {
            cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
        };
    } 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"];
};

Enjoy :)
 
Last edited:
So I just need to replace the Code in "player_takeClothes_v2.sqf" with this code u posted, Jutka?
Or do I need to do some other changes?
 
So I just need to replace the Code in "player_takeClothes_v2.sqf" with this code u posted, Jutka?
Or do I need to do some other changes?

I believe the rest of it was unchanged, and you were already getting the option in your scroll wheel menu, so replacing the code in your player_takeClothes_v2.sqf should do it.

If it doesn't, let me know. I think I have the post and the original file of the previous version saved somewhere. Well, I'm quite sure I have, but I'll have to dig into my computer files, which may take a while :).
 
Jep, thanks to u. I replaced the code and its working!
Thanks!

Would be funny to remove the cloth of animals xD

really nice script!
 
I currently have custom skins for AI patrols on my server and I was wondering how you add custom skins to the sqf.
 
thanks ebay, i was using it as an array because i changed the code in selfactions but forgot to also change this on my tutorial, its now updated so it works
 
Last edited:
These are all the skins for EPOCH ONLY.

Code:
// By Zabn 2013 @ BalotaBuddies.net
private["_itemNew","_onLadder","_skin","_body","_okSkin","_clothesTaken","_itemNewName","_result"];
_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);

_itemNew = _skin;

switch (_itemNew) do {
    case "Survivor3_DZ": {
        _itemNew = "Survivor2_DZ";
    };
    case "Bandit1_DZ": {
        _itemNew = "Survivor2_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "RU_Policeman_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Priest_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Haris_Press_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Pilot_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Functionary1_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Rocker3_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Rocker1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Rocker4_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "BanditW1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "BanditW2_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorW2_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorW3_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorWcombat_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorWdesert_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorWurban_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "SurvivorWpink_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Rocket_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Soldier1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Sniper1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "CZ_Soldier_Sniper_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Camo1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "FR_OHara_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "FR_Rodriguez_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Graves Light DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "CZ_Special_Forces_GL_DES_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Soldier_Bodyguard_AA12_PMC_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Bandit1 DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Bandit2_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Soldier_MG_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Soldier_Sniper_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Soldier_Crew_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Soldier_CO_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Soldier_2_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "GUE_Commander_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "Ins_Soldier_GL_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "TK_INS_Soldier_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "TK_INS_Soldier_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "TK_INS_Warlord_EP1_DZ";
    };
   
    case "Survivor3_DZ": {
        _itemNew = "TK_INS_Warlord_EP1_DZ";
    };
   
};

_itemNew = "Skin_" + _itemNew;
_okSkin = isClass (configFile >> "CfgMagazines" >> _itemNew);

if(_okSkin) then {
    player playActionNow "Medic";
    sleep 3;
    _clothesTaken = _body getVariable["clothesTaken",false];
    if(!_clothesTaken) 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 {
            cutText [format["You didn't have enough room to store a %1 :(",_itemNewName], "PLAIN DOWN"];
        };
    } 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"];
};

Big thanks to ebay for helping me get things working.
 
Back
Top