HI, i added this feature on my eathena server, now it works fine, but i 've had an issue where the server was sometime not able to load all the shops, that was totally gambling because of this :
//If the last autotrade is loaded, clear autotraders [Cydh]
if( i + 1 >= autotrader_count )
do_final_vending_autotrade();
i set in ARR_FIND(0,autotrader_count,i,autotraders && autotraders->char_id == sd->status.char_id);
so sometimes when the first shop triggered is the last of the autotrader DB i , meaning ( i + 1 >= autotrader_count ) is true and trigger do_final_vending_autotrade() so all shops are gone exept the first loaded.
All because they are loaded at the same time by pc_autotrade_timer triggered by timer with do_init_pc. I don't know if there is this problem on rAthena but if any user trying to put this feature on eathena server, experience this problem
I fixed it by making a second
static uint16 autotrader_count_final = 0; and
}
autotrader_count_final++;
aFree(data);
//If the last autotrade is loaded, clear autotraders [Cydh]
if( autotrader_count_final >= autotrader_count )
do_final_vending_autotrade();
and reseting it with autotrader_count
maybe just putting order in sql request do the job, i don't tried it at this time <<ORDER BY `char_id` DESC>>
Repeating that i'am on eathena so maybe it's just an outdate problem