/* ##################### 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 = 05; // 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 = 03; // After how many updates (PriceUpdateIntervals) should the prices be saved into the Database? DYNMARKET_UserNotification = true; // Should the user be informed with a hint whenever the prices got updated? // █████████████████ USER NOTIFICATION TEXTS █████████████████ DYNMARKET_UserNotification_Text = [ "Die Preise haben sich geändert !", "Die neuen Preise werden vom Server berechnet ..." ]; // █████████████████ ITEM GROUP CONFIGURATION █████████████████ DYNMARKET_Items_Groups = [ ["Legal", [ ["apple",-1,2,4], ["peach",-1,30,100], ["rabbit_raw",-1,20,25], ["rabbit",-1,20,23], ["ornate_raw",-1,15,19], ["ornate",-1,15,18], ["mackerel_raw",-1,15,17], ["mackerel",-1,15,16], ["tuna_raw",-1,25,29], ["tuna",-1,25,28], ["mullet_raw",-1,10,16], ["mullet",-1,10,15], ["catshark_raw",-1,35,39], ["catshark",-1,35,40], ["turtle_soup",-1,125,136], ["hen_raw",-1,20,24], ["hen",-1,20,24], ["rooster_raw",-1,20,24], ["sheep_raw",-1,25,29], ["sheep",-1,25,28], ["goat_raw",-1,30,36], ["goat",-1,30,35], ["goldbar",-1,3500,3500], ["oil_processed",-1,105,120], ["copper_refined",-1,55,65], ["iron_refined",-1,75,80], ["salt_refined",-1,95,105], ["glass",-1,102,107], ["diamond_cut",-1,205,220], ["cement",-1,45,60] ], 0.5 ], ["Illegal", [ /*["peach",-1,30,100]*/ ["heroin_processed",-1,275,300], ["marijuana",-1,135,150], ["cocaine_processed",-1,175,200] ], 0.5 ] ]; // █████████████████ ALL SELLABLE ITEMS █████████████████ DYNMARKET_Items_ToTrack = [ ["apple",2], ["peach",2], ["rabbit_raw",20], ["rabbit",20], ["ornate_raw",15], ["ornate",15], ["mackerel_raw",15], ["mackerel",15], ["tuna_raw",25], ["tuna",25], ["mullet_raw",10], ["mullet",10], ["catshark_raw",35], ["catshark",35], ["turtle_soup",125], ["hen_raw",20], ["hen",20], ["rooster_raw",20], ["sheep_raw",25], ["sheep",25], ["goat_raw",30], ["goat",30], ["goldbar",3500], ["oil_processed",105], ["copper_refined",55], ["iron_refined",75], ["salt_refined",95], ["glass",102], ["diamond_cut",205], ["cement",45], ["heroin_processed",275], ["marijuana",135], ["cocaine_processed",175] ]; //███████████████████████████████████████████████████████████████████████ //██████████████████ DO NOT MODIFY THE FOLLOWING CODE! ██████████████████ //███████████████████████████████████████████████████████████████████████ DYNMARKET_Items_CurrentPriceArr = []; DYNMARKET_sellarraycopy = DYNMARKET_Items_ToTrack; DYNMARKET_Serveruptime = (DYNMARKET_Serveruptime * 3600) - 300; { _currentArray = _x; DYNMARKET_Items_CurrentPriceArr pushBack [_currentArray select 0,_currentArray select 1,0]; } forEach DYNMARKET_Items_ToTrack; publicVariable "DYNMARKET_UserNotification"; publicVariable "DYNMARKET_UserNotification_Text"; if (DYNMARKET_UseExternalDatabase) then {[1] call TON_fnc_HandleDB;}; DYNMARKET_UpdateCount = 0; if (DYNMARKET_UseExternalDatabase) then { [] spawn { sleep DYNMARKET_Serveruptime; diag_log "### DYNMARKET >> CURRENT PRICES ARE BEING WRITTEN TO THE DATABASE ###"; diag_log "### DYNMARKET >> AS PLANNED, AWAITING RESULT... ###"; [0] call TON_fnc_HandleDB; }; }; sleep 5; [] call TON_fnc_sleeper;