Advertisement
BarneyR

Untitled

Oct 19th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_buyHouse.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Buys the house?
  8. */
  9. private ["_house","_uid","_action","_houseCfg"];
  10. _house = param [0,objNull,[objNull]];
  11. _uid = getPlayerUID player;
  12.  
  13. if (isNull _house) exitWith {};
  14. if (!(_house isKindOf "House_F")) exitWith {};
  15. if (_house getVariable ["house_owned",false]) exitWith {hint localize "STR_House_alreadyOwned";};
  16. if (!isNil {(_house getVariable "house_sold")}) exitWith {hint localize "STR_House_Sell_Process"};
  17. if ((!license_civ_home) && !(license_cop_home) && !(license_med_home)) exitWith {hint localize "STR_House_License"};
  18. if (count life_houses >= (LIFE_SETTINGS(getNumber,"house_limit"))) exitWith {hint format [localize "STR_House_Max_House",LIFE_SETTINGS(getNumber,"house_limit")]};
  19. closeDialog 0;
  20.  
  21. _houseCfg = [(typeOf _house)] call life_fnc_houseConfig;
  22. if (count _houseCfg isEqualTo 0) exitWith {};
  23.  
  24. _action = [
  25. format [localize "STR_House_BuyMSG",
  26. [(_houseCfg select 0)] call life_fnc_numberText,
  27. (_houseCfg select 1)],localize "STR_House_Purchase",localize "STR_Global_Buy",localize "STR_Global_Cancel"
  28. ] call BIS_fnc_guiMessage;
  29.  
  30. if (_action) then {
  31. if (BANK < (_houseCfg select 0)) exitWith {hint format [localize "STR_House_NotEnough"]};
  32. BANK = BANK - (_houseCfg select 0);
  33. [1] call SOCK_fnc_updatePartial;
  34.  
  35. if (life_HC_isActive) then {
  36. [_uid,_house] remoteExec ["HC_fnc_addHouse",HC_Life];
  37. } else {
  38. [_uid,_house] remoteExec ["TON_fnc_addHouse",RSERV];
  39. };
  40.  
  41. if (LIFE_SETTINGS(getNumber,"player_advancedLog") isEqualTo 1) then {
  42. if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
  43. advanced_log = format [localize "STR_DL_AL_boughtHouse_BEF",[(_houseCfg select 0)] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
  44. } else {
  45. advanced_log = format [localize "STR_DL_AL_boughtHouse",profileName,(getPlayerUID player),[(_houseCfg select 0)] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
  46. };
  47. publicVariableServer "advanced_log";
  48. };
  49.  
  50. _house setVariable ["house_owner",[_uid,profileName],true];
  51. _house setVariable ["locked",true,true];
  52. _house setVariable ["containers",[],true];
  53. _house setVariable ["uid",floor(random 99999),true];
  54.  
  55. life_vehicles pushBack _house;
  56. life_houses pushBack [str(getPosATL _house),[]];
  57. _marker = createMarkerLocal [format ["house_%1",(_house getVariable "uid")],getPosATL _house];
  58. _houseName = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _house), "displayName");
  59. _marker setMarkerTextLocal _houseName;
  60. _marker setMarkerColorLocal "ColorBlue";
  61. _marker setMarkerTypeLocal "loc_Lighthouse";
  62. _numOfDoors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _house),"numberOfDoors");
  63. for "_i" from 1 to _numOfDoors do {
  64. _house setVariable [format ["bis_disabled_Door_%1",_i],1,true];
  65. };
  66. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement