Use switch statement for game setup

This commit is contained in:
Vortrex
2022-03-16 20:43:17 -05:00
parent 75614f2155
commit ab43d462b8

View File

@@ -25,23 +25,23 @@ function initClientScripts() {
// =========================================================================== // ===========================================================================
function setUpInitialGame() { function setUpInitialGame() {
if(getGame() == VRR_GAME_GTA_III) { switch(getGame()) {
case VRR_GAME_GTA_III:
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0); game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999); game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999); game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0); //game.SET_CAR_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
game.SET_PED_DENSITY_MULTIPLIER(3.0); //game.SET_PED_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
game.onMission = true; game.onMission = true; // Disables taxi/vigilante/etc and other start mission triggers
SetStandardControlsEnabled(true); SetStandardControlsEnabled(true); // Provided by mouse camera script (mousecam.js)
return true; break;
}
if(getGame() == VRR_GAME_GTA_VC) { case VRR_GAME_GTA_VC:
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0); game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999); game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999); game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0); //game.SET_CAR_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
game.SET_PED_DENSITY_MULTIPLIER(3.0); //game.SET_PED_DENSITY_MULTIPLIER(3.0); // No visual effect. Needs tweaking and testing.
game.REQUEST_ANIMATION("bikev"); game.REQUEST_ANIMATION("bikev");
game.REQUEST_ANIMATION("bikeh"); game.REQUEST_ANIMATION("bikeh");
@@ -66,12 +66,11 @@ function setUpInitialGame() {
game.REQUEST_ANIMATION("skate"); game.REQUEST_ANIMATION("skate");
game.LOAD_ALL_MODELS_NOW(); game.LOAD_ALL_MODELS_NOW();
game.onMission = true; game.onMission = true; // Disables taxi/vigilante/etc and other start mission triggers
SetStandardControlsEnabled(true); SetStandardControlsEnabled(true); // Provided by mouse camera script (mousecam.js)
return true; break;
}
if(getGame() == VRR_GAME_GTA_SA) { case VRR_GAME_GTA_SA:
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400); game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400); game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400); game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
@@ -97,12 +96,11 @@ function setUpInitialGame() {
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999); game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
game.setGameStat(STAT_BODY_MUSCLE, 9999); game.setGameStat(STAT_BODY_MUSCLE, 9999);
game.setDefaultInteriors(false); game.setDefaultInteriors(false); // Disables default yellow cone at doors for entering places in singleplayer
game.onMission = true; game.onMission = true; // Disables taxi/vigilante/etc and other start mission triggers
return true; break;
}
if(getGame() == VRR_GAME_GTA_IV) { case VRR_GAME_GTA_IV:
natives.allowEmergencyServices(false); natives.allowEmergencyServices(false);
natives.setCreateRandomCops(true); natives.setCreateRandomCops(true);
natives.setMaxWantedLevel(0); natives.setMaxWantedLevel(0);
@@ -115,7 +113,7 @@ function setUpInitialGame() {
natives.setSyncWeatherAndGameTime(false); natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true); natives.usePlayerColourInsteadOfTeamColour(true);
natives.disablePauseMenu(true); natives.disablePauseMenu(true);
natives.allowReactionAnims(localPlayer, false); //natives.allowReactionAnims(localPlayer, false);
natives.allowGameToPauseForStreaming(false); natives.allowGameToPauseForStreaming(false);
natives.allowStuntJumpsToTrigger(false); natives.allowStuntJumpsToTrigger(false);
natives.setPickupsFixCars(false); natives.setPickupsFixCars(false);
@@ -155,17 +153,21 @@ function setUpInitialGame() {
// Singleplayer Cellphone // Singleplayer Cellphone
natives.requestScript("spcellphone"); natives.requestScript("spcellphone");
natives.startNewScript("spcellphone", 0); natives.startNewScript("spcellphone", 0);
//natives.setMessagesWaiting(false); // Script "v-blockedscripts" blocks the mpcellphone scripts
natives.setMessagesWaiting(false); // Seems to have no effect
natives.setMobilePhoneRadioState(false);
// Animation libraries // Animation libraries
natives.requestAnims("DANCING"); natives.requestAnims("DANCING");
return true;
}
if(getGame() == VRR_GAME_MAFIA_ONE) { // Some last steps
natives.loadAllObjectsNow();
break;
case VRR_GAME_MAFIA_ONE:
game.mapEnabled = false; game.mapEnabled = false;
game.setTrafficEnabled(false); game.setTrafficEnabled(false);
return true; break;
} }
} }