Jump to content
Sign in to follow this  
mindbl4ster

initplayerlocal and passing playerobject properly?

Recommended Posts

hi there,

i tried various ways to handle this problem but nothing works as it should and now i do need help with it.

my intention is to pass the playerobject from the initplayerlocal.sqf to a function that should freeze him after spawning.

but actually i get the error that the function does not get the right form of parameters ?!

can somebody help me out with it please ?

thanks!

initplayerlocal.sqf:

_localplayer = [_this select 0];
[_localplayer ,true] call mbicr_fn_freeze;

fn_freeze:
private ["_listOfUnits","_conditionMovement"];

_listOfUnits = _this select 0;
_conditionMovement = _this select 1;

hint format ["%1, %2", _listOfUnits, _conditionMovement];	
if (_conditionMovement) then { 
{ _x disableAI "ANIM"; 
  _x enableSimulation false; 
  cutRsc ["default", "BLACK", 20];
} foreach _listOfUnits; 
} else {
{ _x enableAI "ANIM"; 
  _x enableSimulation true; 
  cutRsc ["default", "PLAIN",1];
} foreach _listOfUnits; 
};

Share this post


Link to post
Share on other sites

_localplayer is a unit and your function expects an array of units. So just put square brackets around _localplayer in the call line to turn it into a singular array.

Share this post


Link to post
Share on other sites

i converted _localplayer already to an array in the first line of code?

_localplayer = [_this select 0];

edit: ok ... now i do not get any error, but the function still does not work :(

Edited by mindbl4ster

Share this post


Link to post
Share on other sites

Oh excuse me, I missed that in haste. Looking over it again, I'm just as confused as you are. The only thing I can really think of is that something is confusing the parser. What does

fn_freeze:

do?

Share this post


Link to post
Share on other sites

It seemed to work fine when I tested it by defining the function on top of initPlayerLocal.sqf.

How do you define the function? Looking at the function name you're not using the Functions Library? Should be mbicr_fnc_freeze if you are.

Share this post


Link to post
Share on other sites

@magirot: thanks for pointing this out ... now it works like a charm :)

Edited by mindbl4ster

Share this post


Link to post
Share on other sites

If you want to have that unit to be frozen forever, you could simply use the "createVehicle" command as it creates a unit sort of like a mannequin ("lifeless").

Edited by waltenberg

Share this post


Link to post
Share on other sites

@waltenberg: thanks for advice but my intention is to freeze the player in a tdm mission until a startsignal (unfreeze) comes from the server. that way i can be sure every player has finished loading the mission and gets the startsignal at the exact same time.

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  

×