Advertisement
secondcoming

GG_safeZone.sqf

May 20th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.81 KB | None | 0 0
  1. /**
  2.  * ExileClient_object_player_thread_safeZone
  3.  *
  4.  * Exile Mod
  5.  * www.exilemod.com
  6.  * © 2015 Exile Mod Team
  7.  *
  8.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10.  * MODIFIED BY GR8's Anti Steal
  11.  */
  12.  
  13. private["_vehicle","_playerDriver","_vehicleOwner","_ownerGroup","_friends","_near","_around","_countNear","_countNearMine"];
  14. _vehicle = vehicle player;
  15. _publicTransport = _vehicle getVariable "SC_transport";
  16. if (!ExilePlayerInSafezone) exitWith {false};
  17. if (_vehicle isEqualTo player) then
  18. {
  19.     if !(isNull ExileClientSafeZoneVehicle) then
  20.     {
  21.         ExileClientSafeZoneVehicle removeEventHandler ["Fired", ExileClientSafeZoneVehicleFiredEventHandler];  
  22.         ExileClientSafeZoneVehicle = objNull;
  23.         ExileClientSafeZoneVehicleFiredEventHandler = nil;
  24.     };
  25. }
  26. else
  27. {
  28.     if (local _vehicle) then
  29.     {
  30.         _vehicle allowDamage false;
  31.     };
  32.     if !(_vehicle isEqualTo ExileClientSafeZoneVehicle) then
  33.     {
  34.         if !(isNull ExileClientSafeZoneVehicle) then
  35.         {
  36.             ExileClientSafeZoneVehicle removeEventHandler ["Fired", ExileClientSafeZoneVehicleFiredEventHandler];  
  37.             ExileClientSafeZoneVehicle = objNull;
  38.             ExileClientSafeZoneVehicleFiredEventHandler = nil;
  39.         };
  40.         ExileClientSafeZoneVehicle = _vehicle;
  41.         ExileClientSafeZoneVehicleFiredEventHandler = _vehicle addEventHandler ["Fired", {_this call ExileClient_object_player_event_onFiredSafeZoneVehicle}];
  42.  
  43.         // GR8's Anti Steal
  44.         if (GG_vehicleSteal && isNil "_publicTransport") then
  45.         {
  46.             _playerDriver = player == driver ExileClientSafeZoneVehicle;
  47.             _vehicleOwner = ExileClientSafeZoneVehicle getVariable ['GR8owner', objNull];
  48.             if (GG_vehicleGroup) then {_ownerGroup = units group _vehicleOwner;} else {_ownerGroup = _vehicleOwner;};
  49.             if (isNull _vehicleOwner) then
  50.             {
  51.                 if (GG_vehicleClaim) then
  52.                 {
  53.                     if (_playerDriver) then
  54.                     {
  55.                         ExileClientSafeZoneVehicle setVariable ['GR8owner', player, true]; _vehicleOwner = player;
  56.                     }
  57.                     else
  58.                     {
  59.                         if !(player in _ownerGroup) then
  60.                         {
  61.                             cutText [format['SECURESAFEZONES: %1, This is an abandoned vehicle. Enter in the driver/pilot seat to claim this vehicle.',name player],'PLAIN'];
  62.                             player action ['getOut', ExileClientSafeZoneVehicle];
  63.                         };
  64.                     };
  65.                 };
  66.             }
  67.             else
  68.             {
  69.                 if !(player in _ownerGroup) then {
  70.                     ["Whoops", ["Cannot Enter This Vehicle"]] call ExileClient_gui_notification_event_addNotification;
  71.                     player action ['getOut', ExileClientSafeZoneVehicle];
  72.                     disableUserInput true;
  73.                     cutText ["SECURESAFEZONES: YOU DO NOT OWN THIS VEHICLE !","WHITE IN", 5];
  74.                     uiSleep GG_vehiclePenalty;
  75.                     disableUserInput false;
  76.                 };
  77.             };
  78.         };
  79.         // GR8's Anti Steal
  80.     };
  81. };
  82. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement