Jump to content
Sign in to follow this  
silentwisher

No Third Person, No Map Checker, No fire till triggered

Recommended Posts

So I have three things I would love to setup for our server and im not sure how to do them.

The first would be disabled third person.

Second would be a script that checks to see if a player has a map in their inventory every like 5 seconds or so, and removes it.

Third would be a script that prevents players from firing at all until a trigger is tripped in the map. (weapon lock)

Any ideas?

Share this post


Link to post
Share on other sites

Monitor for map + 3rd view. Disable both. To restrict firing at base, you could store and remove the player's ammo and then replace it or something. Anyhow, it's super late and I'm tired. So this is all I got for ya. Cheers.

init.sqf

[] spawn {

   if ( !isDedicated ) then {

     waitUntil {! ( isNull player ) };

       [] spawn {

           while { true } do {


			waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) };

				player globalChat "Your map has been removed!!!";

				player unassignItem "ItemMap"; 

                   player removeItem "ItemMap";


		};

	};


	while { true } do {


           waitUntil { cameraOn == player && { cameraView == "External" } };

			player globalChat "3rd person view is not allowed!!!";

			player switchCamera "Internal";


       }; 

   }; 

};  

Edited by Iceman77

Share this post


Link to post
Share on other sites

Hmm. I get a black screen that says can't connect to the positioning system when I've no map. So not sure what's the issue.

---------- Post added at 15:58 ---------- Previous post was at 15:57 ----------

Note: This is in the editor, with just the above code running, with NO addons. The script works as intended.

Edited by Iceman77

Share this post


Link to post
Share on other sites
If they have a GPS im pretty sure the map works aswell

Alright then maybe some how add that to the code?

Share this post


Link to post
Share on other sites
[] spawn {

   if ( !isDedicated ) then {

     waitUntil {! ( isNull player ) };

       [] spawn {

           while { true } do {


               waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } };


			if ( "ItemMap" in ( assignedItems player ) ) then {


				player globalChat "Your map has been removed!!!";

				player unassignItem "ItemMap"; 

				player removeItem "ItemMap";


			} else {


				player globalChat "Your GPS has been removed!!!";

				player unassignItem "ItemGPS"; 

				player removeItem "ItemGPS";

			};                  

           };

       };


       while { true } do {


           waitUntil { cameraOn == player && { cameraView == "External" } };

               player globalChat "3rd person view is not allowed!!!";

               player switchCamera "Internal";


       }; 

   }; 

};  

Share this post


Link to post
Share on other sites
[] spawn {

   if ( !isDedicated ) then {

     waitUntil {! ( isNull player ) };

       [] spawn {

           while { true } do {


               waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } };


			if ( "ItemMap" in ( assignedItems player ) ) then {


				player globalChat "Your map has been removed!!!";

				player unassignItem "ItemMap"; 

				player removeItem "ItemMap";


			} else {


				player globalChat "Your GPS has been removed!!!";

				player unassignItem "ItemGPS"; 

				player removeItem "ItemGPS";

			};                  

           };

       };


       while { true } do {


           waitUntil { cameraOn == player && { cameraView == "External" } };

               player globalChat "3rd person view is not allowed!!!";

               player switchCamera "Internal";


       }; 

   }; 

};  

Thank you! :) Everything works perfectly now.

Appreciate it!

Share this post


Link to post
Share on other sites

This was really fun to develop a solution for. I have 2 solutions, the first one:

noMapOrGPS = (findDisplay 46) displayAddEventHandler ["KeyDown",
{
_handled = false;
if ((_this select 1) == 50) then {_handled = true;hint "The mission-maker has disabled use of the map."};
_handled
}];

This works for both the map and the GPS, an issue with it, though, is that a player simply needs to re-map his keys to circumvent this. The second solution:

["noMapOrGPS", "onEachFrame",
{
if (visibleMap) then
{
	openMap false;
	hint "The mission maker has diabled use of the map.";
};
if (visibleGPS) then
{
	//can't put anything here as there are no commands to force-close a GPS for some reason
};
}] call BIS_fnc_addStackedEventHandler;

The issue here is, obviously, that it won't close a players GPS.

Share this post


Link to post
Share on other sites
Thank you! :) Everything works perfectly now.

Appreciate it!

No worries. You could also look into the take EH. To help disallow players from acquiring either of the items in the first place. Just remove the items once initially, and forget about it. No loops or shenanigans. Cheers.

Share this post


Link to post
Share on other sites

We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no?

Share this post


Link to post
Share on other sites
We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no?

If vehicle has inbuilt gps, then you're gonna have map I suppose. Regarding the 3rd view in vehicles, use vehicle player. Works for both.

Updated:

[] spawn {

   if ( !isDedicated ) then {

     waitUntil {! ( isNull player ) };

       [] spawn {

           while { true } do {


               waitUntil { sleep 5; ( "ItemMap" in ( assignedItems player ) ) || { ( "ItemGPS" in ( assignedItems player ) ) } };


               if ( "ItemMap" in ( assignedItems player ) ) then {


                   player globalChat "Your map has been removed!!!";

                   player unassignItem "ItemMap"; 

                   player removeItem "ItemMap";


               } else {


                   player globalChat "Your GPS has been removed!!!";

                   player unassignItem "ItemGPS"; 

                   player removeItem "ItemGPS";

               };                  

           };

       };


       while { true } do {


           waitUntil { cameraOn == ( vehicle player ) && { cameraView == "External" } };

               player globalChat "3rd person view is not allowed!!!";

               ( vehicle player ) switchCamera "Internal";


       }; 

   }; 

};  

Share this post


Link to post
Share on other sites
We just had a small op and noticed that maps and third person is still available in vehicles. Is this something fixable or no?

If vehicle has inbuilt gps, then you're gonna have map I suppose. Regarding the 3rd view in vehicles, use vehicle player. Works for both.

In this case, you might consider using some of the code I posted earlier, although there still is no way to close a GPS as far as I know.

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  

×