Jump to content
  • 0

if nearestObjects.... help :(


StiflersM0M

Question

hey guys, i want to insert a dace script in my server but i dont want that you can dance 150M around a plot pole, my first try was this:

if nearestObjects [player, ["Plastic_Pole_EP1_DZ"], 150] then {
cutText [format["You can not dance 150M around a plot pole"], "PLAIN DOWN"];
} else {
player playMove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";
};

But it doesnt work, anybody has a idea how i get this working ?

i am not a scripting master ^^ thats my first try :D

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

hmmm, seems not to work >.< full script now look so:

if (nearestObjects [player, ["Plastic_Pole_EP1_DZ"], 150]) then {
cutText [format["You can not dance 150M around a plot pole"], "PLAIN DOWN"];
} else {
player playMove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";
_isDancing = ["ActsPercMstpSnonWnonDnon_DancingDuoIvan",_animState] call fnc_inString;

r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
 
    while {r_doLoop} do {
        _animState = animationState player;
        _isDancing = ["ActsPercMstpSnonWnonDnon_DancingDuoIvan",_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 {
 
 
} else {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
};

Can you write the nearestObjects count for me ? cause i dont know what you mean :P

Link to comment
Share on other sites

  • 0

This is to stop people dancing through the walls? Good point. Never thought that.

 

This should work

_countPoles = count nearestObjects [player, ["Plastic_Pole_EP1_DZ"], 150];

if (_countPoles > 0) then {
cutText [format["You can not dance 150M around a plot pole"], "PLAIN DOWN"];
} else {
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...