Jump to content
Sign in to follow this  
caeden

Need help with fatigue parameter.

Recommended Posts

I am trying to add a parameter to my mission so I can choose whether or not to have fatigue on or off. So far it works when I test it from the editor, but it's not working on my dedicated server.

Here's what it looks like:

description.ext

class PlayerFatigue

//paramsArray[2]

{

title = "Player Fatigue";

values[] = {0,1};

texts[] = {"Fatigue Disabled","Fatigue Enabled"};

default = 0;

file = "scripts\PlayerFatigue.sqf";

};

(For reference I have 2 other parameters before this one that work fine)

PlayerFatigue.sqf

if (isServer) then

{

waitUntil {player == player};

if (!isNull player) then

{

if ((paramsArray select 2) == 0) then

{

player enableFatigue false;

player addMPEventHandler ["MPRespawn",{player enableFatigue false;}];

hint "Fatigue Disabled";

Crossroads_HQ globalChat "Fatigue Disabled";

};

};

};

Can anyone tell me what I'm doing wrong, please!!!

---------- Post added at 00:43 ---------- Previous post was at 22:51 ----------

I've tried using this in the PlayerFatigue.sqf with no luck.

waitUntil {player == player};

if (!isNull player) then

{

if ((paramsArray select 2) == 0) then

{

{_x enableFatigue false;} forEach units group player;

{_x addMPEventHandler ["MPRespawn", {_x enableFatigue false;}];} forEach units group player;

hint "Fatigue Disabled";

Crossroads_HQ globalChat "Fatigue Disabled";

};

};

Edited by Caeden

Share this post


Link to post
Share on other sites

So I'm pretty sure I have fixed it.

Description.ext

class PlayerFatigue

//paramsArray[2]

{

title = "Player Fatigue";

values[] = {0,1};

texts[] = {"Fatigue Disabled","Fatigue Enabled"};

default = 0;

};

It's params 2 for me because I have 3 all together and this is the final one (They start at 0,1,2).

Then create a initPlayerLocal.sqf that runs after the init.sqf (by default) and runs the scripts local to the player.

initPlayerLocal.sqf

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//-------------------------------------------Parameter-Player-Fatigue--------------------------------------------------------

if ((paramsArray select 2) == 0) then

{

player enableFatigue false;

player addEventhandler ["Respawn", {player enableFatigue false}];

hint "Fatigue Disabled";

Crossroads_HQ globalChat "Fatigue Disabled";

};

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I hope this helps others that are having the same issue with running something local to player.

  • Like 1

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  

×