Jump to content
Sign in to follow this  
1para{god-father}

Help on script after removal of processInitCommands

Recommended Posts

Am I missing something?

I know how public variables work, I'm just not keen on having to edit every mission I might wish to host.

Share this post


Link to post
Share on other sites
Sure, but like I first said, it would be even better to cut these kiddies off at the knees by preventing clients from injecting their own scripts rather than just trying to limit the damage they can do.

Sure, but isn't that exactly what you're doing with your addons? Sending code via setvehicleinit is just the same ?

Unless you're going to expect server admins to depbo their allowed addons, read through it and add each of it's setvehicleinit calls etc to the filters?

Just installing mods is hard enough for most server admins. Expecting them to work out the filtering system from A2OA with BE? It only really worked for places that ran just one singular mission. DayZ, or Wasteland, or whatever.

It's pretty useless if you have a mission cycle.

Share this post


Link to post
Share on other sites
What do you think BIS_fnc_MP is?

and how is that as easy to use when you have to create functions for it?

Share this post


Link to post
Share on other sites
I know how public variables work, I'm just not keen on having to edit every mission I might wish to host.

Why the shit would you have to edit the mission? I honestly have no clue why you're saying these things.

Do you think you need a PVEH? No, you don't.....

As before, you simply PV the function, then call it using BIS_fnc_MP, and it'll run that function on all clients.

Otherwise, tell me. What do you need to add into your missions that's so damned impossible with the above explanation? If you can call 'setvehicleinit', then surely you can call other things too?

Edited by Radioman

Share this post


Link to post
Share on other sites
As before, you simply PV the function, then call it using BIS_fnc_MP, and it'll run that function on all clients.

I'll give that a go, it's just that every explanation of BIS_Fnc_Mp I've seen here has indicated that the function needs to be pre-defined.

Great if it works but then I have to wonder what has actually been achieved by removing SetVehicleInit?

Share this post


Link to post
Share on other sites
and how is that as easy to use when you have to create functions for it?

It has been said million times that transferring the code over network is bad idea. This is also one of the reasons those functions got removed, security and inefficiency.

But you can still make your mission insecure and inefficient by adding your own function

add this in init.sqf

runmycode = {call compile _this};

run this from anywhere

["hint 'OH MY GOD ITS WORKING'","runmycode"] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites
Great if it works but then I have to wonder what has actually been achieved by removing SetVehicleInit?

You're pretty correct. So we all need to figure it out so that things can be made secure, vs reverting to old news. There's no real VIABLE way to communicate these solutions to BIS, as the feature tracker is a popularity contest, and the forums are a mess of old news and dribble. So, yeah, we need to figure that one out first.

Share this post


Link to post
Share on other sites
You're pretty correct. So we all need to figure it out so that things can be made secure, vs reverting to old news. There's no real VIABLE way to communicate these solutions to BIS, as the feature tracker is a popularity contest, and the forums are a mess of old news and dribble. So, yeah, we need to figure that one out first.

Because it would run on all machines when you create a vehicle whether you wanted it or not, so a hacker could execute code on each client by just creating a vehicle. Also old MP framework with RE was flawed for the same reason. Now you cannot send code and execute it over network, you have to have a function name you want to execute instead and this is where you can control as mission maker what is going on and what should and should not happen.

Share this post


Link to post
Share on other sites
Because it would run on all machines when you create a vehicle whether you wanted it or not, so a hacker could execute code on each client by just creating a vehicle. Also old MP framework with RE was flawed for the same reason. Now you cannot send code and execute it over network, you have to have a function name you want to execute instead and this is where you can control as mission maker what is going on and what should and should not happen.

Your answer has little-to-no relation to my post... unless you meant to quote Defunkt?

If a hacker can run 'setvehicleinit' then a hacker can run 'PV a variable, and BIS_fnc_MP it'.... Which is exactly how that virus came into being.

Share this post


Link to post
Share on other sites

I'do agree with Radioman. You can still run bad code on everyone machine with this :

[{player setpos [0,0,1000]},"BIS_fnc_spawn"] spawn BIS_fnc_MP;

And even if BIS removed the Bis_fnc_spawn from the library, hacker can still modify memory to run any script on their machine. As you know some script have global effect, like createvehicle, setpos, setdamage etc. So even with the removal of theses commands, someone with the will to ransack a game can do it.

From my experience the only things BIS can do to make the game more secure and multiplayer fair, is either to :

-Make all the scripts commands having global effect and running only on the host/server (a true client/server architecture).

-Make all the scripts commands having only local effect (which is quiet problematic when in multiplayer you want the majority of stuff to be the same on each computer).

Share this post


Link to post
Share on other sites
I'do agree with Radioman. You can still run bad code on everyone machine with this :

[{player setpos [0,0,1000]},"BIS_fnc_spawn"] spawn BIS_fnc_MP;

And even if BIS removed the Bis_fnc_spawn from the library, hacker can still modify memory to run any script on their machine.

Correct on point 1, but wrong on point 2. You can edit your own memory, etc, and implant any code you like, but to execute it over the network, I suppose is a fault of BIS_fnc_MP, which, is essentially STILL a problem, if it can be used for non-BIS functions.

