import express from 'express';
import { LoginSystem } from '../../../../features/login';

export async function CharacterBulkIsIngame(req: express.Request, res: express.Response): Promise<void> {
    if (!req.body?.length) {
        res.status(400).send('Missing parameter');
    }

    const players = req.body;

    const online = mp.players.toArray().filter((player) => LoginSystem.IsLoggedIn(player) && players.includes(player.character!.id));
    res.send({
        online: online.map((o) => o.character!.id),
    });
}
