Tons of fixes, change netevent prefix.
This commit is contained in:
@@ -151,7 +151,7 @@ function onElementStreamIn(event, element) {
|
||||
|
||||
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||
triggerNetworkEvent("ag.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
triggerNetworkEvent("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
if(inVehicleSeat) {
|
||||
parkedVehiclePosition = false;
|
||||
parkedVehicleHeading = false;
|
||||
@@ -162,7 +162,7 @@ function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||
|
||||
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
||||
triggerNetworkEvent("ag.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
triggerNetworkEvent("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
if(inVehicleSeat == 0) {
|
||||
if(inVehicle.owner != -1) {
|
||||
@@ -187,7 +187,7 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
|
||||
if(damagedEntity == localPlayer) {
|
||||
if(!weaponDamageEnabled[damagerEntity.name]) {
|
||||
event.preventDefault();
|
||||
triggerNetworkEvent("ag.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||
triggerNetworkEvent("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ function initGUI() {
|
||||
|
||||
let checkLogin = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
|
||||
triggerNetworkEvent("ag.checkLogin", login.passwordInput.lines[0]);
|
||||
triggerNetworkEvent("vrr.checkLogin", login.passwordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -880,7 +880,7 @@ let loginSuccess = function() {
|
||||
|
||||
let checkRegistration = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
|
||||
triggerNetworkEvent("ag.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
triggerNetworkEvent("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -897,7 +897,7 @@ let checkNewCharacter = function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
triggerNetworkEvent("ag.checkNewCharacter",
|
||||
triggerNetworkEvent("vrr.checkNewCharacter",
|
||||
newCharacter.firstNameInput.lines[0],
|
||||
newCharacter.lastNameInput.lines[0],
|
||||
);
|
||||
@@ -922,6 +922,14 @@ let newCharacterFailed = function(errorMessage) {
|
||||
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
newCharacter.firstNameInput.text = "";
|
||||
newCharacter.lastNameInput.text = "";
|
||||
|
||||
if(!newCharacter.window.shown) {
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
setHUDEnabled(false);
|
||||
newCharacter.window.shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -951,7 +959,7 @@ let twoFactorAuthSuccess = function() {
|
||||
|
||||
let checkTwoFactorAuth = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
|
||||
triggerNetworkEvent("ag.checkTwoFactorAuth", twoFactorAuth.codeInput.lines[0]);
|
||||
triggerNetworkEvent("vrr.checkTwoFactorAuth", twoFactorAuth.codeInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -997,7 +1005,7 @@ let closeAllWindows = function() {
|
||||
|
||||
let yesNoDialogAnswerNo = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
|
||||
triggerNetworkEvent("ag.promptAnswerNo");
|
||||
triggerNetworkEvent("vrr.promptAnswerNo");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
@@ -1005,7 +1013,7 @@ let yesNoDialogAnswerNo = function() {
|
||||
|
||||
let yesNoDialogAnswerYes = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
|
||||
triggerNetworkEvent("ag.promptAnswerYes");
|
||||
triggerNetworkEvent("vrr.promptAnswerYes");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
@@ -1100,21 +1108,21 @@ let showNewCharacter = function() {
|
||||
|
||||
let selectNextCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
|
||||
triggerNetworkEvent("ag.nextCharacter");
|
||||
triggerNetworkEvent("vrr.nextCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let selectPreviousCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
|
||||
triggerNetworkEvent("ag.previousCharacter");
|
||||
triggerNetworkEvent("vrr.previousCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let selectThisCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
|
||||
triggerNetworkEvent("ag.selectCharacter");
|
||||
triggerNetworkEvent("vrr.selectCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1133,70 +1141,70 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showLogin", function() {
|
||||
addNetworkHandler("vrr.showLogin", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show login window`);
|
||||
showLogin();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showRegistration", function() {
|
||||
addNetworkHandler("vrr.showRegistration", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show registration window`);
|
||||
showRegistration();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showNewCharacter", function() {
|
||||
addNetworkHandler("vrr.showNewCharacter", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show new character window`);
|
||||
showNewCharacter();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
addNetworkHandler("vrr.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show character selection window`);
|
||||
showCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
addNetworkHandler("vrr.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to update character selection window with new info`);
|
||||
switchCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showError", function(errorMessage, errorTitle) {
|
||||
addNetworkHandler("vrr.showError", function(errorMessage, errorTitle) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show error window`);
|
||||
showError(errorMessage, errorTitle);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showPrompt", function(promptMessage, promptTitle) {
|
||||
addNetworkHandler("vrr.showPrompt", function(promptMessage, promptTitle) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show prompt window`);
|
||||
showYesNo(promptMessage, promptTitle);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showInfo", function(infoMessage) {
|
||||
addNetworkHandler("vrr.showInfo", function(infoMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show info dialog`);
|
||||
showInfo(infoMessage);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.loginSuccess", function() {
|
||||
addNetworkHandler("vrr.loginSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful login from server`);
|
||||
loginSuccess();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.characterSelectSuccess", function() {
|
||||
addNetworkHandler("vrr.characterSelectSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful character selection from server`);
|
||||
characterSelectSuccess();
|
||||
setChatWindowEnabled(true);
|
||||
@@ -1204,35 +1212,35 @@ addNetworkHandler("ag.characterSelectSuccess", function() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.loginFailed", function(remainingAttempts) {
|
||||
addNetworkHandler("vrr.loginFailed", function(remainingAttempts) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed login from server`);
|
||||
loginFailed(remainingAttempts);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.registrationSuccess", function() {
|
||||
addNetworkHandler("vrr.registrationSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful registration from server`);
|
||||
registrationSuccess();
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.registrationFailed", function(errorMessage) {
|
||||
addNetworkHandler("vrr.registrationFailed", function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
|
||||
registrationFailed(errorMessage);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.newCharacterFailed", function(errorMessage) {
|
||||
addNetworkHandler("vrr.newCharacterFailed", function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
|
||||
newCharacterFailed(errorMessage);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.guiColour", function(red, green, blue) {
|
||||
addNetworkHandler("vrr.guiColour", function(red, green, blue) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Received new GUI colours from server`);
|
||||
primaryColour = [red, green, blue];
|
||||
focusedColour = [red+focusedColourOffset, green+focusedColourOffset, blue+focusedColourOffset];
|
||||
@@ -1240,10 +1248,10 @@ addNetworkHandler("ag.guiColour", function(red, green, blue) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.guiInit", function() {
|
||||
addNetworkHandler("vrr.guiInit", function() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing MexUI app`);
|
||||
initGUI();
|
||||
triggerNetworkEvent("ag.guiReady", true);
|
||||
triggerNetworkEvent("vrr.guiReady", true);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
@@ -103,7 +103,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
let bizInfoText = "";
|
||||
switch(bizLabelInfoType) {
|
||||
case VRR_BIZLABEL_INFO_ENTER:
|
||||
if(enterPropertyKey != null) {
|
||||
if(enterPropertyKey) {
|
||||
bizInfoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
|
||||
} else {
|
||||
bizInfoText = `Use /enter to enter here`;
|
||||
@@ -224,29 +224,29 @@ function processLabelRendering() {
|
||||
if(localPlayer != null) {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(pickups[i].getData("ag.label.type") != null) {
|
||||
if(pickups[i].getData("vrr.label.type") != null) {
|
||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||
let price = 0;
|
||||
let bizLabelInfoType = VRR_BIZLABEL_INFO_NONE;
|
||||
if(pickups[i].getData("ag.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("ag.label.price"));
|
||||
if(pickups[i].getData("vrr.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("ag.label.help") != null) {
|
||||
bizLabelInfoType = pickups[i].getData("ag.label.help");
|
||||
if(pickups[i].getData("vrr.label.help") != null) {
|
||||
bizLabelInfoType = pickups[i].getData("vrr.label.help");
|
||||
}
|
||||
|
||||
switch(pickups[i].getData("ag.label.type")) {
|
||||
switch(pickups[i].getData("vrr.label.type")) {
|
||||
case VRR_LABEL_BUSINESS:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), true, price, bizLabelInfoType);
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, bizLabelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), false, price, bizLabelInfoType);
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, bizLabelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.jobType"));
|
||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||
break;
|
||||
|
||||
case VRR_LABEL_EXIT:
|
||||
|
||||
@@ -41,6 +41,8 @@ let drunkEffectDurationTimer = null;
|
||||
let controlsEnabled = true;
|
||||
|
||||
let streamingRadio = null;
|
||||
let streamingRadioVolume = 50;
|
||||
let streamingRadioElement = false;
|
||||
|
||||
let enterPropertyKey = null;
|
||||
|
||||
|
||||
@@ -18,89 +18,93 @@ function initServerScript() {
|
||||
function addAllNetworkHandlers() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||
|
||||
addNetworkHandler("ag.smallGameMessage", showSmallGameMessage);
|
||||
addNetworkHandler("ag.working", setLocalPlayerWorkingState);
|
||||
addNetworkHandler("ag.jobType", setLocalPlayerJobType);
|
||||
addNetworkHandler("ag.passenger", enterVehicleAsPassenger);
|
||||
addNetworkHandler("vrr.smallGameMessage", showSmallGameMessage);
|
||||
addNetworkHandler("vrr.working", setLocalPlayerWorkingState);
|
||||
addNetworkHandler("vrr.jobType", setLocalPlayerJobType);
|
||||
addNetworkHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||
|
||||
addNetworkHandler("ag.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkHandler("ag.control", setLocalPlayerControlState);
|
||||
addNetworkHandler("ag.fadeCamera", fadeLocalCamera);
|
||||
addNetworkHandler("ag.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkHandler("ag.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkHandler("ag.restoreCamera", restoreLocalCamera);
|
||||
addNetworkHandler("ag.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkHandler("ag.logo", setServerLogoRenderState);
|
||||
addNetworkHandler("ag.ambience", setCityAmbienceState);
|
||||
addNetworkHandler("ag.runCode", runClientCode);
|
||||
addNetworkHandler("ag.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkHandler("ag.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkHandler("ag.position", setLocalPlayerPosition);
|
||||
addNetworkHandler("ag.heading", setLocalPlayerHeading);
|
||||
addNetworkHandler("ag.interior", setLocalPlayerInterior);
|
||||
addNetworkHandler("ag.minuteDuration", setMinuteDuration);
|
||||
addNetworkHandler("ag.showJobRouteStop", showJobRouteStop);
|
||||
addNetworkHandler("ag.snow", setSnowState);
|
||||
addNetworkHandler("ag.health", setLocalPlayerHealth);
|
||||
addNetworkHandler("ag.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkHandler("ag.skinSelect", toggleSkinSelect);
|
||||
addNetworkHandler("ag.hotbar", updatePlayerHotBar);
|
||||
addNetworkHandler("ag.pedSpeech", playPedSpeech);
|
||||
addNetworkHandler("ag.clearPedState", clearLocalPedState);
|
||||
addNetworkHandler("ag.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
addNetworkHandler("ag.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkHandler("ag.set2DRendering", setPlayer2DRendering);
|
||||
addNetworkHandler("ag.mouseCursor", setMouseCursorState);
|
||||
addNetworkHandler("ag.mouseCamera", setMouseCameraState);
|
||||
addNetworkHandler("ag.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkHandler("ag.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkHandler("ag.spawned", onServerSpawnedPlayer);
|
||||
addNetworkHandler("ag.money", setLocalPlayerCash);
|
||||
addNetworkHandler("vrr.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkHandler("vrr.control", setLocalPlayerControlState);
|
||||
addNetworkHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||
addNetworkHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkHandler("vrr.restoreCamera", restoreLocalCamera);
|
||||
addNetworkHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkHandler("vrr.logo", setServerLogoRenderState);
|
||||
addNetworkHandler("vrr.ambience", setCityAmbienceState);
|
||||
addNetworkHandler("vrr.runCode", runClientCode);
|
||||
addNetworkHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkHandler("vrr.position", setLocalPlayerPosition);
|
||||
addNetworkHandler("vrr.heading", setLocalPlayerHeading);
|
||||
addNetworkHandler("vrr.interior", setLocalPlayerInterior);
|
||||
addNetworkHandler("vrr.minuteDuration", setMinuteDuration);
|
||||
addNetworkHandler("vrr.showJobRouteStop", showJobRouteStop);
|
||||
addNetworkHandler("vrr.snow", setSnowState);
|
||||
addNetworkHandler("vrr.health", setLocalPlayerHealth);
|
||||
addNetworkHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkHandler("vrr.skinSelect", toggleSkinSelect);
|
||||
addNetworkHandler("vrr.hotbar", updatePlayerHotBar);
|
||||
addNetworkHandler("vrr.pedSpeech", playPedSpeech);
|
||||
addNetworkHandler("vrr.clearPedState", clearLocalPedState);
|
||||
addNetworkHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
addNetworkHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||
addNetworkHandler("vrr.mouseCursor", setMouseCursorState);
|
||||
addNetworkHandler("vrr.mouseCamera", setMouseCameraState);
|
||||
addNetworkHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||
addNetworkHandler("vrr.money", setLocalPlayerCash);
|
||||
|
||||
addNetworkHandler("ag.excludeGroundSnow", excludeModelFromGroundSnow);
|
||||
addNetworkHandler("ag.removeWorldObject", removeWorldObject);
|
||||
addNetworkHandler("vrr.excludeGroundSnow", excludeModelFromGroundSnow);
|
||||
addNetworkHandler("vrr.removeWorldObject", removeWorldObject);
|
||||
|
||||
addNetworkHandler("ag.delKeyBind", unBindAccountKey);
|
||||
addNetworkHandler("ag.addKeyBind", bindAccountKey);
|
||||
addNetworkHandler("vrr.delKeyBind", unBindAccountKey);
|
||||
addNetworkHandler("vrr.addKeyBind", bindAccountKey);
|
||||
|
||||
addNetworkHandler("ag.nametag", updatePlayerNameTag);
|
||||
addNetworkHandler("ag.ping", updatePlayerPing);
|
||||
addNetworkHandler("vrr.nametag", updatePlayerNameTag);
|
||||
addNetworkHandler("vrr.ping", updatePlayerPing);
|
||||
|
||||
addNetworkHandler("ag.m", receiveChatBoxMessageFromServer);
|
||||
addNetworkHandler("ag.chatScrollLines", setChatScrollLines);
|
||||
addNetworkHandler("vrr.m", receiveChatBoxMessageFromServer);
|
||||
addNetworkHandler("vrr.chatScrollLines", setChatScrollLines);
|
||||
|
||||
addNetworkHandler("ag.radioStream", playStreamingRadio);
|
||||
addNetworkHandler("ag.radioVolume", setStreamingRadioVolume);
|
||||
addNetworkHandler("vrr.radioStream", playStreamingRadio);
|
||||
addNetworkHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||
|
||||
addNetworkHandler("ag.veh.lights", toggleVehicleLights);
|
||||
addNetworkHandler("ag.veh.engine", toggleVehicleEngine);
|
||||
addNetworkHandler("vrr.veh.lights", toggleVehicleLights);
|
||||
addNetworkHandler("vrr.veh.engine", toggleVehicleEngine);
|
||||
|
||||
addNetworkHandler("ag.veh.sync", syncVehicleProperties);
|
||||
addNetworkHandler("ag.civ.sync", syncCivilianProperties);
|
||||
addNetworkHandler("ag.plr.sync", syncPlayerProperties);
|
||||
addNetworkHandler("ag.obj.sync", syncObjectProperties);
|
||||
addNetworkHandler("vrr.veh.sync", syncVehicleProperties);
|
||||
addNetworkHandler("vrr.civ.sync", syncCivilianProperties);
|
||||
addNetworkHandler("vrr.plr.sync", syncPlayerProperties);
|
||||
addNetworkHandler("vrr.obj.sync", syncObjectProperties);
|
||||
|
||||
addNetworkHandler("ag.veh.repair", repairVehicle);
|
||||
addNetworkHandler("vrr.veh.repair", repairVehicle);
|
||||
|
||||
addNetworkHandler("ag.pedAnim", makePedPlayAnimation);
|
||||
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||
|
||||
addNetworkHandler("vrr.hideAllGUI", hideAllGUI);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceReadySignalToServer() {
|
||||
triggerNetworkEvent("ag.clientReady");
|
||||
triggerNetworkEvent("vrr.clientReady");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStartedSignalToServer() {
|
||||
triggerNetworkEvent("ag.clientStarted");
|
||||
triggerNetworkEvent("vrr.clientStarted");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStoppedSignalToServer() {
|
||||
triggerNetworkEvent("ag.clientStopped");
|
||||
if(isConnected) {
|
||||
triggerNetworkEvent("vrr.clientStopped");
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -183,42 +187,55 @@ function onServerSpawnedPlayer(state) {
|
||||
gta.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
gta.setGameStat(STAT_BODY_MUSCLE, 0);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(false);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.requestAnims("DANCING");
|
||||
natives.loadAllObjectsNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerUsedKeyBind(key) {
|
||||
triggerNetworkEvent("ag.useKeyBind", key);
|
||||
triggerNetworkEvent("vrr.useKeyBind", key);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerArrivedAtJobRouteStop() {
|
||||
triggerNetworkEvent("ag.arrivedAtJobRouteStop");
|
||||
triggerNetworkEvent("vrr.arrivedAtJobRouteStop");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerItemActionDelayComplete() {
|
||||
triggerNetworkEvent("ag.itemActionDelayComplete");
|
||||
triggerNetworkEvent("vrr.itemActionDelayComplete");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerClientInfo() {
|
||||
triggerNetworkEvent("ag.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, gta.width, gta.height);
|
||||
triggerNetworkEvent("vrr.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, gta.width, gta.height);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerNewAFKStatus(state) {
|
||||
triggerNetworkEvent("ag.afk", state);
|
||||
triggerNetworkEvent("vrr.afk", state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playStreamingRadio(url, loop, volume) {
|
||||
function playStreamingRadio(url, loop, volume, element = false) {
|
||||
//gta.forceRadioChannel(-1);
|
||||
if(url == "") {
|
||||
if(streamingRadio != null) {
|
||||
@@ -231,6 +248,12 @@ function playStreamingRadio(url, loop, volume) {
|
||||
streamingRadio.stop();
|
||||
}
|
||||
|
||||
// if(element != -1) {
|
||||
// streamingRadioElement = getElementFromId(element);
|
||||
//}
|
||||
|
||||
streamingRadioVolume = volume;
|
||||
|
||||
streamingRadio = audio.createSoundFromURL(url, loop);
|
||||
streamingRadio.volume = volume/100;
|
||||
streamingRadio.play();
|
||||
@@ -240,6 +263,7 @@ function playStreamingRadio(url, loop, volume) {
|
||||
|
||||
function setStreamingRadioVolume(volume) {
|
||||
if(streamingRadio != null) {
|
||||
streamingRadioVolume = volume;
|
||||
streamingRadio.volume = volume/100;
|
||||
}
|
||||
}
|
||||
@@ -258,12 +282,24 @@ function setEnterPropertyKey(key) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed) {
|
||||
if(animType == VRR_ANIMTYPE_ADD) {
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
||||
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
||||
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
if(animType == VRR_ANIMTYPE_ADD) {
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
||||
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
||||
}
|
||||
} else {
|
||||
natives.requestAnims(animGroup);
|
||||
natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function hideAllGUI() {
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -79,9 +79,9 @@ function processSkinSelectKeyPress(keyCode) {
|
||||
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
|
||||
skinSelectMessageTextTop = allowedSkins[gta.game][skinSelectorIndex][1];
|
||||
} else if(keyCode == SDLK_RETURN) {
|
||||
triggerNetworkEvent("ag.skinSelected", skinSelectorIndex);
|
||||
triggerNetworkEvent("vrr.skinSelected", skinSelectorIndex);
|
||||
} else if(keyCode == SDLK_BACKSPACE) {
|
||||
triggerNetworkEvent("ag.skinSelected", -1);
|
||||
triggerNetworkEvent("vrr.skinSelected", -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ function processSkinSelectRendering() {
|
||||
|
||||
function toggleSkinSelect(state) {
|
||||
if(state) {
|
||||
skinSelectorIndex = allowedSkins[gta.game][0];
|
||||
skinSelectorIndex = 0;
|
||||
if(localPlayer.skin != allowedSkins[gta.game][skinSelectorIndex][0]) {
|
||||
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
|
||||
}
|
||||
|
||||
@@ -7,19 +7,34 @@
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processSync(event, deltaTime) {
|
||||
if(localPlayer != null) {
|
||||
if(gta.game == GAME_GTA_IV) {
|
||||
triggerNetworkEvent("ag.player.position", localPlayer.position);
|
||||
triggerNetworkEvent("ag.player.heading", localPlayer.heading);
|
||||
triggerNetworkEvent("vrr.player.position", localPlayer.position);
|
||||
triggerNetworkEvent("vrr.player.heading", localPlayer.heading);
|
||||
}
|
||||
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
let lookAtPos = getLocalPlayerLookAtPosition();
|
||||
triggerNetworkEvent("vrr.player.lookat", lookAtPos);
|
||||
setEntityData(localPlayer, "vrr.headLook", lookAtPos);
|
||||
let peds = getPeds();
|
||||
for(let i in peds) {
|
||||
if(doesEntityDataExist(peds[i], "vrr.headLook")) {
|
||||
peds[i].lookAt(getEntityData(peds[i], "vrr.headLook"), 99999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(localPlayer.health <= 0) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
triggerNetworkEvent("ag.playerDeath", localPlayer.position);
|
||||
triggerNetworkEvent("vrr.playerDeath", localPlayer.position);
|
||||
}
|
||||
|
||||
if(streamingRadioElement) {
|
||||
streamingRadio.position = getElementPosition(streamingRadioElement);
|
||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,40 +60,40 @@ function repairVehicle(syncId) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(doesEntityDataExist(vehicle, "ag.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "ag.lights");
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
vehicle.lights = lightStatus;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "ag.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "ag.panelStatus");
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||
for(let i in panelsStatus) {
|
||||
vehicle.setPanelStatus(i, panelsStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "ag.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "ag.wheelStatus");
|
||||
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
||||
for(let i in wheelsStatus) {
|
||||
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "ag.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "ag.lightStatus");
|
||||
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
||||
for(let i in lightStatus) {
|
||||
vehicle.setLightStatus(i, lightStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) {
|
||||
// let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight");
|
||||
//if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||
// let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||
// vehicle.setSuspensionHeight(suspensionHeight);
|
||||
//}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(vehicle, "ag.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "ag.upgrades");
|
||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||
for(let i in upgrades) {
|
||||
vehicle.addUpgrade(upgrades[i]);
|
||||
}
|
||||
@@ -86,8 +101,8 @@ function syncVehicleProperties(vehicle) {
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA || getGame() == GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(vehicle, "ag.livery")) {
|
||||
let livery = getEntityData(vehicle, "ag.livery");
|
||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||
let livery = getEntityData(vehicle, "vrr.livery");
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == GAME_GTA_IV) {
|
||||
@@ -103,8 +118,8 @@ function syncVehicleProperties(vehicle) {
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "ag.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "ag.scale");
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = civilian.position;
|
||||
@@ -115,78 +130,78 @@ function syncCivilianProperties(civilian) {
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "ag.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "ag.fightStyle");
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "ag.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "ag.walkStyle");
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "ag.bodyPropHair");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "ag.bodyPropHead");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "ag.bodyPropEyes");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "ag.bodyPropLeftHand");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "ag.bodyPropRightHand");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "ag.bodyPropLeftWrist");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "ag.bodyPropHip");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "ag.bodyPropLeftFoot");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "ag.bodyPropRightFoot");
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "ag.anim")) {
|
||||
let animData = getEntityData(vehicle, "ag.anim");
|
||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||
let animData = getEntityData(vehicle, "vrr.anim");
|
||||
civilian.addAnimation(animData[0], animData[1]);
|
||||
}
|
||||
}
|
||||
@@ -195,8 +210,8 @@ function syncCivilianProperties(civilian) {
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "ag.scale")) {
|
||||
let scaleFactor = getEntityData(player, "ag.scale");
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = player.position;
|
||||
@@ -207,94 +222,94 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "ag.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "ag.fightStyle");
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
player.fightStyle = fightStyle;
|
||||
}
|
||||
}
|
||||
|
||||
//if(getGame() == GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "ag.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "ag.walkStyle");
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "ag.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "ag.bodyPartHair");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "ag.bodyPartHead");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "ag.bodyPartUpper");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "ag.bodyPartLower");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "ag.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "ag.bodyPropHair");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "ag.bodyPropHead");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "ag.bodyPropEyes");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "ag.bodyPropLeftHand");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "ag.bodyPropRightHand");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "ag.bodyPropLeftWrist");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "ag.bodyPropHip");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "ag.bodyPropLeftFoot");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "ag.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "ag.bodyPropRightFoot");
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
@@ -304,8 +319,8 @@ function syncPlayerProperties(player) {
|
||||
|
||||
function syncObjectProperties(object) {
|
||||
if(getGame() == GAME_GTA_III) {
|
||||
if(doesEntityDataExist(object, "ag.scale")) {
|
||||
let scaleFactor = getEntityData(object, "ag.scale");
|
||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||
let tempMatrix = object.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = object.position;
|
||||
|
||||
@@ -228,14 +228,18 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setCityAmbienceState(state) {
|
||||
function setCityAmbienceState(state, clearElements = false) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||
gta.setTrafficEnabled(state);
|
||||
gta.setGenerateCarsAroundCamera(state);
|
||||
if(gta.game != GAME_GTA_SA) {
|
||||
gta.setCiviliansEnabled(state);
|
||||
}
|
||||
clearSelfOwnedPeds();
|
||||
|
||||
if(clearElements) {
|
||||
clearSelfOwnedPeds();
|
||||
clearSelfOwnedVehicles();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -245,10 +249,10 @@ function runClientCode(code, returnTo) {
|
||||
try {
|
||||
returnValue = eval("(" + code + ")");
|
||||
} catch(error) {
|
||||
triggerNetworkEvent("ag.runCodeFail", returnTo, code);
|
||||
triggerNetworkEvent("vrr.runCodeFail", returnTo, code);
|
||||
return false;
|
||||
}
|
||||
triggerNetworkEvent("ag.runCodeSuccess", returnTo, code, returnValue);
|
||||
triggerNetworkEvent("vrr.runCodeSuccess", returnTo, code, returnValue);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -394,9 +398,20 @@ function getLocalPlayerVehicleSeat() {
|
||||
function clearSelfOwnedPeds() {
|
||||
logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
|
||||
getElementsByType(ELEMENT_PED).forEach(function(ped) {
|
||||
if(ped.isOwner) {
|
||||
//if(ped.isOwner) {
|
||||
destroyElement(ped);
|
||||
}
|
||||
//}
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearSelfOwnedVehicles() {
|
||||
logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
|
||||
getElementsByType(ELEMENT_VEHICLE).forEach(function(vehicle) {
|
||||
//if(vehicle.isOwner) {
|
||||
destroyElement(vehicle);
|
||||
//}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -433,7 +448,7 @@ function setPlayerWeaponDamageEnabled(clientName, state) {
|
||||
|
||||
function setLocalPlayerCash(amount) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
|
||||
localPlayer.money = amount;
|
||||
localPlayer.money = toInteger(amount);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -634,4 +649,17 @@ function setMinuteDuration(minuteDuration) {
|
||||
gta.time.minuteDuration = minuteDuration;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ===========================================================================
|
||||
|
||||
function getStreamingRadioVolumeForPosition(position) {
|
||||
return streamingRadioVolume;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocalPlayerLookAtPosition() {
|
||||
if(localPlayer != null) {
|
||||
let centerCameraPos = getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, 0));
|
||||
return getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user