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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...