Jump to content
Sign in to follow this  
Lucas Andre (Lunga Gamer)

Withdraw stamina and block access

Recommended Posts

Colleagues, two more problems arose in my mission. First, I would like to block access to fixed wings and helicopters for pilots only, and the stamina of players when they die goes back to normal, that is, everyone with stamina activated. Would any of the colleagues have a script for me to use? Thank you all.

Share this post


Link to post
Share on other sites
12 hours ago, Lucas Andre (Lunga Gamer) said:

Colleagues, two more problems arose in my mission. First, I would like to block access to fixed wings and helicopters for pilots only, and the stamina of players when they die goes back to normal, that is, everyone with stamina activated. Would any of the colleagues have a script for me to use? Thank you all.

 

For stamina: 

//In initPlayerLocal.sqf add:

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

 

For blocking aircraft access I cba to write it on my phone, someone else can chip in or I'll post something when I've got access to the PC tonight.

Share this post


Link to post
Share on other sites
1 hour ago, mrcurry said:

Em initPlayerLocal.sqf adicionar:

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

This line has helped me a lot. It's annoying to see players complaining that when they respawn after dying their stamina comes back. It really helped me. Thanks.

 

1 hour ago, mrcurry said:

For blocking aircraft access I cba to write it on my phone, someone else can chip in or I'll post something when I've got access to the PC tonight.

I will be looking forward to it.

Share this post


Link to post
Share on other sites
8 hours ago, mrcurry said:

 

For stamina: 

//In initPlayerLocal.sqf add:

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

It's my dear, the script didn't solve it, it's still respawning with stamina after it dies. I already removed the stamina in TADST, I already put a script in the unit's INI, I put the script you passed, even so, it continues.

Share this post


Link to post
Share on other sites
On 2/9/2023 at 1:20 AM, Lucas Andre (Lunga Gamer) said:

It's my dear, the script didn't solve it, it's still respawning with stamina after it dies.

 

Brainfart. It should of course be "player enableStamina false". enableFatigue is for the old system.

Here's the correct line:

player addEventHandler ["Respawn", { player enableStamina false; } ];

 

On 2/9/2023 at 10:33 PM, Lucas Andre (Lunga Gamer) said:

I already put a script in the unit's INI, I put the script you passed,

To be clear: You cannot put the code in the above code in the init attribute of a unit in the editor. The "player" command is not guaranteed correct at unit initialization in MP.

Put it in initPlayerLocal.sqf inside your scenario folder.

 

Here's how: Image

1. Open your scenario folder

2. If you already have a initPlayerLocal.sqf skip to step 5. Create a text file.

3-4. Change its name to the above. Make sure the extension and filetype also changes.

5. Open the file in your favorite text editor (notepad will do) and paste the code in and save.

 

On 2/9/2023 at 1:20 AM, Lucas Andre (Lunga Gamer) said:

I would like to block access to fixed wings and helicopters for pilots only

 

Couple of ways to do this but like I implied this is a bit more involved.

Here's one way, this also goes in your initPlayerLocal.sqf. Note it also includes the disable stamina thing at the top.

Spoiler

//In initPlayerLocal.sqf
// Disable stamina
player enableStamina false;
player addEventHandler ["Respawn", { player enableStamina false; } ];

// Prefilled with NATO vanilla Pilot classes, use the "Log classes to clipboard" feature in editor to find others. 
MY_pilotClasses = [
	"B_Fighter_Pilot_F",
	"B_Helipilot_F",
	"B_Pilot_F",
	"B_T_Helipilot_F",
	"B_T_Pilot_F",
	"B_W_Helipilot_F"
];

// Handle getting in the vehicle
player addEventHandler [
	"GetInMan", 
	{
		params ["_unit", "_role", "_vehicle", "_turret"];

		if( _vehicle isKindOf "Air") then {
			if !(typeOf _unit in MY_pilotClasses) then {
				systemChat "You are not allowed to pilot this aircraft. Only pilots may enter.";
				moveOut _unit;
			};
		};
	} 
];

// Handle seat switching inside the vehicle
player addEventHandler [
	"SeatSwitchedMan",
	{
		params ["_unit1", "_unit2", "_vehicle"];

		if( _vehicle isKindOf "Air" ) then {
			if !(typeOf _unit1 in MY_pilotClasses) then {
				systemChat "You are not allowed to pilot this aircraft. Only pilots may enter.";
				moveOut _unit1;
			};
		};
	}
];

 

 

Share this post


Link to post
Share on other sites

Thank you for the tips. Give stamina I'll be testing the way you gave me. Regarding the Block pilot, I already got a way to block, not only the pilots, but other things I wanted. Even so, thank you very much.

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  

×