Use game namespace and new const
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
if(animType == VRR_ANIMTYPE_ADD) {
|
||||
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
|
||||
@@ -38,14 +38,14 @@ function setLocalPlayerWorkingState(tempWorking) {
|
||||
function showJobRouteStop() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Showing route stop`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
jobRouteStopSphere = gta.createPickup(1318, position, 1);
|
||||
if(game.game == VRR_GAME_GTA_SA) {
|
||||
jobRouteStopSphere = game.createPickup(1318, position, 1);
|
||||
} else {
|
||||
jobRouteStopSphere = gta.createSphere(position, 3);
|
||||
jobRouteStopSphere = game.createSphere(position, 3);
|
||||
jobRouteStopSphere.colour = colour;
|
||||
}
|
||||
|
||||
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
|
||||
jobRouteStopBlip = game.createBlip(position, 0, 2, colour);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ function showJobRouteStop() {
|
||||
function showJobRouteStop(position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Showing route stop`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
jobRouteStopSphere = gta.createPickup(1318, position, 1);
|
||||
if(game.game == VRR_GAME_GTA_SA) {
|
||||
jobRouteStopSphere = game.createPickup(1318, position, 1);
|
||||
} else {
|
||||
jobRouteStopSphere = gta.createSphere(position, 3);
|
||||
jobRouteStopSphere = game.createSphere(position, 3);
|
||||
jobRouteStopSphere.colour = colour;
|
||||
}
|
||||
|
||||
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
|
||||
jobRouteStopBlip = game.createBlip(position, 0, 2, colour);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,16 @@
|
||||
|
||||
function SetStandardControlsEnabled(bEnabled)
|
||||
{
|
||||
if (gta.standardControls === undefined)
|
||||
if(typeof gta == "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (game.standardControls === undefined)
|
||||
{
|
||||
console.warn("gta.standardControls not implemented");
|
||||
console.warn("game.standardControls not implemented");
|
||||
return;
|
||||
}
|
||||
gta.standardControls = bEnabled;
|
||||
game.standardControls = bEnabled;
|
||||
}
|
||||
|
||||
function GetCurrentPlayerIndex()
|
||||
@@ -63,7 +67,7 @@ function GetEntityType(Entity)
|
||||
function GetPlaceableMatrix(pPlaceable)
|
||||
{
|
||||
if (pPlaceable == GetCamera())
|
||||
return gta.cameraMatrix;
|
||||
return game.cameraMatrix;
|
||||
return pPlaceable.matrix;
|
||||
}
|
||||
|
||||
@@ -81,18 +85,18 @@ function GetMouseSpeed()
|
||||
{
|
||||
if (gui.cursorEnabled)
|
||||
return [0,0];
|
||||
let MouseSpeed = gta.getMouseSpeed();
|
||||
let MouseSpeed = game.getMouseSpeed();
|
||||
return [MouseSpeed.x,-MouseSpeed.y];
|
||||
}
|
||||
|
||||
function GetMouseSensitivity()
|
||||
{
|
||||
if (gta.getMouseSensitivity === undefined)
|
||||
if (game.getMouseSensitivity === undefined)
|
||||
{
|
||||
//console.error("gta.getMouseSensitivity not implemented");
|
||||
//console.error("game.getMouseSensitivity not implemented");
|
||||
return [0.0025,0.003];
|
||||
}
|
||||
let MouseSensitivity = gta.getMouseSensitivity();
|
||||
let MouseSensitivity = game.getMouseSensitivity();
|
||||
return [MouseSensitivity.x,MouseSensitivity.y];
|
||||
}
|
||||
|
||||
@@ -118,12 +122,12 @@ function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled)
|
||||
|
||||
function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera)
|
||||
{
|
||||
if (gta.processLineOfSight === undefined)
|
||||
if (game.processLineOfSight === undefined)
|
||||
{
|
||||
console.warn("gta.processLineOfSight not implemented");
|
||||
console.warn("game.processLineOfSight not implemented");
|
||||
return [null];
|
||||
}
|
||||
let Result = gta.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
|
||||
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
|
||||
if (Result == null)
|
||||
return [null];
|
||||
return [Result.position.x, Result.position.y ,Result.position.z, Result.normal.x, Result.normal.y ,Result.normal.z, Result.entity];
|
||||
@@ -133,13 +137,13 @@ function SetPlaceableMatrix(pPlaceable, mat)
|
||||
{
|
||||
if (pPlaceable == GetCamera())
|
||||
{
|
||||
gta.setCameraMatrix(mat);
|
||||
game.setCameraMatrix(mat);
|
||||
return;
|
||||
}
|
||||
pPlaceable.matrix = mat;
|
||||
}
|
||||
|
||||
const UpdateCamera = gta.updateCamera;
|
||||
const UpdateCamera = game.updateCamera;
|
||||
|
||||
let GetTickCount;
|
||||
{
|
||||
@@ -162,7 +166,7 @@ let GetTickCount;
|
||||
if (bFrames)
|
||||
return bGTA ? GTAFrameCount : FrameCount;
|
||||
else
|
||||
return bGTA ? gta.tickCount : sdl.ticks;
|
||||
return bGTA ? game.tickCount : sdl.ticks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +470,7 @@ function processReturnToRestRotation()
|
||||
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
|
||||
if (Speed < 0)
|
||||
TargetCameraRotZ2 += Math.PI;
|
||||
let TimeStep = gta.timeStep/50*60;
|
||||
let TimeStep = game.timeStep/50*60;
|
||||
cameraRotZ += getDifferenceBetweenAngles(cameraRotZ,TargetCameraRotZ2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
||||
cameraRotY += getDifferenceBetweenAngles(cameraRotY,TargetCameraRotY2)*applyMultiplierTimeStep(1/20,TimeStep)*Multiplier;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
|
||||
playerPaused[clientName] = paused;
|
||||
playerPing[clientName] = ping;
|
||||
|
||||
if(gta.game == GAME_GTA_IV) {
|
||||
if(game.game == VRR_GAME_GTA_IV) {
|
||||
let client = getPlayerFromParams(clientName);
|
||||
if(client != false) {
|
||||
if(client.player != null) {
|
||||
@@ -81,7 +81,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
// Health Bar
|
||||
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(gta.game == GAME_GTA_III) {
|
||||
if(game.game == VRR_GAME_GTA_III) {
|
||||
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
|
||||
if(skin == 109) {
|
||||
y -= 20;
|
||||
@@ -207,7 +207,7 @@ function getClientFromPlayer(player) {
|
||||
// ===========================================================================
|
||||
|
||||
function processNameTagRendering(event) {
|
||||
//if(gta.game >= GAME_GTA_IV) {
|
||||
//if(game.game >= GAME_GTA_IV) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
@@ -186,10 +186,10 @@ function setEnterPropertyKey(key) {
|
||||
function setGameScriptState(scriptName, state) {
|
||||
if(state == VRR_GAMESCRIPT_FORCE) {
|
||||
logToConsole(`[VRR.Server] Starting game script '${scriptName}'`);
|
||||
gta.startNewScript(scriptName);
|
||||
game.startNewScript(scriptName);
|
||||
} else if(state == VRR_GAMESCRIPT_DENY) {
|
||||
logToConsole(`[VRR.Server] Terminating game script '${scriptName}'`);
|
||||
gta.terminateScript(scriptName);
|
||||
game.terminateScript(scriptName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ function makePedStopAnimation(pedId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
function processSync(event, deltaTime) {
|
||||
if(localPlayer != null) {
|
||||
if(!doesGameHaveServerElements()) {
|
||||
if(!areServerElementsSupported()) {
|
||||
triggerNetworkEvent("vrr.player.position", localPlayer.position);
|
||||
triggerNetworkEvent("vrr.player.heading", localPlayer.heading);
|
||||
}
|
||||
|
||||
//if(gta.game == GAME_GTA_SA) {
|
||||
//if(game.game == VRR_GAME_GTA_SA) {
|
||||
// let lookAtPos = getLocalPlayerLookAtPosition();
|
||||
// triggerNetworkEvent("vrr.player.lookat", lookAtPos);
|
||||
// setEntityData(localPlayer, "vrr.headLook", lookAtPos);
|
||||
@@ -102,7 +102,7 @@ function syncVehicleProperties(vehicle) {
|
||||
// vehicle.setSuspensionHeight(suspensionHeight);
|
||||
//}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||
for(let i in upgrades) {
|
||||
@@ -113,12 +113,12 @@ function syncVehicleProperties(vehicle) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA || getGame() == GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||
let livery = getEntityData(vehicle, "vrr.livery");
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == GAME_GTA_IV) {
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle.livery = livery;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ function syncVehicleProperties(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
@@ -140,21 +140,21 @@ function syncCivilianProperties(civilian) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
@@ -220,7 +220,7 @@ function syncCivilianProperties(civilian) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
@@ -232,21 +232,21 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getGame() == GAME_GTA_SA) {
|
||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
@@ -268,7 +268,7 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
@@ -329,7 +329,7 @@ function syncPlayerProperties(player) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncObjectProperties(object) {
|
||||
if(getGame() == GAME_GTA_III || getGame() == GAME_GTA_VC) {
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||
let tempMatrix = object.matrix;
|
||||
|
||||
@@ -117,22 +117,22 @@ let weaponSlots = [
|
||||
];
|
||||
|
||||
function openAllGarages() {
|
||||
switch(gta.game) {
|
||||
case GAME_GTA_III:
|
||||
switch(game.game) {
|
||||
case VRR_GAME_GTA_III:
|
||||
for(let i=0;i<=26;i++) {
|
||||
openGarage(i);
|
||||
//gta.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAME_GTA_VC:
|
||||
case VRR_GAME_GTA_VC:
|
||||
for(let i=0;i<=32;i++) {
|
||||
openGarage(i);
|
||||
//gta.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAME_GTA_SA:
|
||||
case VRR_GAME_GTA_SA:
|
||||
for(let i=0;i<=44;i++) {
|
||||
openGarage(i);
|
||||
}
|
||||
@@ -146,22 +146,22 @@ function openAllGarages() {
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllGarages() {
|
||||
switch(gta.game) {
|
||||
case GAME_GTA_III:
|
||||
switch(game.game) {
|
||||
case VRR_GAME_GTA_III:
|
||||
for(let i=0;i<=26;i++) {
|
||||
closeGarage(i);
|
||||
//gta.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAME_GTA_VC:
|
||||
case VRR_GAME_GTA_VC:
|
||||
for(let i=0;i<=32;i++) {
|
||||
closeGarage(i);
|
||||
//gta.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAME_GTA_SA:
|
||||
case VRR_GAME_GTA_SA:
|
||||
for(let i=0;i<=44;i++) {
|
||||
closeGarage(i);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||
controlsEnabled = controlState;
|
||||
//localPlayer.invincible = true;
|
||||
//if(getGame() != GAME_GTA_IV) {
|
||||
//if(getGame() != VRR_GAME_GTA_IV) {
|
||||
// localPlayer.collisionsEnabled = controlState;
|
||||
// localPlayer.invincible = false;
|
||||
//}
|
||||
@@ -198,7 +198,7 @@ function fadeLocalCamera(state, time) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
gta.fadeCamera(state, time);
|
||||
game.fadeCamera(state, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ function removeLocalPlayerFromVehicle() {
|
||||
function restoreLocalCamera() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Camera restored`);
|
||||
if(isCustomCameraSupported()) {
|
||||
gta.restoreCamera(true);
|
||||
game.restoreCamera(true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -231,7 +231,7 @@ function clearLocalPlayerOwnedPeds() {
|
||||
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
||||
if(isCustomCameraSupported()) {
|
||||
gta.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
||||
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,9 +242,9 @@ function setCityAmbienceState(state, clearElements = false) {
|
||||
game.setTrafficEnabled(state);
|
||||
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
gta.setGenerateCarsAroundCamera(state);
|
||||
if(gta.game != GAME_GTA_SA) {
|
||||
gta.setCiviliansEnabled(state);
|
||||
game.setGenerateCarsAroundCamera(state);
|
||||
if(game.game != VRR_GAME_GTA_SA) {
|
||||
game.setCiviliansEnabled(state);
|
||||
}
|
||||
|
||||
if(clearElements) {
|
||||
@@ -336,7 +336,7 @@ function setLocalPlayerInterior(interior) {
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(!isGTAIV()) {
|
||||
localPlayer.interior = interior;
|
||||
gta.cameraInterior = interior;
|
||||
game.cameraInterior = interior;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ function isSnowEnabled() {
|
||||
function playPedSpeech(pedName, speechId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
gta.SET_CHAR_SAY(int, int);
|
||||
game.SET_CHAR_SAY(int, int);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,8 +404,8 @@ function setLocalPlayerDrunkEffect(amount, duration) {
|
||||
drunkEffectDurationTimer = setInterval(function() {
|
||||
drunkEffectAmount = drunkEffectAmount;
|
||||
if(drunkEffectAmount > 0) {
|
||||
//gta.SET_MOTION_BLUR(drunkEffectAmount);
|
||||
gta.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
|
||||
//game.SET_MOTION_BLUR(drunkEffectAmount);
|
||||
game.SET_PLAYER_DRUNKENNESS(drunkEffectAmount, duration);
|
||||
} else {
|
||||
clearInterval(drunkEffectDurationTimer);
|
||||
drunkEffectDurationTimer = null;
|
||||
@@ -558,25 +558,27 @@ function processLocalPlayerVehicleControlState() {
|
||||
function processLocalPlayerSphereEntryExitHandling() {
|
||||
let position = getLocalPlayerPosition();
|
||||
|
||||
getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
|
||||
if(getDistance(position, sphere.position) <= sphere.radius) {
|
||||
if(!inSphere) {
|
||||
inSphere = sphere;
|
||||
triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
|
||||
if(areMarkersSupported()) {
|
||||
getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
|
||||
if(getDistance(position, sphere.position) <= sphere.radius) {
|
||||
if(!inSphere) {
|
||||
inSphere = sphere;
|
||||
triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
|
||||
}
|
||||
} else {
|
||||
if(inSphere) {
|
||||
inSphere = false;
|
||||
triggerEvent("OnLocalPlayerExitSphere", null, sphere);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(inSphere) {
|
||||
inSphere = false;
|
||||
triggerEvent("OnLocalPlayerExitSphere", null, sphere);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processJobRouteSphere() {
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
if(game.game == VRR_GAME_GTA_SA) {
|
||||
let position = getLocalPlayerPosition();
|
||||
if(jobRouteStopSphere != null) {
|
||||
if(getDistance(position, jobRouteStopSphere.position) <= 2.0) {
|
||||
@@ -643,32 +645,11 @@ function getVehicleForNetworkEvent(vehicleArg) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPosInFrontOfPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
|
||||
let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
|
||||
let z = pos.z;
|
||||
|
||||
return toVector3(x, y, z);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getAllowedSkinIndexBySkinId(skinId) {
|
||||
for(let i in allowedSkins[getGame()]) {
|
||||
if(skinId == allowedSkins[getGame()][i][0]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setMinuteDuration(minuteDuration) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
||||
|
||||
if(isTimeSupported()) {
|
||||
gta.time.minuteDuration = minuteDuration;
|
||||
game.time.minuteDuration = minuteDuration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,4 +715,110 @@ function processNearbyPickups() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setUpInitialGame() {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 0);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 0);
|
||||
|
||||
game.REQUEST_ANIMATION("bikev");
|
||||
game.REQUEST_ANIMATION("bikeh");
|
||||
game.REQUEST_ANIMATION("biked");
|
||||
game.REQUEST_ANIMATION("knife");
|
||||
game.REQUEST_ANIMATION("python");
|
||||
game.REQUEST_ANIMATION("shotgun");
|
||||
game.REQUEST_ANIMATION("buddy");
|
||||
game.REQUEST_ANIMATION("tec");
|
||||
game.REQUEST_ANIMATION("uzi");
|
||||
game.REQUEST_ANIMATION("rifle");
|
||||
game.REQUEST_ANIMATION("m60");
|
||||
game.REQUEST_ANIMATION("sniper");
|
||||
game.REQUEST_ANIMATION("grenade");
|
||||
game.REQUEST_ANIMATION("flame");
|
||||
game.REQUEST_ANIMATION("medic");
|
||||
game.REQUEST_ANIMATION("sunbathe");
|
||||
//game.REQUEST_ANIMATION("playidles");
|
||||
game.REQUEST_ANIMATION("riot");
|
||||
game.REQUEST_ANIMATION("strip");
|
||||
game.REQUEST_ANIMATION("lance");
|
||||
game.REQUEST_ANIMATION("skate");
|
||||
|
||||
game.LOAD_ALL_MODELS_NOW();
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 1);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||
game.setGameStat(STAT_FAT, 0);
|
||||
game.setGameStat(STAT_ENERGY, 9999);
|
||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||
game.setGameStat(STAT_GAMBLING, 9999);
|
||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||
game.setGameStat(STAT_RESPECT, 0);
|
||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||
game.setGameStat(STAT_STAMINA, 9999);
|
||||
game.setGameStat(STAT_TOTAL_PROGRESS, 100);
|
||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
game.setGameStat(STAT_BODY_MUSCLE, 0);
|
||||
|
||||
game.setDefaultInteriors(false);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.loadAllObjectsNow();
|
||||
|
||||
natives.requestAnims("DANCING");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processGameSpecifics() {
|
||||
if(game.game != VRR_GAME_GTA_IV) {
|
||||
game.clearMessages();
|
||||
}
|
||||
|
||||
destroyAutoCreatedPickups();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user