Jump to content
Sign in to follow this  
nullsystems

crate contents only show for one player?

Recommended Posts

Hi all, real quick problem:

I have a addaction which spawns an ammo crate.

1: It appears to everyone, everyone can see it.

2: The cargo/weapons only show for the person who spawned it.

Can anyone figure out why only the person who spawned it can view its contents?

I was thinking of adding: publicVariable "ammocrate";

Under the other public variable?

--------

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

ammocrate = "Reammobox" createvehicle [getpos heli1 select 0,((getpos heli1 select 1)-2),1];

ammocrate addweaponcargo ["Binocular",1];

ammocrate addweaponcargo ["NVGoggles",1];

ammocrate addmagazinecargo ["30Rnd_9x19_MP5SD",2];

ammocrate addmagazinecargo ["15Rnd_9x19_M9SD",2];

ammocrate addmagazinecargo ["30Rnd_556x45_Stanag",2];

ammocrate addmagazinecargo ["30Rnd_556x45_StanagSD",2];

ammocrate addmagazinecargo ["200Rnd_556x45_M249",1];

ammocrate addmagazinecargo ["5Rnd_762x51_M24",2];

ammocrate addmagazinecargo ["100Rnd_762x51_M240",1];

ammocrate addmagazinecargo ["1Rnd_HE_M203",2];

ammocrate addmagazinecargo ["M136",1];

ammocrate addmagazinecargo ["HandGrenade",2];

ammocrate addmagazinecargo ["HandGrenadeTimed",2];

ammocrate addmagazinecargo ["SmokeShell",2];

ammocrate addmagazinecargo ["Mine",1];

CRATEAMOUNT = CRATEAMOUNT +1;

if (isServer) then

{

      publicVariable "CRATEAMOUNT";

}

else

{

};

if (true) exitWith {};

Share this post


Link to post
Share on other sites

I think the createVehicle has global effect, which means that no matter on which computer you run this command, the result is broadcasted over network to all computers, so everybody sees the created ammo crate.

But the addMagazineCargo is local - it's effects are local to the computer where you run the command.

Either you need to make sure the addMagazineCargo is used on the server machine, or you need to use it on all machines (all clients, and server).

Please note that i haven't used this command in ArmA MP environment yet, so i am only guessing, and my guess is you need to run the addMagazineCargo command on all computers.

...you can try first to make sure the addMagazineCargo is run on the server machine only, and if that does not help, then it will be evident that you need to use it on all machines (all clients, and server too).

Share this post


Link to post
Share on other sites
Please note that i haven't used this command in ArmA MP environment yet, so i am only guessing

You are correct.

No weapons show as nullsystems say.

Now, I don't know if the "call" addAction is local or not, if it isn't and your (nullsystems)

publicVariable "CRATEAMOUNT";

Does broadCast to the clients.

Create the ammo crate and fill it with ammo on the server as 5133p39 suggests.

It "should" do the trick.

Locality, isn't it sweet?

I would really want to know why BIS has implemented this thing at all actually.

[edit]

Perhaps someone with the proper rights could update the wiki on this addWeapon/MagazineCargo matter?

Share this post


Link to post
Share on other sites

Hmm, im not sure on how to do that.

I can see that the ammocrate is made...but no the ammo.

So how EXACTLY do I run the addmagazinecargo and addweaponcargo on all machines?

Quite confusing.

Share this post


Link to post
Share on other sites

my suggestion would be

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

if (isServer) then

{

_ammocrate = "Reammobox" createvehicle [getpos heli1 select 0,((getpos heli1 select 1)-2),1];

_ammocrate addweaponcargo ["Binocular",1];

_ammocrate addweaponcargo ["NVGoggles",1];

_ammocrate addmagazinecargo ["30Rnd_9x19_MP5SD",2];

_ammocrate addmagazinecargo ["15Rnd_9x19_M9SD",2];

_ammocrate addmagazinecargo ["30Rnd_556x45_Stanag",2];

_ammocrate addmagazinecargo ["30Rnd_556x45_StanagSD",2];

_ammocrate addmagazinecargo ["200Rnd_556x45_M249",1];

_ammocrate addmagazinecargo ["5Rnd_762x51_M24",2];

_ammocrate addmagazinecargo ["100Rnd_762x51_M240",1];

_ammocrate addmagazinecargo ["1Rnd_HE_M203",2];

_ammocrate addmagazinecargo ["M136",1];

_ammocrate addmagazinecargo ["HandGrenade",2];

_ammocrate addmagazinecargo ["HandGrenadeTimed",2];

_ammocrate addmagazinecargo ["SmokeShell",2];

_ammocrate addmagazinecargo ["Mine",1];

CRATEAMOUNT = CRATEAMOUNT +1;

publicVariable "CRATEAMOUNT";

};

IF The server is called upon when players are using actions, something I do not know.

Share this post


Link to post
Share on other sites

The script has to be run on all clients. The AddMagazine/AddWeapon commands are local, but this may change (see here for more details).

Share this post


Link to post
Share on other sites

How about adding:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_crate = ammocrate;

publicVariable "_crate";

Also, Ive seen 'reveal'

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

player reveal _crate;

Think they may work ?

Share this post


Link to post
Share on other sites

Dunno, try?

And try

ammocrate = "Reammobox" createvehicle [getpos heli1 select 0,((getpos heli1 select 1)-2),1];

nil = ammocreate execVM "addMagazinesAndWeapons.sqf";

?

My thought here was that all clients has the script, and that way the ammobox will fill with stuff?

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  

×