Jump to content
suffer4real

[TUTORIAL][4.4R3] RYANTTS DYNAMIC MARKET SYSTEM

Recommended Posts

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Difficulty: Easy

Publish by:  suffer4real

Source AltisLifeRPG.com cache

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Script: RyanTTs Dynamic Market System
Version: Altis Life 4.4r3

___________________________________________________________________________________

First Make sure you make a backup just in case you do something wrong.
I am having this script running on a clean 4.4r3 and that should work.

Let's start shall we ?

Mission File :

open your : functions.h  and paste this code under the core/actions class.

 

class DynMarket
    {
        file = "core\DynMarket";
        class bought {};
        class update {};
        class DisplayPrices {};
        class LoadIntoListbox {};
        class ForcePrice {};
        class DYNMARKET_getPrice {};
		class DYNMARKET_getIcon {};
    };


2.

i will add a Dynmarket folder in the attachments and place it in the core folder.
DynMarket.rar

3.

now open the init.sqf file in the core folder and put this code right above the last 3 lines

 

DYNAMICMARKET_boughtItems = [];
[player] remoteExec ["TON_fnc_playerLogged",RSERV];

4.

open your fn_virt_sell.sqf and replace with this :
 

#include "..\..\script_macros.hpp"
/*
 File: fn_virt_sell.sqf
 Author: Bryan "Tonic" Boardwine
 Description:
 Sell a virtual item to the store / shop
*/
private["_type","_index","_price","_amount","_name"];
if ((lbCurSel 2402) isEqualTo -1) exitWith {};
_type = lbData[2402,(lbCurSel 2402)];
_price = -2;
_itemNameToSearchFor = _type;
{
 _curItemName = _x select 0;
 _curItemPrice = _x select 1;
 if (_curItemName==_itemNameToSearchFor) then {_price=_curItemPrice};
} forEach DYNMARKET_prices;
if (_price isEqualTo -1) exitWith {};
if (_price isEqualTo -2) then {
 _price = M_CONFIG(getNumber,"VirtualItems",_type,"sellPrice");
 if (_price isEqualTo -1) exitWith {};
};
_amount = ctrlText 2405;
if (!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};
_amount = parseNumber (_amount);
if (_amount > (ITEM_VALUE(_type))) exitWith {hint localize "STR_Shop_Virt_NotEnough"};
if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
life_action_delay = time;
_price = (_price * _amount);
_name = M_CONFIG(getText,"VirtualItems",_type,"displayName");
if ([false,_type,_amount] call life_fnc_handleInv) then {
 hint format[localize "STR_Shop_Virt_SellItem",_amount,(localize _name),[_price] call life_fnc_numberText];
 CASH = CASH + _price;
 [0] call SOCK_fnc_updatePartial;
 [] call life_fnc_virt_update;
 DYNAMICMARKET_boughtItems pushBack [_type,_amount];
};
if (life_shop_type isEqualTo "drugdealer") then {
 private["_array","_ind","_val"];
 _array = life_shop_npc getVariable["sellers",[]];
 _ind = [getPlayerUID player,_array] call TON_fnc_index;
 if (!(_ind isEqualTo -1)) then {
 _val = ((_array select _ind) select 2);
 _val = _val + _price;
 _array set[_ind,[getPlayerUID player,profileName,_val]];
 life_shop_npc setVariable["sellers",_array,true];
 } else {
 _array pushBack [getPlayerUID player,profileName,_price];
 life_shop_npc setVariable["sellers",_array,true];
 };
};
if (life_shop_type isEqualTo "gold" && (LIFE_SETTINGS(getNumber,"noatm_timer")) > 0) then {
 [] spawn {
 life_use_atm = false;
 sleep ((LIFE_SETTINGS(getNumber,"noatm_timer")) * 60);
 life_use_atm = true;
 };
};
[0] call SOCK_fnc_updatePartial;
[3] call SOCK_fnc_updatePartial;

