Jump to content
Sign in to follow this  
ROTAHOE

Custom loadout for WEST, EAST......(Help)

Recommended Posts

This is working but if a new player connects and spawns its giving players on the other team their loadout addWeapon etc.

Each side has a specific unit I.e: west = "B_engineer_F", east=  "O_engineer_F" and res = I_engineer_F then each units class has its own loadout.sqf

private "_this";
_this = _this select 0;

{ 
if (typeof _this == "B_engineer_F") then { [_this] execVM "loadouts\Blu_gear.sqf"};

} forEach units group _this;


{

if (typeof _this == "O_engineer_F") then { [_this] execVM "loadouts\Op_gear.sqf"};

} forEach units group _this;


{

if (typeof _this == "I_engineer_F") then { [_this] execVM "loadouts\Ind_gear.sqf"};

} forEach units group _this;

then if its B_engineer_F it call this

 

Blu_gear.sqf

waitUntil {!isNull player};
waitUntil {alive player};

["UsaSZ",800,"You have now entered the USA safe zone!","You are now vulnerable! Good luck!",1] exec "scripts\NoKillZone.Sqs";

removeAllWeapons player;
removeBackpack player;

player addweapon "arifle_Katiba_C_F";
player addmagazine "30Rnd_65x39_caseless_green";
player addmagazine "30Rnd_65x39_caseless_green";
player addmagazine "30Rnd_65x39_caseless_green";

player addweapon "hgun_P07_F";
player addmagazine "16Rnd_9x21_Mag";
player addmagazine "16Rnd_9x21_Mag";
player addmagazine "16Rnd_9x21_Mag";

player additem "FirstAidKit";

Its call via init.sqf  

call compile preprocessFileLineNumbers "playerSpawned.sqf";
player addEventHandler ["respawn", {_this execVM "playerSpawned.sqf"}];

units init.

null = [this] execVM "loadouts\Blu_gear.sqf";

 

 

Respawning is working without the issue. It only takes effect when new players connect ?

 

Do I need the code in units init? If you know the fix please post and explain why its doing it if possible.

Thank you in advance !

Share this post


Link to post
Share on other sites

Place the code in init.sqf to be run in initPlayerLocal.sqf.

You can do what you need in initplayerLocal.sqf, so disregard the init field of the unit.

 

On the other hand, if you like to work with the init field of the units, as the code runs on each JIP, you have to wait for the player to be local (on player's PC) and target this player only. In the units init field, write something like:

0 = this spawn { waitUntil {sleep 0.5; isPlayer _this && local _this}; [this] execVM "loadouts\Blu_gear.sqf"};

I repeat you can execVm, directly in initplayerLocal.sqf, instead.

  • Like 1

Share this post


Link to post
Share on other sites

@pierremgi

That way was giving me JIP issues now using   switch (_role) do.

Thanks for your help anyway mate ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×