When I was writing my script, I wanted to create my own script for closing and opening the technique.
I am new to writing scripts and therefore used various sources from the Internet. I managed to create such a script, but its correctness leaves much to be desired.
Below I have given what I got. But this is not exactly what I wanted, at first I can't make it so that the close button is displayed again during the open close iteration.
Help me figure this out, point out what I should pay attention to.
/* 0 = [] execVM "addAction.sqf"; */
respMash addAction ["<t color='#00FF00'>Expand the KSHM</t>",
{
myResp = [west, "respMash"] call BIS_fnc_addRespawnPosition;//Creates a respawn point in the technique
player addEventHandler ["GetInMan",//Creating a GetInMan event - if a person is inside
{
["respMash","player"];//GetInMan parameters = true
player moveOut respMash;//Action when true. Will land the player
}];
respMash setVehicleLock "LOCKED";//Completely blocks the technique
hint parseText "<t size='2.0'>KSHM IS DEPLOYED</t>";//Outputs a hint
respMash removeAction 0;//deletes the line of the action Expand KShM
respMash addAction ["<t color='#FF0000'>Collapse the KSHM</t>",//addAction Parameters Collapse KSHM
{
myResp = [west, 0] call BIS_fnc_removeRespawnPosition;//Removing the respawn point in the technique
respMash setVehicleLock "UNLOCKED";//We will completely unlock the equipment
player removeAllEventHandlers "GetInMan";
hint parseText "<t size='2.0'>KSHM IS COLLAPSED</t>";//Outputs a hint
respMash removeAction 1;
},
nil, 1.5, true, true, "", "", 5];//addAction Parameters Collapse KSHM
player moveOut respMash;//It will land the player if he teleports to respMash = car
},
nil, 1.5, true, true, "", "", 5];//addAction Parameters Expand KSM
respMash addEventHandler ["Killed",//The event in which the equipment is destroyed
{
myResp = [west, 0] call BIS_fnc_removeRespawnPosition;
respMash removeAction 0;
respMash removeAction 1;
}];