Jump to content
  • 0

Calling server side files


Guest BenR

Question

7 answers to this question

Recommended Posts

  • 0

you can yep, it's all about prefix used in PBO, it defines path.

 

here's how it works:

 

init.sqf is considered to be sitting in the root of everything and is loaded automatically

 

you add someScript.sqf just besides, to access it you simply call

execVM "someScript.sqf";

Put this file in someFolder inside your mission file and now it becomes

execVM "someFolder\someScript.sqf";

Put it in client files, lets say dayz_code.pbo... this file has prefix property with value z\addons\dayz_code

so you call it like this

execVM "z\addons\dayz_code\someScript.sqf";

You can also put it in dayz_server.pbo... however only server will be able to load it, since clients have no physical copy of the file. Also dayz_server.pbo has a prefix with value z\addons\dayz_server, so:

if (isDedicated) then { //server only, clients ignores this, since file does not exist for them
execVM "z\addons\dayz_server\someScript.sqf";
};

In order to keep it server side, but clients to be able to access it, you need to send this file to them. This only works for scripts ofcourse, you can send a string using JIP (public variable) and compile it client side when received.

 

kinda like this:

Server:

variableToSend = "Diag_log text 'it works!'";
PublicVariable "variableToSend";

Client: 

_received = format ["%1", variableToSend]; //convert received text to string
call compile _received; //compile string into a code and launch it

Get the idea?

Link to comment
Share on other sites

  • 0

With public variables would I be able to add something server side that waits for a message from the client, then executes a script on the server. I'm working on something which uses DZMS functions so ideally need to put the script on the server in order to use this.

Thanks

Link to comment
Share on other sites

  • 0
Put it in client files, lets say dayz_code.pbo... this file has prefix property with value z\addons\dayz_code

so you call it like this

execVM "z\addons\dayz_code\someScript.sqf";

 

uhhmm....what ?

Isnt dayz_code.pbo part of the map files ? Why adding it there, since all client must have the same.pbo ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...