Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
daniel1060

Things not working in muiltiplayer enviroment

Recommended Posts

 

Right so new to scripting in .SQF. What I've been trying to do is spawn an empty box and insert specific custom gear. In singleplayer, this works perfectly. However on the server when I spawn the box using an NPC with addaction which executes the spawn script blah blah blah, anyway only I can see the contents of the box despite trying every idea I could think of...

 

Spawn Script

Spoiler

if (isDedicated) then {
    _Box = addMPEventHandler{
        if (cash) < 1000 then {notenough.sqs} else {
            cash = cash - 1000;
            _SpawnWeaponBox = "CargoNet_01_box_F" createVehicle [3039,6062,0];

            
ClearWeaponCargo _SpawnWeaponBox; ClearMagazineCargo _SpawnWeaponBox; clearItemCargo _SpawnWeaponBox;


_SpawnWeaponBox addItemCargo ["optic_Aco",20];
_SpawnWeaponBox addItemCargo ["CUP_acc_ANPEQ_2",30];

 

_SpawnWeaponBox addMagazineCargo ["ACE_20Rnd_762x51_Mag_Tracer", 50];
_SpawnWeaponBox addMagazineCargo ["CUP_Javelin_M", 4];
_SpawnWeaponBox addMagazineCargo ["CUP_SMAW_HEAA_M", 10];
_SpawnWeaponBox addMagazineCargo ["CUP_SMAW_HEDP_M", 10];

 

_spawnWeaponBox addWeaponCargo ["CUP_srifle_AWM_wdl", 2];
_spawnWeaponBox addWeaponCargo ["CUP_srifle_M110", 10];
_spawnWeaponBox addWeaponCargo ["CUP_arifle_M16A4_Base", 40];
_spawnWeaponBox addWeaponCargo ["CUP_arifle_M16A4_GL", 20];
_spawnWeaponBox addWeaponCargo ["CUP_arifle_M4A1", 15];
_spawnWeaponBox addWeaponCargo ["CUP_arifle_M4A1_BUIS_desert_GL", 20];
_spawnWeaponBox addWeaponCargo ["CUP_arifle_M4A3_desert", 40];
_spawnWeaponBox addWeaponCargo ["CUP_srifle_M107_Base", 1];
_spawnWeaponBox addWeaponCargo ["CUP_launch_Javelin", 2];
_spawnWeaponBox addWeaponCargo ["CUP_launch_FIM92Stinger", 2];
_spawnWeaponBox addWeaponCargo ["CUP_launch_M136", 10];
_spawnWeaponBox addWeaponCargo ["CUP_launch_Mk153Mod0", 5];
_spawnWeaponBox addWeaponCargo ["CUP_hgun_M9", 10];
};
};
};

 
 
 

 

Also, I have a variable for money set as a global variable which is to be displayed via a hint but the hint shows up blank, IE. Hint ( You have: $1000000) but it shows up Hint (You have: $)

Init.sqf

Spoiler

if (isServer) then {
cash = 0;
_Setcash = execVM "cash.sqf";
_addcash = execVM "Add_cash_Rep.sqf";
};

 
 
 

 

cash.sqf

Spoiler

cash =1000000;

 

 

atm.sqf

Spoiler

_Showcash = call {hint str format ["You have: $%1",str cash]};

 

If you can help with either of these I would be extremely grateful

Share this post


Link to post
Share on other sites

Use the global variants of the cargo commands, else the items are only being added to the container on the machine where you use the action.

addItemCargoGlobal

addWeaponCargoGlobal

etc

  • Like 2

Share this post


Link to post
Share on other sites

×