infiSTAR23

ForceFirstPersonZone

Feb 4th, 2016
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. fnc_custom_keydown = {
  2.     private ['_dikCode', '_handled'];
  3.     _dikCode = _this select 1;
  4.     _handled = false;
  5.    
  6.     if((_dikCode in (actionkeys 'personView'))&&(cameraView in ['GUNNER','INTERNAL']))exitWith
  7.     {
  8.         _close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
  9.         if!(_close isEqualTo [])then
  10.         {
  11.             ['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
  12.             (vehicle player) switchCamera 'INTERNAL';
  13.             _handled = true;
  14.         };
  15.     };
  16.    
  17.     _handled
  18. };
  19. if(!isNil 'custom_keydown_handler')then{(findDisplay 46) displayRemoveEventHandler ['KeyDown',custom_keydown_handler];custom_keydown_handler = nil;};
  20. custom_keydown_handler = (findDisplay 46) displayAddEventHandler ['KeyDown',{_this call fnc_custom_keydown}];
  21.  
  22.  
  23. _code = {
  24.     if(player isEqualTo (vehicle player))then
  25.     {
  26.         if!(cameraView in ['GUNNER','INTERNAL'])then
  27.         {
  28.             _close = nearestObjects [getPos player, ['Flag_Green_F'], 50];
  29.             if!(_close isEqualTo [])then
  30.             {
  31.                 if!(cameraView in ['GUNNER','INTERNAL'])then
  32.                 {
  33.                     (vehicle player) switchCamera 'INTERNAL';
  34.                     ['Whoops',['FirstPersonOnlyZone']] call ExileClient_gui_notification_event_addNotification;
  35.                 };
  36.             };
  37.         };
  38.     };
  39. };
  40. if(!isNil'viewrestrictionid')then{[viewrestrictionid] call ExileClient_system_thread_removeTask;};
  41. viewrestrictionid = [1, _code, [], true] call ExileClient_system_thread_addtask;
Advertisement
Add Comment
Please, Sign In to add comment