private ["_amount","_id","_i","_timer"]; //no idea if these are needed
waituntil {alive player}; // waits till player is logged in
// loop that checks if player has been detained
// globalization: reassigns variable and animation if player forces client to close
// Timer resets if released and re-detained, or if player forces client to close and rejoins
sleep 10;
_amount = 600;
_timer = 600;
while {true} do {
// Checking if player is in animation (for combat loggers)
if ((getPlayerUID player) in PVDZ_ply_Arrst) then {
detained = true;
if (player getVariable "Detain" == 1) then {
// player is in proper animation?
} else {
// if player forces client close re-animation
player setVariable ["Detain",1,true];
sleep 10;
[objNull, _newCiv, rswitchmove ,"CivilSitting"] call RE;
};
sleep 10;
player disableSimulation false; // less intense disable input (not sure if we can force players into cars with this disabled)
} else {
detained = false;
};
while {detained} do {
// Timer counting down from 600 seconds, restarted if re-detained or logging out and back in.
for "_i" from 0 to _timer do {
cutText [format["You are tied up for %1 seconds",_amount], "PLAIN"];
sleep 1;
_amount = _amount-1;
// If released ends timer and starts the release process.
if (player getVariable "Detain" == 0) then {
_amount = 0;
_timer = 0;
};
};
// release process
if (_amount < 1) then {
player setVariable ["Detain",0,true];
detach player;
player disableSimulation true;
[objNull, player, rswitchmove,""] call RE;
if (!isnil ("PVDZ_ply_Arrst")) then {
// id removed from array
_id = getPlayerUID player;
PVDZ_ply_Arrst= PVDZ_ply_Arrst-[_id];
publicVariable "PVDZ_ply_Arrst";
} else {
// just incase something goes wrong undefine the variable
PVDZ_ply_Arrst= nil;
publicVariable "PVDZ_ply_Arrst";
};
detained = false;
_amount = 600;
_timer = 600;
};
};
};