Jump to content

Traders are duplicated in DB


Kenobi

Recommended Posts

if you set the traders to static in the epochconfig.hpp and you specify the items they start with. then all static spawned traders will have those items when the server first starts up. then as players play, and sell/buy to those traders, the items willl start to change a bit.

 

If you are wanting different spawns to have different items then you will have to make a lua file and run redis-cli.exe with a query to restock items based on the AI # in the database

 

like so

create a file calling it clean_ai_items.lua

local count = 0
local valuelist = redis.call('keys', 'AI_ITEMS:NA123:*')
if valuelist then
    for i = 1, #valuelist do
        
		--Delete
		redis.call('del', valuelist[i])

		--Set ( Custom Trader loadouts can be set here)
	        --redis.call('set', valuelist[i], '[[],[]]')

		count = count + 1
       
    end
end
return count

change

local valuelist = redis.call('keys', 'AI_ITEMS:NA123:*')

 

to local valuelist = redis.call('keys', 'AI_ITEMS:NA123:#')

# being the specific key in the database

 

then with this script you would run it, which would wipe out that specific AI inventory

 

then you would comment out

redis.call('del', valuelist)

 

so it would look like

 

--redis.call('del', valuelist)

 

then uncomment

--redis.call('set', valuelist, '[[],[]]')

 

so it looks like

redis.call('set', valuelist, '[[item_class_name],[item_amount_to_sell]]')

 

example:

redis.call('set', valuelist[i], '[["WhiskeyNoodle","ItemCoolerE","Hatchet","16Rnd_9x21_Mag","PaintCanGrn","HeatPack","ItemGoldBar10oz","Chemlight_green","HandGrenade","30Rnd_9x21_Mag","6Rnd_45ACP_Cylinder","20Rnd_556x45_UW_mag","5Rnd_rollins_mag","9rnd_45X88_magazine","ItemScraps","optic_Holosight_smg","30Rnd_65x39_caseless_green","SmokeShellRed","SmokeShellBlue","20Rnd_762x51_Mag","emptyjar_epoch","muzzle_snds_H","SmokeShellOrange","5Rnd_127x108_APDS_Mag","arifle_Mk20C_plain_F","ChainSaw","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag","muzzle_snds_M","muzzle_snds_B","C_Van_01_box_EPOCH","honey_epoch","ItemEmerald","30Rnd_556x45_Stanag","30Rnd_762x39_Mag","PaintCanOra","11Rnd_45ACP_Mag","MortarBucket","FoodSnooter","PaintCanBlk","PaintCanBlu","PaintCanYel","optic_Holosight","arifle_MX_F","200Rnd_65x39_cased_Box","LMG_Mk200_F","Binocular","arifle_Mk20_plain_F","H_14_EPOCH","optic_Aco_smg","7Rnd_408_Mag","200Rnd_556x45_M249","9Rnd_45ACP_Mag","30Rnd_45ACP_Mag_SMG_01","V_4_EPOCH","V_16_EPOCH","hgun_PDW2000_F","jerrycan_epoch","100Rnd_65x39_caseless_mag","hgun_P07_F","SmokeShellGreen","Pelt_EPOCH","NVG_EPOCH","MiniGrenade","CircuitParts","optic_Yorris","10Rnd_762x51_Mag","5Rnd_127x108_Mag","6Rnd_GreenSignal_F","hgun_Pistol_Signal_F","SmokeShell","optic_Aco","hgun_Pistol_heavy_01_F","arifle_MXC_F","hgun_Rook40_F","M14Grn_EPOCH","SmokeShellPurple","muzzle_snds_H_MG","acc_flashlight","m249Tan_EPOCH","SMG_02_F","m249_EPOCH","200Rnd_65x39_cased_Box_Tracer","30Rnd_556x45_Stanag_Tracer_Yellow","optic_DMS","Towelette","acc_pointer_IR"],[1,4,0,11,1,2,2,19,16,5,5,2,2,2,1,1,2,1,2,1,0,1,15,0,1,0,2,0,2,2,0,0,1,8,2,1,11,0,0,0,1,1,1,3,13,1,2,1,0,2,2,2,9,4,1,1,2,0,1,1,14,1,0,8,0,1,1,0,2,1,14,3,1,1,1,0,14,1,1,1,1,1,1,1,1,2,1]]')

then you would create a batch file to run the lua

like so:

@echo off

echo Now Starting purge of Spawned Vehicles
redis-cli -h redisipaddress -p redisport# -a redispassword -n 0 --eval clean_ai_items.lua
timeout 10
echo Purged
timeout 3
exit 

change redisipaddress, redisport#, redispassword to match your servers info.

 

then run the bat file and it should work..

 

Just a side note, some hosts like gtxgaming, unless you have a dedicated server they do not allow you to add bat files, cmd files or even run headless clients.

 

If this is the case for you.  download redis desktop manager connect to the database that way, and you can add the items that way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...