Jump to content
Sign in to follow this  
mistaparadox

Confusion about addAction

Recommended Posts

Hey guys, I recently tried to add my own addAction menu linking to my own custom script I made. In my init.sqf I placed this:

player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];

It works for the first player who joins the server, but any others after him do not have the option in the action menu to choose the script. Any ideas?

Share this post


Link to post
Share on other sites
waitUntil {!isNull player && {time > 1}};//JIP 
player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];

Edited by Iceman77

Share this post


Link to post
Share on other sites
waitUntil {!isNull player && {time > 1}};//JIP 
player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];

That worked fine, but when people die, they don't have the option to remove fatigue anymore. Do I need some sort of MP Respawning event or what?

Share this post


Link to post
Share on other sites

You can re-add the addAction with a respawn EH.

waitUntil {!isNull player && {time > 1}};//JIP 

player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"]; 

player addEventHandler ["respawn",{ 
    _this addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];  
}];

Edited by Iceman77

Share this post


Link to post
Share on other sites

You need to addAction whenever a player spawns, because on death they lose all actions added in their "previous life". So yeah, create an eventHandler like this:

player addEventHandler ["Respawn",
 {_this addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];}
];  

Nevermind, ninja'd.

Edited by waltenberg

Share this post


Link to post
Share on other sites
You need to addAction whenever a player spawns, because on death they lose all actions added in their "previous life". So yeah, create an eventHandler like this:

player addEventHandler ["Respawn",
 {_this addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];}
];  

Nevermind, Iceman was quicker.

You can re-add the addAction with a respawn EH.

waitUntil {!isNull player && {time > 1}};//JIP 

player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"]; 

player addEventHandler ["respawn",{ 
    _this addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];  
}];

Hmm... I tried this along with using "addMPEventHandler" and "MPRespawn" but still it didn't work. When they die, they don't have the Remove Fatigue in the action menu, and I'm quite confused. I've literally copied the code exactly and put it in my init.sqf and still nothing.

Share this post


Link to post
Share on other sites

Sorry, use this instead

waitUntil {!isNull player && {time > 1}};//JIP 

player addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"]; 

player addEventHandler ["respawn",{ 
    (_this select 0) addAction ['<t color="#41A317">' + "Remove Fatigue" + '</t>', "scripts\Loadout\Fatigue.sqf"];  
}];  

---------- Post added at 22:18 ---------- Previous post was at 22:10 ----------

Btw, use -showScriptErrors startup parameter if you're not already.

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  

×