Thanks guys, I will pay more attention next time, I managed to solve the problem in a simple way, after many hours.
I was saving the hair in the database, I called the event at the time I needed it and when the user enters the character he changes the hair according to the database.
mp.events.add("hairIde", function (player, idTest) {
connection.query("SELECT hairID FROM char_test WHERE user_login = ?", [player.socialClub], function (e, results) {
if (results.length > 0) {
Object.keys(results).forEach(function (key) {
let row = results[key];
idTeste = row.hairID;
player.setClothes(2, idTest, 0, 2);
});
} else {
console.log("nao funciona");
}
});
});
๐