streetmeat Posted Saturday at 07:24 AM Posted Saturday at 07:24 AM (edited) I have a function on server-side that gets an array with characters on account from DB. but I don't know how to send the data from query into CEF. Is anyone know how to do that or any links on guides? server-side mp.events.add("server:getCharacterList", () => { const characterList = characters.findAll({ where: { Acc_ID: player.account.ID, } }); async function fetchCharacters() { try { return characterList.map((char) => char.toJSON()); } catch (error){ console.error("Error: ", error); } } const charactersJSON = fetchCharacters(); }); client-side mp.events.add('client:setCharactersList', () => { mp.events.add("browserDomReady", (browser) => { if (browser === characterSelectionBrowser) { mp.events.callRemote("server:getCharacterList"); } }); }); Frontend, an array that should get data from DB (commented code is the format of the received data.) // let characters = [ // { // ID: 1, // Acc_ID: 7, // Firstname: 'Test', // Lastname: 'Test', // Gender: 'male', // IsHasAppearance: false, // CreatedAt: '2025-07-06', // TimeInGame: 0, // LastLogin: null, // Armor: null, // Health: 100, // Money: 10000, // PhoneNumber: null, // FactionID: null, // IsCKed: false, // PreviousNames: null, // AjailTime: null, // JailTime: null, // }, //] let characters = []; Edited Saturday at 09:08 AM by streetmeat
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now