SHARE
TWEET

Untitled

a guest Mar 7th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.     Name: ExileServer_ClaimVehicle_network_InsertClaimedVehicle.sqf
  4.  
  5.     Author: MezoPlays
  6.     Copyright (c) 2016 MezoPlays
  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.  
  11. */
  12. private["_sessionID","_package","_objectNetID","_pinCode","_ownerUID","_vehicle"];
  13. _sessionID = _this select 0;
  14. _package = _this select 1;
  15. _objectNetID = _package select 0;
  16. _pinCode = _package select 1;
  17.  
  18. _playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
  19. _ownerUID = getPlayerUID _playerObject;
  20. _vehicle = objectFromNetId _objectNetID;
  21.  
  22. try
  23. {
  24.     if !(alive _playerObject) then
  25.     {
  26.         throw "You must be alive to claim a vehicle!";
  27.     };
  28.     if !(_vehicle isKindOf "AIR" || _vehicle isKindOf "CAR" || _vehicle isKindOf "TANK") then
  29.     {
  30.         throw "That's not a vehicle!";
  31.     };
  32.     if (_vehicle getVariable ["ExileIsPersistent", true]) then
  33.     {
  34.         throw "This vehicle is already claimed!";
  35.     };
  36.     if !(isNil {_vehicleObj getVariable "SC_drivenVehicle"}) then
  37.     {
  38.         throw "This vehicle is owned by the server!";
  39.     };
  40.     if !(count _pinCode == 4) then
  41.     {
  42.         throw "Your pincode must be 4 digits!";
  43.     };
  44. //Mod for restricting the number of owned vehicles.  Born2Kill - Blackheartsgaming.com
  45.  
  46. _playerObject = _sessionID call ExileServer_system_session_getPlayerObject
  47.  
  48. _data = format ["getVehicleCount:%1", (getPlayerUID _playerObject)] call ExileServer_system_database_query_selectSingle;
  49.  
  50. if ((_data select 0) >= 5) then {
  51.  
  52.      throw "You are only allowed a maximum of 5 owned vehicles.";
  53.  
  54. };
  55.  
  56. // End Mod for restricting the number of owned vehicles.  Born2Kill - Blackheartsgaming.com
  57.  
  58.     _playerObject removeMagazineGlobal "Exile_Item_CodeLock";
  59.  
  60.     _vehicle setVariable ["ExileIsLocked",-1];
  61.     _vehicle setVariable ["ExileOwnerUID", _ownerUID];
  62.     _vehicle setVariable ["ExileAccessCode", _pinCode];
  63.     _vehicle setVariable ["ExileIsPersistent", true];
  64.  
  65.     _vehicle lock 0;
  66.  
  67.     _vehicle call ExileServer_object_vehicle_database_insert;
  68.     _vehicle call ExileServer_object_vehicle_database_update;
  69.  
  70.  
  71.     [_sessionID, "toastRequest", ["SuccessTitleOnly", ["You're now the owner of this vehicle!"]]] call ExileServer_system_network_send_to;
  72.  
  73. }
  74. catch
  75. {
  76.     [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Claim Vehicles", _exception]]] call ExileServer_system_network_send_to;
  77.     _vehicle lock 0; //Make sure the vehicle is unlocked if this stuff fails. Cheers John ;)
  78. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top