Load and check model before setting skin (IV)

This commit is contained in:
Vortrex
2022-08-10 14:14:47 -05:00
parent 8320acb9ec
commit efbcc8b1f9

View File

@@ -341,7 +341,13 @@ function setLocalPlayerInfiniteRun(state) {
function setLocalPlayerSkin(skinId) {
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
if (getGame() == AGRP_GAME_GTA_IV) {
natives.changePlayerModel(natives.getPlayerId(), skinId);
if (natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
if (natives.hasModelLoaded(skinId)) {
natives.changePlayerModel(natives.getPlayerId(), skinId);
}
}
} else {
localPlayer.skin = skinId;
}