Jump to content
Sign in to follow this  
speedshooter

Move a player into car

Recommended Posts

Hi, im trying to move a player into the back of a car using a script. It knows the player is near but it will not move him in. Heres what i have got.

Action:

CopAction9 = player addaction ["Put Civilian in Car","Ultimate-RP\Police\preArrest.sqf",[],1,true,true,"",'_vcl = (nearestobjects [getpos player, ["Air", "Ship", "LandVehicle"], 3] select 0);player distance _vcl < 5 and RPM_Cop'];

PreArrest.sqf

private ["_vcl","_target","_cop"];
_target = objNull;
_cop = _this select 0;
_vcl = (nearestobjects [getpos _cop, ["Air", "Ship", "LandVehicle"], 3] select 0);
{
   if(_x distance _vcl < 10)then
   {
       if(animationstate _x == "actspercmstpsnonwrfldnon_interrogate02_forgoten")then
       {
           _target = _x;
       };
   };
}forEach RPM_POBJArrCiv;
if(isNull _target)then
{
   _cop sideChat "No Civilians restrained Close to Vehicle";
}else{
   [_target,[_vcl, _target],"Ultimate-RP\Police\ClientArrest.sqf"] execVM "Ultimate-RP\CB.sqf";
};

ClientArrest.sqf

private ["_vcl","_target"];
_vcl = _this select 0;
_target = _this select 1;
_target moveInCargo _vcl;

CB.sqf

if(local(_this select 0))then
{
   (_this select 1) execVM (_this select 2) ;
}else{
   CodeBroadcast = _this;
   publicVariable "CodeBroadcast";
};

Share this post


Link to post
Share on other sites

Probably totally wrong but shouldn't

(_this select 1) execVM (_this select 2) ;

be

((_this select 1) select0) execVM ((_this select 2) select 1) ;

because you have [_vcl, _target] in an array within an array. You could just remove the brackets that might be better

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×