Guest BenR Posted November 8, 2014 Report Share Posted November 8, 2014 Was just wondering, Is it possible to call a server side .sqf file from the client init.sqf. Or would the file have to be in the mission file? Thanks Link to comment Share on other sites More sharing options...
0 avdieking Posted November 8, 2014 Report Share Posted November 8, 2014 no its not possible it has to be inside the mission file Link to comment Share on other sites More sharing options...
0 raymix Posted November 8, 2014 Report Share Posted November 8, 2014 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 More sharing options...
0 Guest BenR Posted November 8, 2014 Report Share Posted November 8, 2014 Thanks for explaining, helps a lot. Link to comment Share on other sites More sharing options...
0 Guest BenR Posted November 11, 2014 Report Share Posted November 11, 2014 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 More sharing options...
0 Sandbird Posted November 11, 2014 Report Share Posted November 11, 2014 Put it in client files, lets say dayz_code.pbo... this file has prefix property with value z\addons\dayz_codeso 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 More sharing options...
0 TNT Posted November 11, 2014 Report Share Posted November 11, 2014 =] thanks for the info Link to comment Share on other sites More sharing options...
0 raymix Posted November 11, 2014 Report Share Posted November 11, 2014 uhhmm....what ? Isnt dayz_code.pbo part of the map files ? Why adding it there, since all client must have the same.pbo ? I was just explaining how files are loaded in general Link to comment Share on other sites More sharing options...
Question
Guest BenR
Was just wondering,
Is it possible to call a server side .sqf file from the client init.sqf. Or would the file have to be in the mission file?
Thanks
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now