Jump to content
Sign in to follow this  
BEAKSBY

Can addAction be called from player in a vehicle?

Recommended Posts

Hi Folkes,

In my init.sqf script below, for MP, my player has to step out of his vehicle to call the addAction that executes "ArmorDrop.sqf" or "O_ArmorDrop.sqf", depending whether they are EAST or WEST.

Can an addAction be called from inside the vehicle, if so, how?

Part of my init.sqf:

waitUntil {!isNull player}; 

//////////////////////////////////////////////////// 
If (side player == WEST) then {// for west units  
    player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this and _this == _target && ((screenToWorld [0.5,0.5]) distance (_target) < 100)"] ; 
     player addEventHandler ["RESPAWN", {   
          player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this and _this == _target && ((screenToWorld [0.5,0.5]) distance (_target) < 100)"];
    }];   
} else {// change this for east units  
   player addAction ["<t color='#FF0000'>T-100 Varsuk $1200</t>", "O_ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this and _this == _target"] ; 
     player addEventHandler ["RESPAWN", {   
       player addAction ["<t color='#FF0000'>T-100 Varsuk $1200</t>", "O_ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this and _this == _target"];
    }];   
};    
///////////////////////////////////////////////////////////////////////////////////////// 

Share this post


Link to post
Share on other sites

Add the word vehicle before the _this, it causes it it to be true for a unit on foot or in vehicle.

player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this and vehicle _this == _target && ((screenToWorld [0.5,0.5]) distance (_target) < 100)"] ;

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  

×