Freddywall 11 Posted September 26, 2020 I'm trying to make a script to move a specific player to the vehicle but it only works on AI FREDDY_FNC_GETINVEH = { private ["_unit"]; _unit = cursorTarget; _nearestVehicle = nearestObjects[getPosATL player,["Car","Ship","Submarine","Air"],10] select 0; if (isNil "_nearestVehicle") exitWith {}; _unit moveInCargo _nearestVehicle; }; Calling the function via the GUI: action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true];"; Share this post Link to post Share on other sites
gc8 970 Posted September 27, 2020 17 hours ago, Freddywall said: _unit = cursorTarget; this is why it only works on AI as player cant target him self 1 Share this post Link to post Share on other sites
pierremgi 4738 Posted September 27, 2020 1 hour ago, gc8 said: this is why it only works on AI as player cant target him self But you can target another player. Not sure he agrees, but it's another point. The problem here, is probably a locality issue as moveInCargo should run on target's PC. So a: [_unit, _nearestVehicle] remoteExec ["moveInCargo", _unit]; could work... Not tested. I don't understand the: action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true]; 1 Share this post Link to post Share on other sites
Freddywall 11 Posted September 27, 2020 2 hours ago, pierremgi said: But you can target another player. Not sure he agrees, but it's another point. The problem here, is probably a locality issue as moveInCargo should run on target's PC. So a: [_unit, _nearestVehicle] remoteExec ["moveInCargo", _unit]; could work... Not tested. I don't understand the: action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true]; it works, ty Share this post Link to post Share on other sites