• [TUTO]Rendre Achetable les maisons ajoutes


    Bonjours a tous voila c’est mon premier tuto sur altisdev, je vais vous expliquer comment rendre achetable les maison ajouter depuis l’éditeur il ce peut qu’il y ai encore des bugs si vous en rencontré envoyer les moi sur ce topic que je puisse les éliminer.

    le tuto ce décompose en deux partie les modifications coter life_server et coter **Altis_Life.Altis **il n’y a qu’une seul ligne a remplacer par fichier  il suffit de ligne les commenter dans chaque fichier.

    1)life_server

    Allez dans :** life_server/Functions/Housing/fn_houseCleanup.sqf **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Cleans up containers inside the house.  
    */  
    private["_query","_houses"];  
    _query = format["SELECT pid, pos, inventory, containers FROM houses WHERE pid='%1' AND owned='1'",_this];  
    waitUntil{!DB_Async_Active};  
    _houses = [_query,2,true] call DB_fnc_asyncCall;  
    
    if(count _houses == 0) exitWith {};  
    {  
    	_pos = call compile format["%1",_x select 1];  
    	_house = nearestBuilding _pos;  // remplacer cette ligne  
            _house = nearestObject [_pos,"house_F"]; // par cette ligne  
    
    	if(!isNil {(_house getVariable "containers")}) then {  
    		{if(!isNull _x) then {deleteVehicle _x;};} foreach (_house getVariable "containers");  
    		_house setVariable["containers",nil,true];  
    	};  
    } foreach _houses;  
    

    Allez dans :** life_server/Functions/Housing/fn_initHouses.sqf **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	WHAT THE HELL DO YOU THINK IT DOES?!?!!??!?!!?!??!  
    */  
    private["_queryResult","_query","_count"];  
    waitUntil{!DB_Async_Active};  
    _count = (["SELECT COUNT(*) FROM houses WHERE owned='1'",2] call DB_fnc_asyncCall) select 0;  
    
    for [{_x=0},{_x<=_count},{_x=_x+10}] do {  
    	waitUntil{!DB_Async_Active};  
    	_query = format["SELECT houses.id, houses.pid, houses.pos, players.name FROM houses INNER JOIN players ON houses.pid=players.playerid WHERE houses.owned='1' LIMIT %1,10",_x];  
    	_queryResult = [_query,2,true] call DB_fnc_asyncCall;  
    	if(count _queryResult == 0) exitWith {};  
    
    	{  
    		_pos = call compile format["%1",_x select 2];  
    
    		_house = nearestBuilding _pos; //remplacer cette ligne  
                    _house = nearestObject [_pos,"house_F"]; //par cette ligne  
    
    		_house setVariable["house_owner",[_x select 1,_x select 3],true];  
    		_house setVariable["house_id",_x select 0,true];  
    		_house setVariable["locked",true,true]; //Lock up all the stuff.  
    		_numOfDoors = getNumber(configFile >> "CfgVehicles" >> (typeOf _house) >> "numberOfDoors");  
    		for "_i" from 1 to _numOfDoors do {  
    			_house setVariable[format["bis_disabled_Door_%1",_i],1,true];  
    		};  
    	} foreach _queryResult;  
    };  
    

    **Allez dans : life_server/Functions/Housing/fn_fetchPlayerHouses.sqf **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Fetches all the players houses and sets them up.  
    */  
    private["_query","_houses"];  
    if(_this == "") exitWith {};  
    
    _query = format["SELECT pid, pos, inventory, containers FROM houses WHERE pid='%1' AND owned='1'",_this];  
    waitUntil{!DB_Async_Active};  
    _houses = [_query,2,true] call DB_fnc_asyncCall;  
    
    _return = [];  
    {  
    	_pos = call compile format["%1",_x select 1];  
    
    	_house = nearestBuilding _pos; //remplacer cette ligne  
            _house = nearestObject [_pos,"house_F"]; //par cette ligne  
    
    	_house allowDamage false;  
    	_containers = [];  
    	_house setVariable["slots",[],true];  
    	if(!isNil {(_house getVariable "containers")}) then {  
    		{if(!isNull _x) then {deleteVehicle _x;};} foreach (_house getVariable "containers");  
    	};  
    
    	_trunk = [_x select 2] call DB_fnc_mresToArray;  
    	if(typeName _trunk == "STRING") then {_trunk = call compile format["%1", _trunk];};  
    	_containerData = [_x select 3] call DB_fnc_mresToArray;  
    	if(typeName _containerData == "STRING") then {_containerData = call compile format["%1", _containerData];};  
    	_house setVariable["Trunk",_trunk,true];  
    	{  
    		if(count _x == 0) exitWith {}; //No containers / items.  
    		_className = _x select 0;  
    		_weapons = (_x select 1) select 0;  
    		_magazines = (_x select 1) select 1;  
    		_items = (_x select 1) select 2;  
    		_backpacks = (_x select 1) select 3;  
    
    		//Setup the variables  
    		_positions = [_house] call life_fnc_getBuildingPositions;  
    		_pos = [0,0,0];  
    
    		{  
    			_slots = _house getVariable ["slots",[]];  
    			if(!(_forEachIndex in _slots)) exitWith {  
    				_slots pushBack _forEachIndex;  
    				_house setVariable["slots",_slots,true];  
    				_pos = _x;  
    			};  
    		} foreach _positions;  
    
    		if(_pos isEqualTo [0,0,0]) exitWith {};  
    
    		_container = createVehicle[_className,_pos,[],0,"NONE"];  
    		waitUntil{!isNil "_container"};  
    		_container setPosATL _pos;  
    		//_container enableSimulation false;  
    
    		_containers pushBack _container;  
    		clearWeaponCargoGlobal _container;  
    		clearItemCargoGlobal _container;  
    		clearMagazineCargoGlobal _container;  
    		clearBackpackCargoGlobal _container;  
    		//Add weapons to the crate.  
    		{  
    			_weaponCount = (_weapons select 1) select _forEachIndex;  
    			_container addWeaponCargoGlobal [_x,_weaponCount];  
    		} foreach (_weapons select 0);  
    
    		//Add magazines  
    		{  
    			_magazineCount = (_magazines select 1) select _forEachIndex;  
    			_container addMagazineCargoGlobal [_x,_magazineCount];  
    		} foreach (_magazines select 0);  
    
    		//Add items  
    		{  
    			_itemCount = (_items select 1) select _forEachIndex;  
    			_container addItemCargoGlobal [_x,_itemCount];  
    		} foreach (_items select 0);  
    
    		//Add backpacks  
    		{  
    			_backpackCount = (_backpacks select 1) select _forEachIndex;  
    			_container addBackpackCargoGlobal [_x,_backpackCount];  
    		} foreach (_backpacks select 0);  
    
    	} foreach _containerData;  
    
    	_house setVariable["containers",_containers,true];  
    	_return pushBack [_x select 1,_containers];  
    } foreach _houses;  
    
    missionNamespace setVariable[format["houses_%1",_this],_return];  
    

    2)Altis_Life.Altis

    **Allez dans : ****Altis_Life.Altis/core/housing/fn_initHouses.sqf **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Initializes the players houses, mainly throwing down markers.  
    */  
    if(count life_houses == 0) exitWith {}; //Nothing to do.  
    
    {  
    	_position = call compile format["%1",_x select 0];  
    
    	_house = nearestBuilding _position; //remplacer cette ligne  
            _house = nearestObject [_position,"house_F"]; //par cette ligne  
    
    	_house setVariable["uid",round(random 99999),true];  
    	_houseName = getText(configFile >> "CfgVehicles" >> (typeOf _house) >> "displayName");  
    
    	_marker = createMarkerLocal [format["house_%1",(_house getVariable "uid")],_position];  
    	_marker setMarkerTextLocal _houseName;  
    	_marker setMarkerColorLocal "ColorBlue";  
    	_marker setMarkerTypeLocal "loc_Lighthouse";  
    
    } foreach life_houses;  
    

    **Allez dans : Altis_Life.Altis/core/functions/fn_inventoryOpened.sqf **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	For the mean time it blocks the player from opening another persons backpack  
    */  
    private["_container","_unit"];  
    if(count _this == 1) exitWith {false};  
    _unit = _this select 0;  
    _container = _this select 1;  
    
    _isPack = getNumber(configFile >> "CfgVehicles" >> (typeOf _container) >> "isBackpack");  
    if(_isPack == 1) then {  
    	hint localize "STR_MISC_Backpack";  
    	[] spawn {  
    		waitUntil {!isNull (findDisplay 602)};  
    		closeDialog 0;  
    	};  
    };  
    
    if((typeOf _container) in ["Box_IND_Grenades_F","B_supplyCrate_F"]) exitWith {  
    
    	_house = nearestBuilding (getPosATL player); //remplacer cette ligne  
            _house = nearestObject [(getPosATL player),"house_F"]; //par cette ligne  
    
    	if(!(_house in life_vehicles) && {(_house getVariable ["locked",false])}) then {  
    		hint localize "STR_House_ContainerDeny";  
    		[] spawn {  
    			waitUntil {!isNull (findDisplay 602)};  
    			closeDialog 0;  
    		};  
    	};  
    };  
    
    if(_container isKindOf "LandVehicle" OR _container isKindOf "Ship" OR _container isKindOf "Air") exitWith {  
    	if(!(_container in life_vehicles) && {(locked _container) == 2}) exitWith {  
    		hint localize "STR_MISC_VehInventory";  
    		[] spawn {  
    			waitUntil {!isNull (findDisplay 602)};  
    			closeDialog 0;  
    		};  
    	};  
    };  
    
    //Allow alive players who've been knocked out to be looted, just not the dead ones  
    if(_container isKindOf "Man" && !alive _container) exitWith {  
    	hint localize "STR_NOTF_NoLootingPerson";  
    	[] spawn {  
    		waitUntil {!isNull (findDisplay 602)};  
    		closeDialog 0;  
    	};  
    };  
    

    **Allez dans : Altis_Life.Altis/dialog/function/fn_spawnPointCfg.sqf  **

    /*  
    	File: fn_spawnPointCfg.sqf  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Master configuration for available spawn points depending on the units side.  
    
    	Return:  
    	[Spawn Marker,Spawn Name,Image Path]  
    */  
    private["_side","_return"];  
    _side = [_this,0,civilian,[civilian]] call BIS_fnc_param;  
    
    //Spawn Marker, Spawn Name, PathToImage  
    switch (_side) do  
    {  
    	case west:  
    	{  
    		_return = [  
    			["cop_spawn_1","Kavala HQ","\a3\ui_f\data\map\MapControl\watertower_ca.paa"],  
    			["cop_spawn_2","Pyrgos HQ","\a3\ui_f\data\map\MapControl\fuelstation_ca.paa"],  
    			["cop_spawn_3","Athira HQ","\a3\ui_f\data\map\GroupIcons\badge_rotate_0_gs.paa"],  
    			["cop_spawn_4","Air HQ","\a3\ui_f\data\map\Markers\NATO\b_air.paa"],  
    			["cop_spawn_5","HW Patrol","\a3\ui_f\data\map\GroupIcons\badge_rotate_0_gs.paa"]  
    		];  
    	};  
    
    	case civilian:  
    	{  
    		_return = [  
    			["civ_spawn_1","Kavala","\a3\ui_f\data\map\MapControl\watertower_ca.paa"],  
    			["civ_spawn_2","Pyrgos","\a3\ui_f\data\map\MapControl\watertower_ca.paa"],  
    			["civ_spawn_3","Athira","\a3\ui_f\data\map\MapControl\watertower_ca.paa"],  
    			["civ_spawn_4","Sofia","\a3\ui_f\data\map\MapControl\watertower_ca.paa"]  
    		];  
    
    		if(count life_houses > 0) then {  
    			{  
    				_pos = call compile format["%1",_x select 0];  
    
                                    _house = nearestBuilding _pos; //remplacer cette ligne  
                                    _house = nearestObject [_pos,"house_F"]; //par cette ligne  
    
    				_houseName = getText(configFile >> "CfgVehicles" >> (typeOf _house) >> "displayName");  
    
    				_return pushBack [format["house_%1",_house getVariable "uid"],_houseName,"\a3\ui_f\data\map\MapControl\lighthouse_ca.paa"];  
    			} foreach life_houses;  
    		};	  
    	};  
    
    	case independent: {  
    		_return = [  
    			["medic_spawn_1","Kavala Hospital","\a3\ui_f\data\map\MapControl\hospital_ca.paa"],  
    			["medic_spawn_2","Athira Regional","\a3\ui_f\data\map\MapControl\hospital_ca.paa"],  
    			["medic_spawn_3","Pygros Hospital","\a3\ui_f\data\map\MapControl\hospital_ca.paa"]  
    		];  
    	};  
    };  
    
    _return;  
    

    **Allez dans : Altis_Life.Altis/core/items/fn_storageBox.sqf   **

    /*  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Tries to place a storage box in the nearest house.  
    */  
    private["_boxType","_house","_positions","_containers","_pos","_houseCfg"];  
    _boxType = _this select 0;  
    
    _house = nearestBuilding (getPosATL player); //remplacer cette ligne  
    _house = nearestObject [(getPosATL player),"house_F"]; //par cette ligne  
    
    if(!(_house in life_vehicles)) exitWith {hint localize "STR_ISTR_Box_NotinHouse"};  
    _containers = _house getVariable["containers",[]];  
    _houseCfg = [(typeOf _house)] call life_fnc_houseConfig;  
    if(count _houseCfg == 0) exitWith {}; //What the fuck happened?  
    if(count _containers >= (_houseCfg select 1)) exitWith {hint localize "STR_ISTR_Box_HouseFull"};  
    
    _slots = _house getVariable ["slots",[]];  
    _positions = [_house] call life_fnc_getBuildingPositions;  
    _pos = [0,0,0];  
    {  
    	_slots = _house getVariable ["slots",[]];  
    	if(!(_forEachIndex in _slots)) exitWith {  
    		_slots pushBack _forEachIndex;  
    		_house setVariable["slots",_slots,true];  
    		_pos = _x;  
    	};  
    } foreach _positions;  
    if(_pos isEqualTo [0,0,0]) exitWith {hint localize "STR_ISTR_Box_HouseFull_2"};  
    if(!([false,_boxType,1] call life_fnc_handleInv)) exitWith {};  
    switch (_boxType) do {  
    	case "storagesmall": {  
    		_container = "Box_IND_Grenades_F" createVehicle [0,0,0];  
    		_container setPosATL _pos;  
    
    		_containers pushBack _container;  
    		_house setVariable["containers",_containers,true];  
    		[[_house],"TON_fnc_updateHouseContainers",false,false] spawn life_fnc_MP;  
    
    		//Empty out the crate  
    		clearWeaponCargoGlobal _container;  
    		clearMagazineCargoGlobal _container;  
    		clearItemCargoGlobal _container;  
    		clearBackpackCargoGlobal _container;  
    	};  
    
    	case "storagebig": {  
    		_container = "B_supplyCrate_F" createVehicle [0,0,0];  
    		_container setPosATL _pos;  
    
    		_containers pushBack _container;  
    		_house setVariable["containers",_containers,true];  
    		[[_house],"TON_fnc_updateHouseContainers",false,false] spawn life_fnc_MP;  
    
    		//Empty out the crate  
    		clearWeaponCargoGlobal _container;  
    		clearMagazineCargoGlobal _container;  
    		clearItemCargoGlobal _container;  
    		clearBackpackCargoGlobal _container;  
    	};  
    };  
    

    **Allez dans : Altis_Life.Altis/core/session/fn_requestReceived.sqf   **

    #include <macro.h>  
    /*  
    	File: fn_requestReceived.sqf  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Called by the server saying that we have a response so let's   
    	sort through the information, validate it and if all valid   
    	set the client up.  
    */  
    life_session_tries = life_session_tries + 1;  
    if(life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma…  
    if(life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;};  
    
    0 cutText [localize "STR_Session_Received","BLACK FADED"];  
    0 cutFadeOut 9999999;  
    
    //Error handling and  junk..  
    if(isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;};  
    if(typeName _this == "STRING") exitWith {[] call SOCK_fnc_insertPlayerInfo;};  
    if(count _this == 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;};  
    if((_this select 0) == "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;};  
    if((getPlayerUID player) != _this select 0) exitWith {[] call SOCK_fnc_dataQuery;};  
    
    //Lets make sure some vars are not set before hand.. If they are get rid of them, hopefully the engine purges past variables but meh who cares.  
    if(!isServer && (!isNil "life_adminlevel" OR !isNil "life_coplevel" OR !isNil "life_donator")) exitWith {  
    	[[profileName,getPlayerUID player,"VariablesAlreadySet"],"SPY_fnc_cookieJar",false,false] spawn life_fnc_MP;  
    	[[profileName,format["Variables set before client initialization...\nlife_adminlevel: %1\nlife_coplevel: %2\nlife_donator: %3",life_adminlevel,life_coplevel,life_donator]],"SPY_fnc_notifyAdmins",true,false] spawn life_fnc_MP;  
    	sleep 0.9;  
    	["SpyGlass",false,false] execVM "\a3\functions_f\Misc\fn_endMission.sqf";  
    };  
    
    //Parse basic player information.  
    life_cash = parseNumber (_this select 2);  
    life_atmcash = parseNumber (_this select 3);  
    __CONST__(life_adminlevel,parseNumber(_this select 4));  
    __CONST__(life_donator,0);  
    
    //Loop through licenses  
    if(count (_this select 6) > 0) then {  
    	{missionNamespace setVariable [(_x select 0),(_x select 1)];} foreach (_this select 6);  
    };  
    
    life_gear = _this select 8;  
    [] call life_fnc_loadGear;  
    
    //Parse side specific information.  
    switch(playerSide) do {  
    	case west: {  
    		__CONST__(life_coplevel, parseNumber(_this select 7));  
    		__CONST__(life_medicLevel,0);  
    		life_blacklisted = _this select 9;  
    	};  
    
    	case civilian: {  
    		life_is_arrested = _this select 7;  
    		__CONST__(life_coplevel, 0);  
    		__CONST__(life_medicLevel, 0);  
    		life_houses = _this select 9;  
    		{  
    			_house = nearestBuilding (call compile format["%1", _x select 0]); //remplacer cette ligne  
                            _house = nearestObject [(call compile format["%1", _x select 0]),"house_F"]; //par cette ligne  
    
    			life_vehicles pushBack _house;  
    		} foreach life_houses;  
    
    		life_gangData = _This select 10;  
    		if(count life_gangData != 0) then {  
    			[] spawn life_fnc_initGang;  
    		};  
    		[] spawn life_fnc_initHouses;  
    	};  
    
    	case independent: {  
    		__CONST__(life_medicLevel, parseNumber(_this select 7));  
    		__CONST__(life_coplevel,0);  
    	};  
    };  
    
    if(count (_this select 12) > 0) then {  
    	{life_vehicles pushBack _x;} foreach (_this select 12);  
    };  
    
    life_session_completed = true;  
    
  • Merci ! Je test sa demain je cherchais un moyen justement je te tien au courant si personne le fait d’ici la !

  • Ok j attend ton avis

  • Je vois que tu met le classname du bâtiment on peut donc voir pour essayer avec des bâtiments moddé non ?

  • J ai mis un classname parent house_f qui prend tous les bâtiment

    Pour les bâtiment modde il y a d’autre vérification qui ne sont pas la cause du problème lier au maison ajouter example un hangar ne peut pas être acheter il faut modifier la mission pour intègre le hangar a l achat

  • @John doe ah d’accord ^^

  • @Hoxton je peut regarder si tu veut pour ajouter une maison modde dans les achats de maison

  • sa pourrait être sympa ouai ^^ étant donner qu’on fais la plupart de nos bâtiments nous même… seul le sud utilisera les bâtiments arma 3 pour le côtés tropical !

    @John doe

  • Il me faudrais un bâtiment pour tous essayer comme le verrouillage des portes

    Peut tu m’envoyer un pour les tests?

  • J’essaye de t’envoyer ça dès que j’ai du temps !

  • Merci ! J’avais essayé il y a un moment avec des hangars mais sans touché au life_server. Ça fonctionnait mais je ne pouvais pas ouvrir les portes

  • @Hoxton Le sud tropical… Hum… Ça dépend de quel sud on parle, le sud côté Monaco/Nice oui un peu… Mais le Sud de chez moi (Bordeaux) ou encore plus bas les pyrennés ce n’est pas très tropical.

  • @Anko死神 Je veux dire le style de bâtiment rooh

  • Merci beaucoup cela résolu le bug comme quoi qu’on ne pouvait pas mettre de coffre dans les maisons ajouté et qu’on avait acheté :)

  • @Mathieu <– pour les portes c’est normale le hangar et trop grand il suffi d’augmenter la distance dans le fichier keyhandle dans la case U avec 20 comme distance sa fonctionne

  • Et comment on peut faire pour ajouter les bâtiments moddé achetables ? remplacer peut être house_f par l’id du bâtiment en question nan ?

  • @TheGamingG3 je pense, j’en suis même sûr

  • @Mathieu <– et donc pour rajouter plusieurs bâtiments moddé à la fois on fait dans ce genre la : [“house_f”,“house_t”]

  • si ton bâtiment moddé et bien fait pas la peine de changer ce tuto car il aura comme class parent house_f

    pour ajouter un bâtiment a l’achat il faut l’ajouter dans

    core/config/fn_houseConfig.sqf

    il faut aussi faire mon tuto car sa seras un bâtiment placer via l’éditeur(sauf peut être si c’est une map moddé)

    il y a aussi un autre fichier

    core/housing/fn_lightHouse.sqf

    pour configurer la lumiere du batiment

  • Salut,

    J’ai suivi votre tuto en placent des maison via X-cam (maison non modé) on peut les acheter et placer des caisses à l’intérieur, mais aorés chaque reboot les caisses ne sont plus présentes et les maisons sont de nouveaux achetables, pour autant leur propriétaire peuvent toujours spawn à l’intérieur.

    Merci d’avance.

Messages 26Vues 7638