iceman77 18 Posted October 13, 2013 (edited) When the player respawns, I want to create a parachute & move the respawned player into the parachute. However, I'm not exactly sure how to do this for a dedicated server. I realize createVehicle is global & that I need to create the parachute on the server so they don't "multiply" for clients / server or use createVehicleLocal to create the parachute for the client. I'm not keen on invisible parachutes if using createVehicleLocal, so that's a no go. How can I do this using a respawn EH? I could use isServer to create the chute, but then I get undefined variable when i try to move the player into the _chute, as the client doesn't know _chute exists because it was created on the server. If (!isDedicated) Then { Player AddEventHandler ["Respawn", {[_this select 0] Spawn fnc_pos;}]; }; WaitUntil {Alive (_this Select 0)}; if (isServer) then { _chute = "Steerable_Parachute_F" createVehicle [0,0,0]; _chute setPos [getPos (_this Select 0) select 0, getPos (_this Select 0) select 1, 350]; }; (_this Select 0) moveIndriver _chute; Or can I simply use createVehicle without isServer since the function is running on the respawned client? Edited October 13, 2013 by Iceman77 Share this post Link to post Share on other sites
mantls 2 Posted October 13, 2013 should the player be paradropped to where he died? try this: init.sqf (for example, just needs to be run on client) if (!isDedicated) then { _functions = [] execVM "functions.sqf"; waitUntil {!isNull player && scriptDone _functions}; player addEventHandler ["Respawn",{_this call fnc_paraRespawn}]; }; functions.sqf fnc_paraRespawn = { if (!isServer) exitWith {}: _unit = _this select 0; _corpse = _this select 1; _oldPos = getPos _corpse; _newPos = [_oldPos,(random 100),random 360] call bis_fnc_relPos; _finalPos = [_oldPos select 0,_oldPos select 1,100]; _chute = createVehicle ["NonSteerable_Parachute_F", _finalPos, [], 0, "NONE"]; _chute setPos _finalPos; _chute allowDamage false; // Optional, just to make sure _unit moveInDriver _chute; }; Share this post Link to post Share on other sites
iceman77 18 Posted October 13, 2013 Hi. No he won't be paradropped where he died. I was just trying to provide the info in simple form. At any rate, thankyou very much for the code. It is very much appreciated. Share this post Link to post Share on other sites
mantls 2 Posted October 13, 2013 oh ^^ well, i hope i answered your question anyway. Just pass player into a variable, that way you can do most of your stuff on the server. Share this post Link to post Share on other sites
iceman77 18 Posted October 13, 2013 (edited) oh ^^ well, i hope i answered your question anyway.Just pass player into a variable, that way you can do most of your stuff on the server. Yes it helped a great deal. :cool: ---------- Post added at 20:56 ---------- Previous post was at 19:05 ---------- nvm. Sorted. Again.. thanks! Edited October 13, 2013 by Iceman77 Share this post Link to post Share on other sites