I have not tried it but the place would be this:
spawn.cpp
C++:
// Adjust spawn time based on amount of player online.
const uint8_t maxReduction = 90;
const size_t reduction = std::min<size_t>(maxReduction, g_game.getPlayersOnline());
const uint32_t spawnTime = sb.interval - (sb.interval * reduction / 100);
if (OTSYS_TIME() >= sb.lastSpawn + spawnTime) {
This example uses a simple formula, count players up to a maximum of 90, so the time will be reduced by 90%, you can adjust it to your liking.
To make it look nicer maybe you should use constants defined in configmanager so you can configure this in
config.lua
... but that's up to you.