Prohibition for bandits to change skin

lport3

New Member
#Copy file "compiles.sqf" from @dayz/addons/dayz_code\init\ to your mpmission.

#Copy file "player_wearClothes.sqf" from @dayz/addons/dayz_code\actions\ to your mpmission.

#Change in file "compiles.sqf" line
player_wearClothes = ...
to
player_wearClothes = compile preprocessFileLineNumbers "player_wearClothes.sqf";
(this example right if you put file "player_wearClothes.sqf" in mpmission root, near init.sqf )

# Change in file "init.sqf" line
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
to
call compile preprocessFileLineNumbers "compiles.sqf";
(this example right if you put file "compiles.sqf" in mpmission root, near init.sqf )

#Change file "player_wearClothes.sqf" like that:
Code:
/*
_item spawn player_wearClothes;
TODO: female
*/
private["_item","_isFemale","_itemNew","_item","_onLadder","_model","_hasclothesitem","_config","_text"];
_item = _this;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
 
_hasclothesitem = _this in magazines player;
_config = configFile >> "CfgMagazines";
_text = getText (_config >> _item >> "displayName");
 
if (!_hasclothesitem) exitWith {cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};
 
if (vehicle player != player) exitWith {cutText ["You may not change clothes while in a vehicle", "PLAIN DOWN"]};
 
_isFemale = ((typeOf player == "SurvivorW2_DZ")||(typeOf player == "BanditW1_DZ"));
if (_isFemale) exitWith {cutText ["Currently Female Characters cannot change to this skin. This will change in a future update.", "PLAIN DOWN"]};
 
private["_itemNew","_myModel","_humanity","_isBandit","_isHero"];
_myModel = (typeOf player);
_humanity = player getVariable ["humanity",0];
_isBandit = _humanity < -2000;
_isHero = _humanity > 5000;
_itemNew = "Skin_" + _myModel;
 
 
 
if ( !(isClass(_config >> _itemNew)) ) then {
    _itemNew = if (!_isFemale) then {"Skin_Survivor2_DZ"} else {"Skin_SurvivorW2_DZ"};
};
 
switch (_item) do {
    //sniper skin
    case "Skin_Sniper1_DZ": {
        if (!_isBandit) then {_model = "Sniper1_DZ";} //renew for nonbandits
        else {_model = "Bandit1_DZ";};//bandit cant change skin
    };
    //camo skin
    case "Skin_Camo1_DZ": {
        if (!_isBandit) then {_model = "Camo1_DZ";} //renew for nonbandits
        else {_model = "Bandit1_DZ";};//bandit cant change skin
    };
    //soldier skin
    case "Skin_Soldier1_DZ": {
        if (!_isBandit) then {_model = "Soldier1_DZ";} //renew for nonbandits
        else {_model = "Bandit1_DZ";};//bandit cant change skin
    };
    //survivor skin
    case "Skin_Survivor2_DZ": {
        if (!_isBandit && !_isHero) then {_model = "Survivor2_DZ";};//do not renew if hero or bandit
        if (_isBandit) then {_model = "Bandit1_DZ";};//bandit cant change skin
        if (_isHero) then {_model = "Survivor3_DZ";};//change to hero skin
    };
    //hero skin renew
    case "Skin_Survivor3_DZ": {
        if (!_isBandit && !_isHero) then {_model = "Survivor2_DZ";};//renew if nothero or notbandit
        if (_isHero) then {_model = "Survivor3_DZ";};//change to hero skin
        if (_isBandit) then {_model = "Bandit1_DZ";};//bandit cant change skin
    };
    //bandit skin renew
    case "Skin_Bandit1_DZ": {
        if (!_isBandit && !_isHero) then {_model = "Survivor2_DZ";};//renew if nothero or notbandit
        if (_isBandit) then {_model = "Bandit1_DZ";};//bandit cant change skin
        if (_isHero) then {_model = "Survivor3_DZ";};//change to hero skin
    };
};
 
if ((_model != _myModel) && _isBandit) then {[dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;}; // renew bandit model
if (_isBandit) exitWith {cutText ["Server rules do not allow you to change clothes if you are a bandit. Increase your level of humanity.", "PLAIN DOWN"]};
 
if (_model != _myModel) then {
    player removeMagazine _item;
    player addMagazine _itemNew;
    [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
};
 
Back
Top