5.

now open your CfgRemoteExec.hpp and paste this right below the server functions

 

F(TON_fnc_playerLogged,SERVER) //DynMarket
F(TON_fnc_getUpdate,SERVER) //DynMarket
F(TON_fnc_changePrice, SERVER) //DynMarket
F(life_fnc_update,CLIENT) //DynMarket

 

6.

open your masterhandler.hpp and add these 2:

 

#include "dynmarket_changeprice.hpp"
#include "dynmarket_prices.hpp"

7. 

now download these 2 files and place them in your dialog folder.
dialog.rar

8.

now we go to the @life_server part.

now open your config.cpp and paste this under your system classes

 

class DynMarket
{
 file = "\life_server\Functions\DynMarket";
 class calculatePrices {};
 class config {};
 class getUpdate {};
 class HandleDB {};
 class playerLogged {};
 class sleeper {}; 
};

 

9.

now open your functions folder and download and paste this folder in it.
DynMarketlifeversion.rar

 

10.

now open your init.sqf and paste this :
 

[] execVM "\life_server\Functions\DynMarket\fn_config.sqf";


11.

now go to the Database and run this query :

 

CREATE TABLE `dynmarket` (
 `id` INT NOT NULL DEFAULT 1,
 `prices` TEXT NOT NULL,
 PRIMARY KEY (`id`));
INSERT INTO `dynmarket` VALUES (1,'[]');

 

12. from this point it will be your own preference to put a button in your Y menu or ether put a option on a AI.

for the Y menu follow this :

go to your player_inv.hpp and open it and search for Class ButtonSyncData and below that you paste this :

 

class ButtonMarket : Life_RscButtonMenu { 
 idc = 3025; 
 text = "Börse"; 
 onButtonClick = "createDialog ""life_dynmarket_prices"";"; 
 x = 0.26 + (6.25 / 19.8) + (1 / 250 / (safezoneW / safezoneH)); 
 y = 0.805; 
 w = (6.25 / 40); 
 h = (1 / 25); 
};

 

now open your fn_p_openMenu.sqf and add this code tho the independent class and to the west.

 

ctrlShow[3025,false];


Now if you would like to add this option to an AI or Object add this :

 

this addAction ["Börse abrufen",{createDialog 'life_dynmarket_prices'},"",0,false,false,"",'playerSide isEqualTo civilian'];



Well Done recompile your files and you are Ready to go. 

dialog.rar

DynMarket.rar

DynMarketlifeversion.rar

  • Like 4

Share this post


Link to post
Share on other sites
23 minutes ago, terrorista90 said:

Hello to all, in the menu with the "y" , opening "Borse", do not view the item, adepends on what?

in the file i do not see fn_DYNMARKET_getIcon.sqf

open your : functions.h and remove:

class DYNMARKET_getIcon {};

 

Share this post


Link to post
Share on other sites

