Comment rajouter la bourse?


#1

Bonjour, je recherche ça depuis pas mal de temps déjà. Désolé d’avance si ce poste avait deja était creez :wink:

Merci d’avance !


#2

http://www.altisliferpg.com/topic/4528-howtotutorial-market-system-economy-system/

Si tu es en 3.1.4.5 tu auras besoin d’un correctif

http://altisdev.com/index.php?/topic/296-fix-bourse-item-invendable/


#3

sans oublier le fix pour que les ressources ne tombent a zero

fn_marketBuy.sqf

/*  

	Buy [SHORTNAME, AMOUNT, israw, send?]  

*/  

private["_shortname","_amount","_price","_modifier","_globalprice","_min","_dir","_israw","_arr_resource","_arr_price","_modifier","_send","_relamount","_max"];  

_shortname = _this select 0;  
_amount = _this select 1;  
_israw = [_this, 2, false] call BIS_fnc_param;  
_send = [_this, 3, true] call BIS_fnc_param;  

//Get all necessary arrays  
_arr_resource = [_shortname] call life_fnc_marketGetRow;  
_arr_price = [_shortname] call life_fnc_marketGetPriceRow;  

//Calculate the new price of the product  
_price = _arr_price select 1; //current price  
_globalprice = _arr_price select 2; //current change rate  

_modifier = (_amount * (_arr_resource select 5)); //calculate modifier  

_price = _price + _modifier;  
_globalprice = _globalprice + _modifier;  

//Check borders  

_min = _arr_resource select 2;  

if( _price < _min)then {_price = _min;};  

_max = _arr_resource select 3;  

if( _price > _max)then {_price = _max;};  

//insert into new array  
[_shortname, [_shortname,_price,_globalprice,_modifier], false ] call life_fnc_marketSetPriceRow; //dont broadcast!  

/////Change related prices  
if(!_israw) then  
{  
	{  
		_relamount = ceil (_amount * (_x select 1));  
		if(_relamount < 0) then //INVERTED!  
		{  
			_relamount = -(_relamount);  
			[_x select 0, _relamount, true, false] call life_fnc_marketBuy; //Make prices higher, no broadcast!  
		}  
		else  
		{  
			[_x select 0, _relamount, true, false] call life_fnc_marketSell; //Make prices higher, no broadcast!  
		};  
	}  
	foreach (_arr_resource select 6); //in change array  
};  

//Broadcast now if can send  
 if(_send) then {publicVariable "life_market_prices";};  

_min = _arr_resource select 2;

if( _price < _min)then {_price = _min;};

fn_marketSell.sqf

/*  

	Sell [SHORTNAME, AMOUNT, israw, send?]  

*/  

private["_shortname","_amount","_price","_modifier","_globalprice","_min","_dir","_israw","_arr_resource","_arr_price","_modifier","_send","_relamount","_max"];  

_shortname = _this select 0;  
_amount = _this select 1;  
_israw = [_this, 2, false] call BIS_fnc_param;  
_send = [_this, 3, true] call BIS_fnc_param;  

//Get all necessary arrays  
_arr_resource = [_shortname] call life_fnc_marketGetRow;  
_arr_price = [_shortname] call life_fnc_marketGetPriceRow;  

//Calculate the new price of the product  
_price = _arr_price select 1; //current price  
_globalprice = _arr_price select 2; //current change rate  

_modifier = (_amount * (_arr_resource select 4)); //calculate modifier  

_price = _price - _modifier;  
_globalprice = _globalprice - _modifier;  

//Check borders  

_min = _arr_resource select 2;  

if( _price < _min)then {_price = _min;};  

_max = _arr_resource select 3;  

if( _price > _max)then {_price = _max;};  

//insert into new array  
[_shortname, [_shortname,_price,_globalprice,-(_modifier)], false ] call life_fnc_marketSetPriceRow; //dont broadcast!  

/////Change related prices  
if(!_israw) then  
{  
	{  
		if((count _x) == 2) then  
		{  
		    _relamount = ceil (_amount * (_x select 1));  

		    if(_relamount > 0) then  
		    {  
			[_x select 0, _relamount, true, false] call life_fnc_marketBuy; //Make prices higher, no broadcast!  
		    }  
		    else  
		    {  
			_relamount = -(_relamount);  
			[_x select 0, _relamount, true, false] call life_fnc_marketSell; //Make prices higher, no broadcast!  
		    };  
		}  
		else  
		{  

		};  

	}  
	foreach (_arr_resource select 6); //in change array  
};  

//Broadcast now if can send  
 if(_send) then {publicVariable "life_market_prices";};  

_min = _arr_resource select 2;

if( _price < _min)then {_price = _min;};


#4

Genux N1colas avait déja mis le FIX


#5

Non il a poste un autre FIX :slight_smile:


#6

N1colas Le tien marche trés bien !


#7

Peut-être mais son fix permet à que les items (cocaïne …) ne se vendent 0$


#8

N1colas Okay


#9

Wow merci les gas de votre aide ! :smiley: super ce forum ! Je test tout et je vous redis :wink:


#10

Pas de problèmes si tu veux encore de l’aide dit le nous ! :slight_smile:


#11

N1colas +1 TanGeek Derien