Advertisement
secondcoming

ExileServer_object_construction_network_buildConstructionReq

May 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.46 KB | None | 0 0
  1. /**
  2.  * ExileServer_object_construction_network_buildConstructionRequest
  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.  */
  11.  
  12. private["_sessionID","_parameters","_objectClassName","_objectPosition","_playerObject","_constructionConfig","_canBuildHereResult","_object"];
  13. _sessionID = _this select 0;
  14. _parameters = _this select 1;
  15. _objectClassName = _parameters select 0;
  16. _objectPosition = _parameters select 1;
  17. try
  18. {
  19.     _playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
  20.     if (isNull _playerObject) then
  21.     {
  22.         throw "Player object is null!";
  23.     };
  24.     _constructionConfig = ("getText(_x >> 'previewObject') == _objectClassName" configClasses(configFile >> "CfgConstruction")) select 0;
  25.     _canBuildHereResult = [configName _constructionConfig, (ASLtoAGL (ATLtoASL _objectPosition)), getPlayerUID _playerObject] call ExileClient_util_world_canBuildHere;
  26.     switch (_canBuildHereResult) do
  27.     {
  28.         case 1:
  29.         {
  30.             throw "You are not in your territory!";
  31.         };
  32.         case 2:
  33.         {
  34.             throw "You are inside enemy territory!";
  35.         };
  36.         case 8:
  37.         {
  38.             throw "You are in a contaminated zone!";
  39.         };
  40.         case 3:
  41.         {
  42.             throw "This cannot be placed on roads!";
  43.         };
  44.         case 5:
  45.         {
  46.             throw "You are too close to a spawn zone!";
  47.         };
  48.         case 4:
  49.         {
  50.             throw "You are too close to traders!";
  51.         };
  52.         case 6:
  53.         {
  54.             throw "Maximum number of objects reached!";
  55.         };
  56.         case 7:
  57.         {
  58.             throw "This snap location is already being used!";
  59.         };
  60.         //////////////////////////////////////
  61.         // Builiding Height Restriction
  62.         //////////////////////////////////////
  63.         case 9:
  64.         {
  65.             throw "Maximum height reached!";
  66.         };     
  67.         //////////////////////////////////////     
  68.     };
  69.     _object = createVehicle[_objectClassName, _objectPosition, [], 0, "CAN_COLLIDE"];
  70.     _object setPosATL _objectPosition;
  71.     _object setVariable ["BIS_enableRandomization", false];
  72.     _object enableSimulationGlobal false;
  73.     _object setVariable ["ExileOwnerUID", getPlayerUID _playerObject];
  74.     [_object, _playerObject] call ExileServer_system_swapOwnershipQueue_add;
  75.     [_sessionID, "constructionResponse", [netid _object]] call ExileServer_system_network_send_to;
  76. }
  77. catch
  78. {
  79.     [_sessionID,"notificationRequest", ["Whoops", [_exception]]] call ExileServer_system_network_send_to;
  80. };
  81. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement