Jump to content
Sign in to follow this  
spitfire007

Is it possible to add a addaction menu to a client that calls a SQF from the server ?

Recommended Posts

I have been able to implement this code and it works on my dedicated server run with TADST on my machine on the LAN.

BUT if the other player on the LAN picks up the pack the action menu does not appear as it does on mine.

I see Request Extraction but the other player does not. Only I can call the Heli in when I have the backpack on.

player addAction ["Request Extraction","server\extraction.sqf",[],1,false,false,"","(typeOf  unitBackPack _this) == 'US_UAV_Pack_EP1'"];

It works fine on my machine. There are no errors in RPT either.

Looking at a LOT of threads I think it might be possible using a addPublicVariableEventHandler but I have NO idea how to do it.

Share this post


Link to post
Share on other sites

You can't access the server files as a client. You have to have them on the client or send them to the client from the server as a pubvar. You could send the files from the server to the clients during initialization or make a system that retrieves the files upon request.

Share this post


Link to post
Share on other sites
I have been able to implement this code and it works on my dedicated server run with TADST on my machine on the LAN.

BUT if the other player on the LAN picks up the pack the action menu does not appear as it does on mine.

I see Request Extraction but the other player does not. Only I can call the Heli in when I have the backpack on.

player addAction ["Request Extraction","server\extraction.sqf",[],1,false,false,"","(typeOf  unitBackPack _this) == 'US_UAV_Pack_EP1'"];

It works fine on my machine. There are no errors in RPT either.

Looking at a LOT of threads I think it might be possible using a addPublicVariableEventHandler but I have NO idea how to do it.

I'm not sure what Viba's talking about, perhaps he's looking at it from a different perspective, I assume that server/extraction.sqf is included in the mission file, thus available to clients AND servers (afaik).

Where precisely are you executing this addaction line? Under init.sqf or somewhere else?

Share this post


Link to post
Share on other sites

I was assuming that only the server has the server/extraction.sqf script and folder, not included in the mission file.

Share this post


Link to post
Share on other sites

If the mission init has an if (isServer) condition to the script being compiled, the client won't have access. It won't compile on their side, only on the server. Public variable is the only way I know to execute communication between the two.

The code executed clientside (your backpack addaction) sets a public variable and broadcasts it. The server event handler detecting the correct value in the variable executes the server script. It can also work vice-versa server to client.

But if you want the action available to clients make sure there's no (isServer) condition on it.

Edited by OpusFmSPol
corrected error as to which used the handler

Share this post


Link to post
Share on other sites

The code above is executed client side but I have put the file extraction.sqf on the server in another directory which is not on the clients machines.

So I guess that is the problem.

I had better start looking into how to use Public Variables.

Thanks very much to you all for looking at my problem.

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  

×