Jump to content
  • 0

Spawn a vehicle from client


shurix

Question

I figured out how to spawn a vehicle from a client-side addaction without getting vehicle cleaned by the server cleanup.

 

You will need a new file in your custom_server.pbo @EpochHive\Addons\custom_server\Init.sqf containing:

"EPOCH_TEMPOBJ_SAVE" addPublicVariableEventHandler{
	_veh = (_this select 1);
	_veh call EPOCH_server_setVToken;
	_veh setVariable["LASTLOGOUT_EPOCH",1000000000000];
	_veh setVariable["LAST_CHECK",1000000000000];
};

Now, from your client where you are creating the vehicle, call this new handler

	_vehObj=createVehicle[_vehClass,_position,[],0,"NONE"];
	EPOCH_TEMPOBJ_SAVE = _vehObj;
	publicVariableServer "EPOCH_TEMPOBJ_SAVE";

Now, I do not run stock AH or BattleEye on my server. If you do, you may need to come up with additional filters.

 

This code works for me. I'm getting vehicles created and they live until restart.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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