Need help about getDefaultClothing and playerSetupGear

Need help about getDefaultClothing and playerSetupGear

« posted: Jan 14, 2020, 02:23 AM »
I am trying to make a custom spawn loadout in my server but i think it is not working.
I managed to get vest,backpack and pistol as i wanted but the uniform and the primary weapon isn't working at all.

Here is the loadout that i want;


Code: [Select]
comment "Exported from Arsenal by Svartalfheim";

comment "[!] UNIT MUST BE LOCAL [!]";
if (!local this) exitWith {};

comment "Remove existing items";

Any help is appreciated, thanks!
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add weapons";
this addWeapon "LMG_Mk200_black_F";
this addPrimaryWeaponItem "muzzle_snds_H";
this addPrimaryWeaponItem "acc_pointer_IR";
this addPrimaryWeaponItem "optic_ERCO_blk_F";
this addPrimaryWeaponItem "200Rnd_65x39_cased_Box";
this addPrimaryWeaponItem "bipod_02_F_blk";
this addWeapon "launch_RPG7_F";
this addWeapon "hgun_Pistol_heavy_01_green_F";
this addHandgunItem "muzzle_snds_acp";
this addHandgunItem "acc_flashlight_pistol";
this addHandgunItem "optic_MRD_black";
this addHandgunItem "11Rnd_45ACP_Mag";

comment "Add containers";
this forceAddUniform "U_O_R_Gorka_01_black_F";
this addVest "V_PlateCarrierGL_blk";
this addBackpack "B_ViperHarness_blk_F";

comment "Add binoculars";
this addWeapon "Rangefinder";

comment "Add items to containers";
this addItemToUniform "FirstAidKit";
for "_i" from 1 to 2 do {this addItemToVest "MiniGrenade";};
this addItemToVest "SmokeShell";
this addItemToVest "SmokeShellGreen";
this addItemToVest "SmokeShellBlue";
this addItemToVest "SmokeShellOrange";
for "_i" from 1 to 2 do {this addItemToVest "Chemlight_green";};
for "_i" from 1 to 3 do {this addItemToVest "11Rnd_45ACP_Mag";};
this addItemToVest "200Rnd_65x39_cased_Box";
for "_i" from 1 to 2 do {this addItemToBackpack "200Rnd_65x39_cased_Box";};
this addHeadgear "H_HelmetSpecO_blk";
this addGoggles "G_AirPurifyingRespirator_02_black_F";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
this linkItem "B_UavTerminal";
this linkItem "NVGogglesB_blk_F";

comment "Set identity";
[this,"Default","male03engb"] call BIS_fnc_setIdentity;
[this,"TFAegis"] call BIS_fnc_setUnitInsignia;

Here is my getDefaultClothing;

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.0
// @file Name: getDefaultClothing.sqf
// @file Author: AgentRev
// @file Created: 22/12/2013 22:04

private ["_unit", "_item", "_side", "_isSniper", "_isDiver", "_defaultVest", "_result"];

_unit = _this select 0;
_item = _this select 1;

if (typeName _unit == "OBJECT") then
{
_side = if (_unit == player) then { playerSide } else { side _unit };
_unit = typeOf _unit;
}
else
{
_side = _this select 2;
};

_isSniper = (["_sniper_", _unit] call fn_findString != -1);
_isDiver = (["_diver_", _unit] call fn_findString != -1);

_defaultVest = "V_PlateCarrierGL_blk";

_result = "";

switch (_side) do
{
case BLUFOR:
{
switch (true) do
{
case (_isSniper):
{
if (_item == "uniform") then { _result = "U_B_Ghilliesuit" };
if (_item == "vest") then { _result = _defaultVest };
};
case (_isDiver):
{
if (_item == "uniform") then { _result = "U_B_Wetsuit" };
if (_item == "vest") then { _result = "V_RebreatherB" };
if (_item == "goggles") then { _result = "G_Diving" };
};
default
{
if (_item == "uniform") then { _result = "U_O_R_Gorka_01_black_F" };
if (_item == "vest") then { _result = _defaultVest };
        if (_item == "goggles") then { _result = "G_AirPurifyingRespirator_02_black_F" };
};
                        case (_isMedic):
{
if (_item == "uniform") then { _result = "U_O_R_Gorka_01_black_F" };
if (_item == "vest") then { _result = _defaultVest };
        if (_item == "goggles") then { _result = "G_AirPurifyingRespirator_02_black_F" };
};
};

if (_item == "headgear") then { _result = "H_HelmetSpecO_blk" };
};
case OPFOR:
{
switch (true) do
{
case (_isSniper):
{
if (_item == "uniform") then { _result = "U_O_R_Gorka_01_black_F" };
if (_item == "vest") then { _result = _defaultVest };
};
case (_isDiver):
{
if (_item == "uniform") then { _result = "U_O_Wetsuit" };
if (_item == "vest") then { _result = "V_RebreatherIR" };
if (_item == "goggles") then { _result = "G_Diving" };
};
default
{
if (_item == "uniform") then { _result = "U_O_R_Gorka_01_black_F" };
if (_item == "vest") then { _result = _defaultVest };
};
};

if (_item == "headgear") then { _result = "H_MilCap_ocamo" };
};
default
{
switch (true) do
{
case (_isSniper):
{
if (_item == "uniform") then { _result = "U_I_Ghilliesuit" };
if (_item == "vest") then { _result = _defaultVest };
};
case (_isDiver):
{
if (_item == "uniform") then { _result = "U_I_Wetsuit" };
if (_item == "vest") then { _result = "V_RebreatherIA" };
if (_item == "goggles") then { _result = "G_Diving" };
};
default
{
if (_item == "uniform") then { _result = "U_O_R_Gorka_01_black_F" };
if (_item == "vest") then { _result = _defaultVest };
};
};

if (_item == "headgear") then { _result = "H_HelmetSpecO_blk" };
};
};