BIS needs to only allow BIS_fnc_MP run BIS functions, and get rid of/fix any functions that call compile / spawn etc from passed params.

But, it appears that BIS is pretty hard-set on keeping fnc_MP as is, and I can't communicate the above to BIS because of the aforementioned flaws in their feedback tracker, and the forums.

Share this post


Link to post
Share on other sites

Well, this BIS_fnc_MP really doesn't work for me, this is how I'm using it and it will only show the action for the server and not clients even though it's being told to execute on all clients. Here's just the relevant parts of the script:

// Create addAction function

CF_addactionMP =

		{

		private["_actName","_object","_screenMsg","_scriptToCall"];
		_actName = _this select 0;
		_object = _this select 1;
		_screenMsg = _this select 2;
		_scriptToCall = _this select 3;

		if(isNull _object) exitWith {};

	_actName = _object addaction [_screenMsg,_scriptToCall];

	};



if (isServer) then {

// Create cargo box and attach it to the vehicle (Settings are for c_offroad class only)

       _cargobox1 = createVehicle ["B_supplyCrate_F", getPos _veh1, [], 0, "NONE"];
sleep 2;
_cargobox1 attachTo [_veh1, [0,-2.0,-0.65]];
_cargobox1 setDir 90;



// Add action to vehicle

[[action1,_cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",_cargobox1,true] spawn BIS_fnc_MP;

};

Is there anything wrong with this or does this function just not work properly?

Edited by clydefrog

Share this post


Link to post
Share on other sites
Well, this BIS_fnc_MP really doesn't work for me, this is how I'm using it and it will only show the action for the server and not clients even though it's being told to execute on all clients. Here's a cut down version of the script:

// Create addAction function

CF_addactionMP =

		{

		private["_actName","_object","_screenMsg","_scriptToCall"];
		_actName = _this select 0;
		_object = _this select 1;
		_screenMsg = _this select 2;
		_scriptToCall = _this select 3;

		if(isNull _object) exitWith {};

	_actName = _object addaction [_screenMsg,_scriptToCall];

	};



if (isServer) then {

// Create cargo box and attach it to the vehicle (Settings are for c_offroad class only)

       _cargobox1 = createVehicle ["B_supplyCrate_F", getPos _veh1, [], 0, "NONE"];
sleep 2;
_cargobox1 attachTo [_veh1, [0,-2.0,-0.65]];
_cargobox1 setDir 90;



// Add action to vehicle

[[action1,_cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",_cargobox1,true] spawn BIS_fnc_MP;

};

Is there anything wrong with this or does this function just not work properly?

_cargobox1 is an object that is local to the server. So thus, it'll only run the function on the server.

To quote the wiki: "Object - function will be executed only where unit is local [default: everyone]"

So, call this:

[[action1,_cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",nil,true] spawn BIS_fnc_MP;

Should work, but I don't think you can just send an object over the network, and have it mean anything on the client's side.

So, you'll need to send the _cargobox1's netID. So, this:

[[action1,netid _cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",nil,true] spawn BIS_fnc_MP;

and modify your CF_addactionMP function to this:

CF_addactionMP =

		{

		private["_actName","_object","_screenMsg","_scriptToCall"];
		_actName = _this select 0;
		_object = objectFromNetID (_this select 1);
		_screenMsg = _this select 2;
		_scriptToCall = _this select 3;

		if(isNull _object) exitWith {};

	_actName = _object addaction [_screenMsg,_scriptToCall];

	};

Share this post


Link to post
Share on other sites
Correct on point 1, but wrong on point 2. You can edit your own memory, etc, and implant any code you like, but to execute it over the network, I suppose is a fault of BIS_fnc_MP, which, is essentially STILL a problem, if it can be used for non-BIS functions.

I was speaking about scripting command on hacker local machine, which has global effect. This is a problem since OFP. It's less vulnerable than executing full script on everyone computer, but still, ruining a game with one script command with global effect is far too easy...

Edited by L etranger

Share this post


Link to post
Share on other sites
_cargobox1 is an object that is local to the server. So thus, it'll only run the function on the server.

To quote the wiki: "Object - function will be executed only where unit is local [default: everyone]"

So, call this:

[[action1,_cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",nil,true] spawn BIS_fnc_MP;

Should work, but I don't think you can just send an object over the network, and have it mean anything on the client's side.

So, you'll need to send the _cargobox1's netID. So, this:

[[action1,netid _cargobox1,"Unload Cargo","scripts\carintel1.sqf"],"CF_addactionMP",nil,true] spawn BIS_fnc_MP;

and modify your CF_addactionMP function to this:

CF_addactionMP =

		{

		private["_actName","_object","_screenMsg","_scriptToCall"];
		_actName = _this select 0;
		_object = objectFromNetID (_this select 1);
		_screenMsg = _this select 2;
		_scriptToCall = _this select 3;

		if(isNull _object) exitWith {};

	_actName = _object addaction [_screenMsg,_scriptToCall];

	};

Thanks I will try this. I thought it might be something to do with the object being local. Would just changing it to a global name so it is called "cargobox1" instead also get around the problem?

Share this post


Link to post
Share on other sites
Thanks I will try this. I thought it might be something to do with the object being local. Would just changing it to a global name so it is called "cargobox1" instead also get around the problem?

No, that wont fix the problem. I've told you how to fix the problem.... Exactly how. Do that, and it's fixed.

---------- Post added at 21:01 ---------- Previous post was at 21:01 ----------

I was speaking about scripting command on hacker local machine, which has global effect. This is a problem since OFP. It's less vulnerable than executing full script on everyone computer, but still, ruining a game with one script command with global effect is far too easy...

Well, for now, lets stick to stopping the crazier stuff like free-roaming viruses and stuff and executing code, vs global effect functions from one client.

Share this post


Link to post
Share on other sites
No, that wont fix the problem. I've told you how to fix the problem.... Exactly how. Do that, and it's fixed.

Will do, I've edited it and will try and test with a friend again some time today, cheers.

By the way, the examples on this page

https://community.bistudio.com/wiki/BIS_fnc_MP

use spawn BIS_fnc_MP but these were examples from the Take On Helicopters page for this function, it says it should actually use Call for execution in Arma 3, will that make any difference?

Edited by clydefrog

Share this post


Link to post
Share on other sites

If a hacker can run 'setvehicleinit' then a hacker can run 'PV a variable, and BIS_fnc_MP it'.... Which is exactly how that virus came into being.

They can always stop publicVariable from transmitting code.

Share this post


Link to post
Share on other sites
They can always stop publicVariable from transmitting code.

They could, and that'd be a nice step in the right direction, but then it breaks addons running things over the network for non-addon running clients. So, they need to do a radical redesign/implementation of this entire spectrum of the scripting engine. Essentially, allowing only the server to BIS_fnc_MP, but also some kind of addon thing too, I don't really know.

Essentially, we can't say "Oh, thingA needs that function, so don't remove/change it", as that doesn't fix the REAL problem. What needs to be discussed is the way to solve all problems, not just create more.

---------- Post added at 21:21 ---------- Previous post was at 21:20 ----------

Will do, I've edited it and will try and test with a friend again some time today, cheers.

By the way, the examples on this page

https://community.bistudio.com/wiki/BIS_fnc_MP

use spawn BIS_fnc_MP but these were examples from the Take On Helicopters page for this function, it says it should actually use Call for execution in Arma 3, will that make any difference?

I'd just use call. I'd say that page is a little wrong currently, and all BIS_fnc_MP calls within the function library use call also.

Share this post


Link to post
Share on other sites
They could, and that'd be a nice step in the right direction, but then it breaks addons running things over the network for non-addon running clients. So, they need to do a radical redesign/implementation of this entire spectrum of the scripting engine. Essentially, allowing only the server to BIS_fnc_MP, but also some kind of addon thing too, I don't really know.

Essentially, we can't say "Oh, thingA needs that function, so don't remove/change it", as that doesn't fix the REAL problem. What needs to be discussed is the way to solve all problems, not just create more.

Well considering it is Alpha they should just do it. People porting addons will have to adjust them anyway, might as well improve them while at it.

Share this post


Link to post
Share on other sites

Something I don't understand.

You need publicVariable to make sure some things update on clients, and at the same time it seems everyone agrees that it screws people over (and is a bandwidth hog). How the heck would you update markers on a map for a MPMission without telling all clients to update it for example? I mean, no matter what, at SOME POINT, you need to send stuff to clients and force them to update...

1) What does "too frequently" in the wiki means? Does updating 3 or 4 markerPos in a row without any pause "too frequent"? What about 10? 20?

2) Also, is it better to just pack EVERYTHING in an array and publicVariable that array once and for all, or spread out the publicVariable here and there?

3) What about addPublicVariableEventHandler, isn't that purely client side once the map is loaded? Why would the server handle anything related to that once the client is connected and you publicVariable whatever you needed updated?

4) isn't BIS_fnc_MP an insane bandwidth hog since you send the entire functions everytime, to everyone? I mean, compared to a little marker update variable, that seems crazy. In Tonic example about vehicule lock, why wouldn't just have a variable store your lock state on the server, PV and in the PVhandler, do your thing? Seems WAY more efficient if handlers are handled 100% by the client. That could apply to everything...need to run something on clients, just make PV some "doFuncVar" or your choice and PV it...no? :)

I'm probably completely off the ball park here but would love to understand...

Edited by Twix

Share this post


Link to post
Share on other sites
Something I don't understand.

You need publicVariable to make sure some things update on clients, and at the same time it everyone seem to agree that it screws everyone over. How the heck would you update markers on a map for a MPMission without telling all clients to update it for example? I mean, no matter what, at SOME POINT, you need to send stuff to clients and force them to update..

Yes, PublicVariable is fine. Just it's ability to send code isn't. That's all. You can update your markers fine, because you've no reason to have to PublicVariable the code to do so....

Share this post


Link to post
Share on other sites
Because it would run on all machines when you create a vehicle whether you wanted it or not, so a hacker could execute code on each client by just creating a vehicle.

You can still do that with the createUnit command i believe.

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  

×