Can try using the following script:
- Open your rAthena server's database management tool.
- Create a new table in your database with the following columns:
`id`, `name`, `price`, `vend_time`, `vend_map`, `vend_x`, `vend_y`
- In your server's `conf/import/tables.sql` file, add the following line:
`pickup_log: id int(11) NOT NULL AUTO_INCREMENT, name varchar(50) NOT NULL DEFAULT '', price int(11) NOT NULL DEFAULT '0', vend_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00', vend_map varchar(50) NOT NULL DEFAULT '', vend_x int(11) NOT NULL DEFAULT '0', vend_y int(11) NOT NULL DEFAULT '0', PRIMARY KEY (id)`
- In your server's `src/map/vending.c` file, find the `vending_buyitem` function.
- Inside the `vending_buyitem` function, add the following lines of code:
```
char vend_name[NAME_LENGTH];
int vend_price;
struct map_session_data *sd = map_id2sd(vendor_id);
if (sd != NULL) {
safestrncpy(vend_name, itemdb_name(item_data[item_id]), NAME_LENGTH);
vend_price = (int)price;
SQL->EscapeString(sql_handle, sql_query, vend_name, sizeof(vend_name));
SQL->Query(sql_handle, "INSERT INTO pickup_log (name, price, vend_time, vend_map, vend_x, vend_y) VALUES ('%s', '%d', NOW(), '%s', '%d', '%d')", vend_name, vend_price, mapindex_id2name(sd->bl.m), sd->bl.x, sd->bl.y);
}
```
This will create a new entry in the `pickup_log` table every time a player buys an item from a vending shop, recording the name of the item, its price, the time of the transaction, and the location of the vending shop.