private["_ent"];
player removeAction s_player_dance;
s_player_dance = -1;
_danceMoves = ["ActsPercMstpSnonWnonDnon_DancingDuoStefan","ActsPercMstpSnonWnonDnon_DancingDuoIvan","ActsPercMstpSnonWnonDnon_DancingStefan"] call BIS_fnc_selectRandom;
_neardanceing = false;
_nearestplayers = nearestObjects [player, ["CAManBase"], 50];
_cntnearestplayer = count _nearestplayers;
if (_cntnearestplayer > 0) then {
{
_model = typeOf _x;
if (_model in AllPlayers) then {
_vari = _x getVariable["danceing",0];
if !(_vari == 0) then {
_neardanceing = true;
};
};
} foreach _nearestplayers;
};
if !(_neardanceing) then {
_nul = [objNull, player, rSAY, "fox"] call RE;
player setVariable ["danceing", 1, true];
};
player playMove _danceMoves;
cutText ["RedneX in da house !!","PLAIN DOWN"];
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_finished = false;
_started = false;
while {r_doLoop} do {
_animState = animationState player;
_isDancing = [_danceMoves,_animState] call fnc_inString;
if (_isDancing) then {
_started = true;
};
if (_started and !_isDancing) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt) then {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
if (_finished) then {
cutText ["WTF are you doing bro ?","PLAIN DOWN"];
player setVariable ["danceing", nil, true];
} else {
r_interrupt = false;
player setVariable ["danceing", nil, true];
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Dance stopped! ;(","PLAIN DOWN"];
};