Jump to content

Be carefull with remoteexec and "owner"


He-Man

Recommended Posts

I noticed, that we have to use remoteexec very carefully!

While many tests, I found out, that the following code is very dangerous:

_owner = owner _vehicle;

[_blabla,_blablabla] remoteexec ["xxx",_owner];

If _vehicle does not exists (because of a script failure or the vehicle no longer exists), the remoteexec will be executed on every client.

 

Same for:

[_blabla,_blablabla] remoteexec ["xxx",(owner _vehicle)];

 

Better use directly:

[_blabla,_blablabla] remoteexec ["xxx",_vehicle];

If here the _vehicle does not exist, nothing will be executed.

 

From https://community.bistudio.com/wiki/remoteExec:

Object - the function will be executed only where unit is local

 

So NEVER use the owner of anything for remoteexec!!!

 

Some Epoch codes are also using the owner for remoteexecs.

This should be changed...  

Link to comment
Share on other sites

  • vbawol featured this topic
Quote

On server machine, returns the ID of the client where the object is local. Otherwise returns 0. For use on clients clientOwner command is available. To find out the owner of a Group, use groupOwner.

If you want to use owner carefully, just check the object presense before with !isNull(object) as a condition. You also may check for some object parameters, since sometimes object may leave reference to it in server memory (known problem of Object not found. on server) with something like damage, getHit, or any global variable present on object.

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...