Jump to content
killshot

Save result for each player

Recommended Posts

Hello guys.

I want to give a randomly picked face to my players (multiplayer) and save the result for each player, so I can assign it to them again after respawn with an eventhandler.

I execute my selectFace.sqf in the initLocalPlayer.sqf

waitUntil {!isNull player};
waitUntil {time > 0};

if (player == p1) then {nul = [player] execVM "scripts\selectFace.sqf";};

selectFace.sqf

_unit = _this select 0;

_allFaces = ["AfricanHead_01","AfricanHead_02","AfricanHead_03"];
_newFace = _allFaces call BIS_fnc_selectRandom;

[[_unit,_newFace], "setFace", true, false] call BIS_fnc_MP;

//_unit addEventhandler ["Respawn", {[color="#FF0000"]result SelectFace.sqf[/color]}];

Can someone help me with that, please?

Thank you. :)

Share this post


Link to post
Share on other sites
[[_unit,_newFace], "setFace", true, false] call BIS_fnc_MP;

_unit setVariable ["playerFace", _newFace, true];

_unit addEventhandler ["Respawn", {
    [[_this select 0, (_this select 0 getVariable ["playerFace", ""])], "setFace", true, false] call BIS_fnc_MP;
}];

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

×