3:19:20 Warning Message: Picture textures\armalife.jpg not found
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' Lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Unknown entity: ' lt'
 3:20:17 Unknown entity: ' gt'
 3:20:17 Starting mission:
 3:20:17  Mission file: Altis_Life (__CUR_MP)
 3:20:17  Mission world: Altis
 3:20:17  Mission directory: mpmissions\__CUR_MP.Altis\
 3:20:20 Attempt to override final function - bis_functions_list
 3:20:20 Attempt to override final function - bis_functions_listpreinit
 3:20:20 Attempt to override final function - bis_functions_listpostinit
 3:20:20 Attempt to override final function - bis_functions_listrecompile
 3:20:20 Attempt to override final function - bis_fnc_missiontaskslocal
 3:20:20 Attempt to override final function - bis_fnc_missionconversationslocal
 3:20:20 Attempt to override final function - bis_fnc_missionflow
 3:20:22 Wrong init state
 3:20:22 Attempt to override final function - bis_fnc_endmission
 3:20:22 "------------------------------------------------------------------------------------------------------"
 3:20:22 "--------------------------------- Starting Altis Life Client Init ----------------------------------"
 3:20:22 "------------------------------------------------------------------------------------------------------"
 3:20:22 "::Life Client:: Initialization Variables"
 3:20:22 "::Life Client:: Variables initialized"
 3:20:22 "::Life Client:: Setting up Eventhandlers"
 3:20:22 "::Life Client:: Eventhandlers completed"
 3:20:22 "::Life Client:: Setting up user actions"
 3:20:22 "::Life Client:: User actions completed"
 3:20:22 "::Life Client:: Waiting for server functions to transfer.."
 3:20:22 "::Life Client:: Received server functions."
 3:20:22 "::Life Client:: Waiting for the server to be ready.."
 3:20:22  Mission id: 72803764494ffff7abb1024aa992d56f6ecd7dec
 3:20:25 "<infiSTAR.de> 164.132.93.146 VERSION: 21-Aug-2016 18-48-46 infiSTAR.de AHAT (v0241) - server running: 0:2:965"
 3:20:26 Warning Message: No entry 'mpmissions\__CUR_MP.Altis\description.ext/life_spawn_selection/controlsBackground/MapView.LineMarker'.
 3:20:26 Warning Message: No entry '.lineWidthThin'.
 3:20:26 Warning Message: '/' is not a value
 3:20:26 Warning Message: No entry '.lineWidthThick'.
 3:20:26 Warning Message: '/' is not a value
 3:20:26 Warning Message: No entry '.lineDistanceMin'.
 3:20:26 Warning Message: '/' is not a value
 3:20:26 Warning Message: No entry '.lineLengthMin'.
 3:20:26 Warning Message: '/' is not a value
 3:20:26 "<infiSTAR.de> OPEN_ADMIN_MENU_KEY: 59"
 3:20:26 "67.194 <infiSTAR.de> Loading Menu..."
 3:20:26 "<infiSTAR.de> config data loaded...!"
 3:20:26 Attempt to override final function - fnc_admin_c
 3:20:26 Attempt to override final function - fnc_admin_cc
 3:22:19 "Past Settings Init"
 3:22:19 "Executing client.fsm"
 3:22:19 "Display 46 Found"
 3:22:19 "------------------------------------------------------------------------------------------------------"
 3:22:19 "                End of Altis Life Client Init :: Total Execution Time 116.867 seconds "
 3:22:19 "------------------------------------------------------------------------------------------------------"
 3:22:25 Error in expression <box )-1,_itemDisplayIcon];
};
} forEach DYNMARKET_prices;
>
 3:22:25   Error position: <DYNMARKET_prices;
>
 3:22:25   Error Variabile non definita nell’espressione: dynmarket_prices
 3:22:25 File mpmissions\__CUR_MP.Altis\core\DynMarket\fn_LoadIntoListbox.sqf, line 30
 

Share this post


Link to post
Share on other sites

I too get this error. Running 4.4 did everything the exact same.

} forEach DYNMARKET_prices;
>
17:39:45   Error position: <DYNMARKET_prices;
>
17:39:45   Error Undefined variable in expression: dynmarket_prices
17:39:45 File mpmissions\__CUR_MP.Altis\core\DynMarket\fn_LoadIntoListbox.sqf, line 30
17:39:50 Error in expression <box )-1,_itemDisplayIcon];
};
} forEach DYNMARKET_prices;
>
17:39:50   Error position: <DYNMARKET_prices;
>
17:39:50   Error Undefined variable in expression: dynmarket_prices
17:39:50 File mpmission

Fixed it https://github.com/RyanTT/DynamicMarket/tree/29eec6d52f01b63bbe61e9fa87fe0458c83c758e go here and use the 4.4r3 version. Remove all old files first though

Edited by jmuirhead

Share this post


Link to post
Share on other sites

Uhhh a little problem. Not really a problem, but a question out of confusion...

