31 posts in this topic

The Idea was simple, Create a Zone for FirstPerson Only Fights.

For Missions like CapturePoints, or special Events from Admins.

 

 

 

 

Put this inside off the initPlayerLocal.sqf



/*
First Person zone script
by Sgt.ScrapMetal powred by zombiehölle.de
*/

Private ["_Zone","_Objekts"];

_Objekts = "Exile_Car_Hunter";

if (!isDedicated) then { 

  if ((difficultyOption "thirdPersonView")==1) then
	{
		while {true} do {

			waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
			// Objects in array to force first person if player is near them.
                        _Zone = count nearestObjects [player, [_Objekts], 500];
			
			
			// If player is in a vehicle and near objects within _Zone, player forced into third person.
			if (_Zone > 0) then {
				(vehicle player) switchCamera "INTERNAL";
				

				["Whoops",["First Person Only Zone"]] call ExileClient_gui_notification_event_addNotification;

			};
		};
	};
};

/*				Add this to initPlayerLocal.sqf
call compile preprocessFileLineNumbers "addons\FirstPersonZone..sqf";
ExileViewRestrictionPlayerThreadHandle = [1, viewRestriction, [], true] call ExileClient_system_thread_addtask;
*/

 

Version from Infistar but never works correctly:

Spoiler



/*
	by infiSTAR.de (the AdminTool and AntiHack guy :] )
*/

fnc_custom_keydown = {
	private ['_handled', '_dikCode'];
	_dikCode = _this select 1;
	if((_dikCode in (actionkeys 'personView'))&&(!isNil'FORCE_FIRST_PERSON'))exitWith
	{
		(vehicle player) switchCamera 'INTERNAL';
		['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
		true
	};
	false
};
if(!isNil 'custom_keydown_handler')then{(findDisplay 46) displayRemoveEventHandler ['KeyDown',custom_keydown_handler];custom_keydown_handler = nil;};
custom_keydown_handler = (findDisplay 46) displayAddEventHandler ['KeyDown',{_this call fnc_custom_keydown}];




// Add too your initPlayerLocal.sqf BELOW "if (!hasInterface || isServer) exitWith {};"
_code = {
	if(!(cameraView isEqualTo 'INTERNAL')||(!isNil'FORCE_FIRST_PERSON'))then
	{
		_close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
		if(_close isEqualTo [])then
		{
			FORCE_FIRST_PERSON = nil;
		}
		else
		{
			FORCE_FIRST_PERSON = true;
			if!(cameraView isEqualTo 'INTERNAL')then
			{
				(vehicle player) switchCamera 'INTERNAL';
				['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
			};
		};
	};
};

// incase it gets added twice for whatever reason:
if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};

// add to exile mainthread:
viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;

[Click and drag to move]

 

 

You can add in the line with _Objekts every building or vehicle you want.

 

You can Change the Distance 500 too the distance you want :)

 

Big Thanks on infistar for helping my own version works too. but the script from infistar are simple better.

 

 

 

 

Edited by Sgt. ScrapMetal
Updatet for 1.58 arma version
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Try this instead:
 

Spoiler


/*
	by infiSTAR :]
*/
// Add too your initPlayerLocal.sqf BELOW "if (!hasInterface || isServer) exitWith {};"
_code = {
	if!(cameraView isEqualTo 'INTERNAL')then
	{
		_close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
		if!(_close isEqualTo [])then
		{
			(vehicle player) switchCamera 'INTERNAL';
			['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
		};
	};
};

// incase it gets added twice for whatever reason:
if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};

// add to exile mainthread:
viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;

 

 

  • Like 3

Share this post


Link to post
Share on other sites

ok confused a bit by all of this above. would i do both or just one?

how ever very interested in this, as it would be great for doing admin run events, and having it happen off an object is nice as an Admin can spawn it in any area they choose to have an event..

Share this post


Link to post
Share on other sites

 

18 hours ago, infiSTAR said:

Try this instead:
 

  Reveal hidden contents




/*
	by infiSTAR :]
*/
// Add too your initPlayerLocal.sqf BELOW "if (!hasInterface || isServer) exitWith {};"
_code = {
	if!(cameraView isEqualTo 'INTERNAL')then
	{
		_close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
		if!(_close isEqualTo [])then
		{
			(vehicle player) switchCamera 'INTERNAL';
			['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
		};
	};
};

// incase it gets added twice for whatever reason:
if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};

// add to exile mainthread:
viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;

 

 

The Problem is my version too you version is you can abuse this simple if spamming "enter" too switch in Thirdperson allready you see for 1 sec the ThirdPersron View. On my Post is it not but i think the code from you its better so can you fi this?

Share this post


Link to post
Share on other sites

to stop people that spam enter you could do this instead:

Spoiler

/*
	by infiSTAR :]
*/

fnc_custom_keydown = {
	private ['_handled', '_dikCode'];
	_dikCode = _this select 1;
	if(_dikCode in (actionkeys 'personView'))exitWith
	{
		if(!isNil'FORCE_FIRST_PERSON')then
		{
			if!(cameraView isEqualTo 'INTERNAL')then
			{
				(vehicle player) switchCamera 'INTERNAL';
				['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
			};
			true
		};
	};
	false
};
if(!isNil 'custom_keydown_handler')then{(findDisplay 46) displayRemoveEventHandler ['KeyDown',custom_keydown_handler];custom_keydown_handler = nil;};
custom_keydown_handler = (findDisplay 46) displayAddEventHandler ['KeyDown',{_this call fnc_custom_keydown}];




// Add too your initPlayerLocal.sqf BELOW "if (!hasInterface || isServer) exitWith {};"
_code = {
	if!(cameraView isEqualTo 'INTERNAL')then
	{
		_close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
		if(_close isEqualTo [])then
		{
			FORCE_FIRST_PERSON = nil;
		}
		else
		{
			FORCE_FIRST_PERSON = true;
			(vehicle player) switchCamera 'INTERNAL';
			['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
		};
	};
};

// incase it gets added twice for whatever reason:
if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};

// add to exile mainthread:
viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;

 

 

Share this post


Link to post
Share on other sites
17 minutes ago, infiSTAR said:

to stop people that spam enter you could do this instead:

  Hide contents



/*
	by infiSTAR :]
*/

fnc_custom_keydown = {
	private ['_handled', '_dikCode'];
	_dikCode = _this select 1;
	if(_dikCode in (actionkeys 'personView'))exitWith
	{
		if(!isNil'FORCE_FIRST_PERSON')then
		{
			if!(cameraView isEqualTo 'INTERNAL')then
			{
				(vehicle player) switchCamera 'INTERNAL';
				['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
			};
			true
		};
	};
	false
};
if(!isNil 'custom_keydown_handler')then{(findDisplay 46) displayRemoveEventHandler ['KeyDown',custom_keydown_handler];custom_keydown_handler = nil;};
custom_keydown_handler = (findDisplay 46) displayAddEventHandler ['KeyDown',{_this call fnc_custom_keydown}];




// Add too your initPlayerLocal.sqf BELOW "if (!hasInterface || isServer) exitWith {};"
_code = {
	if!(cameraView isEqualTo 'INTERNAL')then
	{
		_close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
		if(_close isEqualTo [])then
		{
			FORCE_FIRST_PERSON = nil;
		}
		else
		{
			FORCE_FIRST_PERSON = true;
			(vehicle player) switchCamera 'INTERNAL';
			['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
		};
	};
};

// incase it gets added twice for whatever reason:
if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};

// add to exile mainthread:
viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;

 

 

Its the same Spamming Enter and abuse allready exist.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.