_result

Here is my playerSetupGear;

Code: [Select]
// @file Name: playerSetupGear.sqf
// @file Author: [GoT] JoSchaap, AgentRev

private ["_player", "_uniform", "_vest", "_headgear", "_goggles"];
_player = _this;

// Clothing is now defined in "client\functions\getDefaultClothing.sqf"

_uniform = [_player, "uniform"] call getDefaultClothing;
_vest = [_player, "vest"] call getDefaultClothing;
_headgear = [_player, "headgear"] call getDefaultClothing;
_goggles = [_player, "goggles"] call getDefaultClothing;

if (_uniform != "") then { _player addUniform _uniform };
if (_vest != "") then { _player addVest _vest };
if (_headgear != "") then { _player addHeadgear _headgear };
if (_goggles != "") then { _player addGoggles _goggles };

sleep 0.1;

// Remove GPS
_player unlinkItem "ItemGPS";

// Remove radio
//_player unlinkItem "ItemRadio";

// Remove NVG
//if (hmd _player != "") then { _player unlinkItem hmd _player };

// Add NVG
_player linkItem "NVGogglesB_blk_F";

_player addBackpack "B_ViperHarness_blk_F";

_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_Pistol_heavy_01_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "FirstAidKit";
_player selectWeapon " hgun_Pistol_heavy_01_F";

if (_player == player) then
{
thirstLevel = 100;
hungerLevel = 100;
};

if ((getPlayerUID _player) in ["12345678901234567"]) then {
// "Remove existing items";
removeAllWeapons _player;
removeAllItems _player;
removeAllAssignedItems _player;
removeUniform _player;
removeVest _player;
removeBackpack _player;
removeHeadgear _player;
removeGoggles _player;

// "Add containers";
_player forceAddUniform "U_O_R_Gorka_01_black_F";
_player addItemToUniform "FirstAidKit";
_player addHeadgear "H_HelmetSpecO_blk";
_player addGoggles "G_AirPurifyingRespirator_02_black_F";
_player addVest "V_PlateCarrierGL_blk";
_player addItemToVest "HandGrenade";
_player addItemToVest "O_IR_Grenade";
_player addItemToVest "11Rnd_45ACP_Mag";
_player addItemToVest "11Rnd_45ACP_Mag";
_player addItemToVest "11Rnd_45ACP_Mag";
_player addBackpack "B_ViperHarness_blk_F";
_player addItemToBackpack "Medikit";
_player addItemToBackpack "FirstAidKit";
_player addItemToBackpack "HandGrenade";
_player addItemToBackpack "HandGrenade";
_player addItemToBackpack "200Rnd_65x39_cased_Box";
_player addItemToBackpack "200Rnd_65x39_cased_Box";
_player addItemToBackpack "11Rnd_45ACP_Mag";
_player addItemToBackpack "11Rnd_45ACP_Mag";
_player addItemToBackpack "11Rnd_45ACP_Mag";
_player addItemToBackpack "11Rnd_45ACP_Mag";
_player addItemToBackpack "11Rnd_45ACP_Mag";

// "Add weapons";
_player addWeapon "LMG_Mk200_F";
_player addPrimaryWeaponItem "muzzle_snds_H";
_player addPrimaryWeaponItem "acc_pointer_IR";
_player addPrimaryWeaponItem "optic_ERCO_blk_F";
_player addPrimaryWeaponItem "bipod_02_F_blk";
_player addWeapon "hgun_Pistol_heavy_01_F";
_player addHandgunItem "muzzle_snds_acp";
_player addHandgunItem "acc_flashlight_pistol";
_player addHandgunItem "optic_MRD_black";

// "Add items";
_player addItem "ItemMap";
_player addItem "ItemCompass";
_player addItem "ItemWatch";
_player addItem "ItemRadio";
_player addItem "Rangefinder";
};

Any help is appreciated. Thanks!