Changing the prices in fn_config.sqf located in core\DynMarket does not seem to be changing the prices in game. Am I missing something? I even matched the corresponding prices with the config_vitems.

Here is what it looks like in fn_config.sqf:

	["heroin_processed",9000],
	["marijuana",5250],
	["cocaine_processed",9750]

Is there another file that needs to be altered to change the prices?

 

*EDIT*

I even changed the config.sqf serverside and prices remain the same.

*EDIT #2* 

I forgot to change it in the databse... I haven't slept in 18 hours :c

 

Cheers,

Liam.

Edited by Liam

Share this post


Link to post
Share on other sites
Error in expression <







_playerUID = _this select 0;
[1,DYNMARKET_sellarraycopy] remoteExecCall >
  Error position: <DYNMARKET_sellarraycopy] remoteExecCall >
  Error Undefined variable in expression: dynmarket_sellarraycopy
File life_server\Functions\DynMarket\fn_playerLogged.sqf, line 12

For some reason I am getting that in my RPT, no idea why, did and re did the tutorial

Share this post


Link to post
Share on other sites

I installed this on the 4.4r3. And its works with no problems I haven't tried on 4.5 yet I will once I'm able to return home. I'm out of town due to brother being in the hospital in Seattle

Share this post


Link to post
Share on other sites
9 hours ago, MoNtEcRiStO© said:

People be able to successfully install that Market system can write +1 in the chat I have some complain about is not fonctionnal.

Please!  If is not im gonna rebuild it or make a new one.

Can you tell me what these numbers mean? I go it to work, but i have no clue what these number mean.

["peach",-1,30,100]

Share this post


Link to post
Share on other sites
2 hours ago, reaperz73 said:

Nice works well , how do you change how often the update notice pops up seems to pop up every minute.

Go into the fn_config.sqf located in life_server > function > DynMarket, I suggest leaving it at 1 minute intervals but stop it from messaging the client as seen below.

/*
##################### DYNAMIC MARKET SCRIPT #####################
### AUTHOR: RYAN TT.                                          ###
### STEAM: www.steamcommunity.com/id/ryanthett                ###
###                                                           ###
### DISCLAIMER: THIS SCRIPT CAN BE USED ON EVERY SERVER ONLY  ###
###             WITH THIS HEADER / NOTIFICATION               ###
#################################################################
*/

// ███████████████████████████████████████████████████████████████████████
// █████████████████ DYNAMIC MARKET BASIC CONFIGURATION ██████████████████
// ███████████████████████████████████████████████████████████████████████

DYNMARKET_Serveruptime         = 04;   // Serveruptime after restart in hours
DYNMARKET_UseExternalDatabase  = true; // Should the script use the External Database?
DYNMARKET_PriceUpdateInterval  = 01;   // After how many minutes should the price be updated?
DYNMARKET_CreateBackups        = true; // Should the server save write the prices regulary into the Database? If false, it will save the prices before Server-restart?
DYNMARKET_CreateBackupInterval = 01;   // After how many updates (PriceUpdateIntervals) should the prices be saved into the Database?
DYNMARKET_UserNotification     = false; // Should the user be informed with a hint whenever the prices got updated?

// █████████████████ USER NOTIFICATION TEXTS  █████████████████

as you can see above this keeps writing to the database every minute and also does not send the client a notification when the prices change, I suggest extending the time it send the data to the database, I only have it on 1 minute for testing.

  • Like 1

Share this post


Link to post
Share on other sites

Getting this error now not sure what the issues is now???

Error in expression <mFactorOfGroup = 0;

_exit = false;
if (_itemAmountSold>0) then
{
{
if (!_exit) >
  Error position: <_itemAmountSold>0) then
{
{
if (!_exit) >
  Error Undefined variable in expression: _itemamountsold
File life_server\Functions\DynMarket\fn_calculatePrices.sqf, line 23

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...