Change netevent and const prefix

This commit is contained in:
Vortrex
2022-06-30 18:29:17 -05:00
parent 2f7f3a1b00
commit cb86419f2b
20 changed files with 485 additions and 485 deletions

View File

@@ -73,7 +73,7 @@ function initGUI() {
resetGUIStrings();
resetLocaleChooserOptions();
sendNetworkEventToServer("vrr.guiReady", true);
sendNetworkEventToServer("agrp.guiReady", true);
};
// ===========================================================================
@@ -230,7 +230,7 @@ function processGUIKeyPress(keyCode) {
function processToggleGUIKeyPress(keyCode) {
if (keyCode == disableGUIKey) {
sendNetworkEventToServer("vrr.toggleGUI");
sendNetworkEventToServer("agrp.toggleGUI");
}
}

View File

@@ -21,7 +21,7 @@ let twoFactorAuth = {
function initTwoFactorAuthenticationGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating two factor auth GUI ...`);
twoFactorAuth.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -38,7 +38,7 @@ function initTwoFactorAuthenticationGUI() {
borderColour: toColour(0, 0, 0, 0),
},
});
twoFactorAuth.window.titleBarIconSize = toVector2(0,0);
twoFactorAuth.window.titleBarIconSize = toVector2(0, 0);
twoFactorAuth.window.titleBarHeight = 0;
twoFactorAuth.qrCode = twoFactorAuth.window.image(100, 20, 100, 100, mainLogoPath, {
@@ -129,7 +129,7 @@ function twoFactorAuthSuccess() {
function checkTwoFactorAuth() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
sendNetworkEventToServer("vrr.2fa", twoFactorAuth.codeInput.lines[0]);
sendNetworkEventToServer("agrp.2fa", twoFactorAuth.codeInput.lines[0]);
}
// ===========================================================================

View File

@@ -128,7 +128,7 @@ function passwordChangeFailed(errorMessage) {
function checkChangePassword() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password change with server ...`);
sendNetworkEventToServer("vrr.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
sendNetworkEventToServer("agrp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
}
// ===========================================================================

View File

@@ -23,23 +23,23 @@ let characterSelect = {
// ===========================================================================
function initCharacterSelectGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 190, 'SELECT CHARACTER', {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating character select GUI ...`);
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
},
title: {
title: {
textSize: 12.0,
textFont: mainFont,
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
},
icon: {
textSize: 10.0,
textFont: mainFont,
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
textColour: toColour(0, 0, 0, 255),
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
characterSelect.window.titleBarIconSize = toVector2(0, 0);
characterSelect.window.titleBarIconShown = false;
@@ -171,7 +171,7 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
guiLeftKey = selectPreviousCharacter;
guiRightKey = selectNextCharacter;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), characterSelect.window.position.y+characterSelect.window.size.y+20));
showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), characterSelect.window.position.y + characterSelect.window.size.y + 20));
}
// ===========================================================================
@@ -186,21 +186,21 @@ function showNewCharacter() {
function selectNextCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
sendNetworkEventToServer("vrr.nextCharacter");
sendNetworkEventToServer("agrp.nextCharacter");
}
// ===========================================================================
function selectPreviousCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
sendNetworkEventToServer("vrr.previousCharacter");
sendNetworkEventToServer("agrp.previousCharacter");
}
// ===========================================================================
function selectThisCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
sendNetworkEventToServer("vrr.selectCharacter");
sendNetworkEventToServer("agrp.selectCharacter");
}
// ===========================================================================
@@ -214,7 +214,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
characterSelect.clanText.text = `Clan: ${clan}`;
characterSelect.lastPlayedText.text = `Last Played: ${lastPlayed}`;
if(characterSelect.skinImage != null) {
if (characterSelect.skinImage != null) {
characterSelect.skinImage.remove();
}
characterSelect.skinImage = (getGame() == VRR_GAME_GTA_III) ? characterSelect.window.image(310, 32, 100, 90, `files/images/skins/gta3/${getSkinImage(skinId)}.png`) : characterSelect.window.image(310, 32, 100, 90, "files/images/skins/none.png");
@@ -236,11 +236,11 @@ function characterSelectSuccess() {
// ===========================================================================
function getSkinImage(skinId, gameId = getGame()) {
if(skinId < 10) {
if (skinId < 10) {
return `Skin_00${skinId}.png`;
} else if(skinId > 10 && skinId < 100) {
} else if (skinId > 10 && skinId < 100) {
return `Skin_0${skinId}.png`;
} else if(skinId > 100) {
} else if (skinId > 100) {
return `Skin_${skinId}.png`;
}
}

View File

@@ -20,7 +20,7 @@ let login = {
// ===========================================================================
let loginHTML =
`<html>
`<html>
<head>
<title>Asshat Gaming Roleplay: Login</title>
<style type="text/css" rel="stylesheet">
@@ -42,8 +42,8 @@ let loginHTML =
// ===========================================================================
function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
login.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-135, 300, 275, 'LOGIN', {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -60,7 +60,7 @@ function initLoginGUI() {
borderColour: toColour(0, 0, 0, 0),
},
});
login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarIconSize = toVector2(0, 0);
login.window.titleBarHeight = 0;
login.window.titleBarShown = false;
@@ -157,7 +157,7 @@ function showLoginGUI() {
mexui.focusedControl = login.passwordInput;
guiSubmitKey = checkLogin;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), login.window.position.y+login.window.size.y+20));
showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), login.window.position.y + login.window.size.y + 20));
//showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500);
}
@@ -165,7 +165,7 @@ function showLoginGUI() {
function checkLogin() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
sendNetworkEventToServer("vrr.checkLogin", login.passwordInput.lines[0]);
sendNetworkEventToServer("agrp.checkLogin", login.passwordInput.lines[0]);
}
// ===========================================================================
@@ -191,7 +191,7 @@ function switchToPasswordResetGUI() {
//closeAllWindows();
//logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
//showResetPasswordGUI();
sendNetworkEventToServer("vrr.checkResetPassword", "");
sendNetworkEventToServer("agrp.checkResetPassword", "");
return false;
}

View File

@@ -20,7 +20,7 @@ let newCharacter = {
function initNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
newCharacter.window = mexui.window(getScreenWidth()/2-130, getScreenHeight()/2-115, 300, 230, 'NEW CHARACTER', {
newCharacter.window = mexui.window(getScreenWidth() / 2 - 130, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -122,7 +122,7 @@ function newCharacterFailed(errorMessage) {
newCharacter.firstNameInput.text = "";
newCharacter.lastNameInput.text = "";
if(!newCharacter.window.shown) {
if (!newCharacter.window.shown) {
closeAllWindows();
setChatWindowEnabled(false);
mexui.setInput(true);
@@ -135,15 +135,15 @@ function newCharacterFailed(errorMessage) {
function checkNewCharacter() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking new character with server ...`);
if(newCharacter.firstNameInput.lines[0].length < 2) {
if (newCharacter.firstNameInput.lines[0].length < 2) {
return false;
}
if(newCharacter.lastNameInput.lines[0].length < 2) {
if (newCharacter.lastNameInput.lines[0].length < 2) {
return false;
}
sendNetworkEventToServer("vrr.checkNewCharacter",
sendNetworkEventToServer("agrp.checkNewCharacter",
newCharacter.firstNameInput.lines[0],
newCharacter.lastNameInput.lines[0],
);
@@ -160,7 +160,7 @@ function showNewCharacterGUI() {
mexui.focusedInput = newCharacter.firstNameInput;
guiSubmitKey = checkNewCharacter;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), newCharacter.window.position.y+newCharacter.window.size.y+20));
showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), newCharacter.window.position.y + newCharacter.window.size.y + 20));
}
// ===========================================================================

View File

@@ -20,8 +20,8 @@ let register = {
// ===========================================================================
function initRegisterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
register.window = mexui.window(getScreenWidth()/2-150, getScreenHeight()/2-150, 300, 300, 'Register', {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating register GUI ...`);
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -37,7 +37,7 @@ function initRegisterGUI() {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
}
});
register.window.titleBarIconSize = toVector2(0,0);
register.window.titleBarIconSize = toVector2(0, 0);
register.window.titleBarHeight = 0;
register.window.titleBarShown = false;
@@ -148,7 +148,7 @@ function registrationFailed(errorMessage) {
function checkRegistration() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
sendNetworkEventToServer("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
sendNetworkEventToServer("agrp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
}
// ===========================================================================
@@ -162,7 +162,7 @@ function showRegistrationGUI() {
mexui.focusedControl = register.passwordInput;
guiSubmitKey = checkRegistration;
showLocaleChooserGUI(new Vec2(getScreenWidth()/2-(localeChooser.window.size.x/2), register.window.position.y+register.window.size.y+20));
showLocaleChooserGUI(new Vec2(getScreenWidth() / 2 - (localeChooser.window.size.x / 2), register.window.position.y + register.window.size.y + 20));
//showSmallGameMessage(`If you don't have a mouse cursor, press ${toUpperCase(getKeyNameFromId(disableGUIKey))} to disable GUI`, COLOUR_WHITE, 7500);
}

View File

@@ -142,7 +142,7 @@ function showResetPasswordGUI() {
function checkResetPassword() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
sendNetworkEventToServer("vrr.checkResetPassword", passwordReset.emailInput.lines[0]);
sendNetworkEventToServer("agrp.checkResetPassword", passwordReset.emailInput.lines[0]);
}
// ===========================================================================

View File

@@ -9,17 +9,17 @@
let yesNoDialog = {
window: null,
messageLabel: null,
yesButton: null,
noButton: null,
window: null,
messageLabel: null,
yesButton: null,
noButton: null,
};
// ===========================================================================
function initYesNoDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
yesNoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Question', {
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -79,37 +79,37 @@ function initYesNoDialogGUI() {
// ===========================================================================
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
mexui.setInput(true);
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
mexui.setInput(true);
yesNoDialog.messageLabel.text = "";
yesNoDialog.yesButton.text = "";
yesNoDialog.noButton.text = "";
yesNoDialog.window.title = "";
yesNoDialog.messageLabel.text = "";
yesNoDialog.yesButton.text = "";
yesNoDialog.noButton.text = "";
yesNoDialog.window.title = "";
yesNoDialog.messageLabel.text = promptMessage;
yesNoDialog.yesButton.text = yesButtonText;
yesNoDialog.noButton.text = noButtonText;
yesNoDialog.window.title = promptTitle;
yesNoDialog.messageLabel.text = promptMessage;
yesNoDialog.yesButton.text = yesButtonText;
yesNoDialog.noButton.text = noButtonText;
yesNoDialog.window.title = promptTitle;
yesNoDialog.window.shown = true;
yesNoDialog.window.shown = true;
}
// ===========================================================================
function yesNoDialogAnswerNo() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
sendNetworkEventToServer("vrr.promptAnswerNo");
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
sendNetworkEventToServer("agrp.promptAnswerNo");
closeAllWindows();
}
// ===========================================================================
function yesNoDialogAnswerYes() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
sendNetworkEventToServer("vrr.promptAnswerYes");
closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
sendNetworkEventToServer("agrp.promptAnswerYes");
closeAllWindows();
}
// ===========================================================================

View File

@@ -230,39 +230,39 @@ function repairVehicle(syncId) {
// ===========================================================================
function syncVehicleProperties(vehicle) {
if (doesEntityDataExist(vehicle, "vrr.lights")) {
let lightStatus = getEntityData(vehicle, "vrr.lights");
if (doesEntityDataExist(vehicle, "agrp.lights")) {
let lightStatus = getEntityData(vehicle, "agrp.lights");
vehicle.lights = lightStatus;
}
if (doesEntityDataExist(vehicle, "vrr.invincible")) {
let invincible = getEntityData(vehicle, "vrr.invincible");
if (doesEntityDataExist(vehicle, "agrp.invincible")) {
let invincible = getEntityData(vehicle, "agrp.invincible");
element.setProofs(invincible, invincible, invincible, invincible, invincible);
}
if (doesEntityDataExist(vehicle, "vrr.panelStatus")) {
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
if (doesEntityDataExist(vehicle, "agrp.panelStatus")) {
let panelsStatus = getEntityData(vehicle, "agrp.panelStatus");
for (let i in panelsStatus) {
vehicle.setPanelStatus(i, panelsStatus[i]);
}
}
if (doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
if (doesEntityDataExist(vehicle, "agrp.wheelStatus")) {
let wheelsStatus = getEntityData(vehicle, "agrp.wheelStatus");
for (let i in wheelsStatus) {
vehicle.setWheelStatus(i, wheelsStatus[i]);
}
}
if (doesEntityDataExist(vehicle, "vrr.lightStatus")) {
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
if (doesEntityDataExist(vehicle, "agrp.lightStatus")) {
let lightStatus = getEntityData(vehicle, "agrp.lightStatus");
for (let i in lightStatus) {
vehicle.setLightStatus(i, lightStatus[i]);
}
}
if (doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
if (doesEntityDataExist(vehicle, "agrp.suspensionHeight")) {
let suspensionHeight = getEntityData(vehicle, "agrp.suspensionHeight");
vehicle.setSuspensionHeight(suspensionHeight);
}
@@ -272,8 +272,8 @@ function syncVehicleProperties(vehicle) {
vehicle.removeUpgrade(i);
}
if (doesEntityDataExist(vehicle, "vrr.upgrades")) {
let upgrades = getEntityData(vehicle, "vrr.upgrades");
if (doesEntityDataExist(vehicle, "agrp.upgrades")) {
let upgrades = getEntityData(vehicle, "agrp.upgrades");
for (let i in upgrades) {
if (upgrades[i] != 0) {
vehicle.addUpgrade(upgrades[i]);
@@ -283,8 +283,8 @@ function syncVehicleProperties(vehicle) {
}
if (getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
if (doesEntityDataExist(vehicle, "vrr.livery")) {
let livery = getEntityData(vehicle, "vrr.livery");
if (doesEntityDataExist(vehicle, "agrp.livery")) {
let livery = getEntityData(vehicle, "agrp.livery");
if (getGame() == VRR_GAME_GTA_SA) {
vehicle.setPaintJob(livery);
} else if (getGame() == VRR_GAME_GTA_IV) {
@@ -316,8 +316,8 @@ function doesEntityDataExist(entity, dataName) {
function syncCivilianProperties(civilian) {
if (getGame() == VRR_GAME_GTA_III) {
if (doesEntityDataExist(civilian, "vrr.scale")) {
let scaleFactor = getEntityData(civilian, "vrr.scale");
if (doesEntityDataExist(civilian, "agrp.scale")) {
let scaleFactor = getEntityData(civilian, "agrp.scale");
let tempMatrix = civilian.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = civilian.position;
@@ -328,78 +328,78 @@ function syncCivilianProperties(civilian) {
}
if (getGame() == VRR_GAME_GTA_SA) {
if (doesEntityDataExist(civilian, "vrr.fightStyle")) {
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
if (doesEntityDataExist(civilian, "agrp.fightStyle")) {
let fightStyle = getEntityData(civilian, "agrp.fightStyle");
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
}
}
if (getGame() == VRR_GAME_GTA_III) {
if (doesEntityDataExist(civilian, "vrr.walkStyle")) {
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
if (doesEntityDataExist(civilian, "agrp.walkStyle")) {
let walkStyle = getEntityData(civilian, "agrp.walkStyle");
civilian.walkStyle = walkStyle;
}
}
if (getGame() == VRR_GAME_GTA_IV) {
if (doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
if (doesEntityDataExist(civilian, "agrp.bodyPropHair")) {
let bodyPropHair = getEntityData(civilian, "agrp.bodyPropHair");
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
if (doesEntityDataExist(civilian, "agrp.bodyPropHead")) {
let bodyPropHead = getEntityData(civilian, "agrp.bodyPropHead");
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
if (doesEntityDataExist(civilian, "agrp.bodyPropEyes")) {
let bodyPropEyes = getEntityData(civilian, "agrp.bodyPropEyes");
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(civilian, "agrp.bodyPropLeftHand");
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
if (doesEntityDataExist(civilian, "agrp.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(civilian, "agrp.bodyPropRightHand");
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(civilian, "agrp.bodyPropLeftWrist");
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
if (doesEntityDataExist(civilian, "agrp.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "agrp.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
if (doesEntityDataExist(civilian, "agrp.bodyPropHip")) {
let bodyPropHip = getEntityData(civilian, "agrp.bodyPropHip");
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
if (doesEntityDataExist(civilian, "agrp.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(civilian, "agrp.bodyPropLeftFoot");
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if (doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
if (doesEntityDataExist(civilian, "agrp.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(civilian, "agrp.bodyPropRightFoot");
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
}
if (doesEntityDataExist(civilian, "vrr.anim")) {
let animData = getEntityData(vehicle, "vrr.anim");
if (doesEntityDataExist(civilian, "agrp.anim")) {
let animData = getEntityData(vehicle, "agrp.anim");
civilian.addAnimation(animData[0], animData[1]);
}
}
@@ -414,8 +414,8 @@ function preventDefaultEventAction(event) {
function syncPlayerProperties(player) {
if (getGame() == VRR_GAME_GTA_III) {
if (doesEntityDataExist(player, "vrr.scale")) {
let scaleFactor = getEntityData(player, "vrr.scale");
if (doesEntityDataExist(player, "agrp.scale")) {
let scaleFactor = getEntityData(player, "agrp.scale");
let tempMatrix = player.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = player.position;
@@ -426,94 +426,94 @@ function syncPlayerProperties(player) {
}
if (getGame() == VRR_GAME_GTA_SA) {
if (doesEntityDataExist(player, "vrr.fightStyle")) {
let fightStyle = getEntityData(player, "vrr.fightStyle");
if (doesEntityDataExist(player, "agrp.fightStyle")) {
let fightStyle = getEntityData(player, "agrp.fightStyle");
player.setFightStyle(fightStyle[0], fightStyle[1]);
}
}
//if(getGame() == VRR_GAME_GTA_SA) {
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
// let walkStyle = getEntityData(player, "vrr.walkStyle");
// if(doesEntityDataExist(player, "agrp.walkStyle")) {
// let walkStyle = getEntityData(player, "agrp.walkStyle");
// player.walkStyle = walkStyle;
// }
//}
if (getGame() == VRR_GAME_GTA_IV) {
if (doesEntityDataExist(player, "vrr.bodyPartHair")) {
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
if (doesEntityDataExist(player, "agrp.bodyPartHair")) {
let bodyPartHead = getEntityData(player, "agrp.bodyPartHair");
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPartHead")) {
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
if (doesEntityDataExist(player, "agrp.bodyPartHead")) {
let bodyPartHead = getEntityData(player, "agrp.bodyPartHead");
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPartUpper")) {
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
if (doesEntityDataExist(player, "agrp.bodyPartUpper")) {
let bodyPartUpper = getEntityData(player, "agrp.bodyPartUpper");
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPartLower")) {
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
if (doesEntityDataExist(player, "agrp.bodyPartLower")) {
let bodyPartLower = getEntityData(player, "agrp.bodyPartLower");
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
}
}
if (getGame() == VRR_GAME_GTA_IV) {
if (doesEntityDataExist(player, "vrr.bodyPropHair")) {
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
if (doesEntityDataExist(player, "agrp.bodyPropHair")) {
let bodyPropHair = getEntityData(player, "agrp.bodyPropHair");
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropHead")) {
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
if (doesEntityDataExist(player, "agrp.bodyPropHead")) {
let bodyPropHead = getEntityData(player, "agrp.bodyPropHead");
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropEyes")) {
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
if (doesEntityDataExist(player, "agrp.bodyPropEyes")) {
let bodyPropEyes = getEntityData(player, "agrp.bodyPropEyes");
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
if (doesEntityDataExist(player, "agrp.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(player, "agrp.bodyPropLeftHand");
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
if (doesEntityDataExist(player, "agrp.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(player, "agrp.bodyPropRightHand");
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
if (doesEntityDataExist(player, "agrp.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(player, "agrp.bodyPropLeftWrist");
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
if (doesEntityDataExist(player, "agrp.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "agrp.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropHip")) {
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
if (doesEntityDataExist(player, "agrp.bodyPropHip")) {
let bodyPropHip = getEntityData(player, "agrp.bodyPropHip");
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
if (doesEntityDataExist(player, "agrp.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(player, "agrp.bodyPropLeftFoot");
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if (doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
if (doesEntityDataExist(player, "agrp.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(player, "agrp.bodyPropRightFoot");
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
}
@@ -523,8 +523,8 @@ function syncPlayerProperties(player) {
function syncObjectProperties(object) {
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
if (doesEntityDataExist(object, "vrr.scale")) {
let scaleFactor = getEntityData(object, "vrr.scale");
if (doesEntityDataExist(object, "agrp.scale")) {
let scaleFactor = getEntityData(object, "agrp.scale");
let tempMatrix = object.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = object.position;
@@ -574,9 +574,9 @@ function getPlayerId(client) {
// ===========================================================================
function syncElementProperties(element) {
if (doesEntityDataExist(element, "vrr.interior")) {
if (doesEntityDataExist(element, "agrp.interior")) {
if (typeof element.interior != "undefined") {
element.interior = getEntityData(element, "vrr.interior");
element.interior = getEntityData(element, "agrp.interior");
}
}

View File

@@ -44,53 +44,53 @@ function loadSkinSelectMessageFontBottom() {
// ===========================================================================
function processSkinSelectKeyPress(keyCode) {
if(usingSkinSelector) {
if(keyCode == SDLK_PAGEUP) {
if(skinSelectorIndex >= allowedSkins.length-1) {
if (usingSkinSelector) {
if (keyCode == SDLK_PAGEUP) {
if (skinSelectorIndex >= allowedSkins.length - 1) {
skinSelectorIndex = 1;
} else {
skinSelectorIndex = skinSelectorIndex + 1;
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
if (getGame() == VRR_GAME_GTA_IV) {
let skinId = allowedSkins[skinSelectorIndex][0];
if(natives.isModelInCdimage(skinId)) {
if (natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
if(natives.hasModelLoaded(skinId)) {
if (natives.hasModelLoaded(skinId)) {
natives.changePlayerModel(natives.getPlayerId(), skinId);
}
}
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_PAGEDOWN) {
if(skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins.length-1;
} else if (keyCode == SDLK_PAGEDOWN) {
if (skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins.length - 1;
} else {
skinSelectorIndex = skinSelectorIndex - 1;
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) {
if (getGame() == VRR_GAME_GTA_IV) {
let skinId = allowedSkins[skinSelectorIndex][0];
if(natives.isModelInCdimage(skinId)) {
if (natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
if(natives.hasModelLoaded(skinId)) {
if (natives.hasModelLoaded(skinId)) {
natives.changePlayerModel(natives.getPlayerId(), skinId);
}
}
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_RETURN) {
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
} else if (keyCode == SDLK_RETURN) {
sendNetworkEventToServer("agrp.skinSelected", skinSelectorIndex);
toggleSkinSelect(false);
return true;
} else if(keyCode == SDLK_BACKSPACE) {
sendNetworkEventToServer("vrr.skinSelected", -1);
} else if (keyCode == SDLK_BACKSPACE) {
sendNetworkEventToServer("agrp.skinSelected", -1);
toggleSkinSelect(false);
return true;
}
@@ -101,11 +101,11 @@ function processSkinSelectKeyPress(keyCode) {
// ===========================================================================
function processSkinSelectRendering() {
if(usingSkinSelector) {
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
if (usingSkinSelector) {
if (skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
if (skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height - 100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height - 65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
}
}
}
@@ -114,9 +114,9 @@ function processSkinSelectRendering() {
// ===========================================================================
function toggleSkinSelect(state) {
if(state) {
if (state) {
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
if(!skinSelectorIndex) {
if (!skinSelectorIndex) {
skinSelectorIndex = 0;
}
@@ -124,19 +124,19 @@ function toggleSkinSelect(state) {
skinSelectPosition = localPlayer.position;
skinSelectHeading = localPlayer.heading;
if(isCustomCameraSupported()) {
if (isCustomCameraSupported()) {
let tempPosition = localPlayer.position;
tempPosition.z += 0.5;
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
}
if(getGame() == VRR_GAME_GTA_IV) {
if (getGame() == VRR_GAME_GTA_IV) {
let skinId = allowedSkins[skinSelectorIndex][0];
if(natives.isModelInCdimage(skinId)) {
if (natives.isModelInCdimage(skinId)) {
natives.requestModel(skinId);
natives.loadAllObjectsNow();
if(natives.hasModelLoaded(skinId)) {
if (natives.hasModelLoaded(skinId)) {
natives.changePlayerModel(natives.getPlayerId(), skinId);
}
}

View File

@@ -1391,7 +1391,7 @@ function initClient(client) {
return false;
}
setEntityData(client, "vrr.isInitialized", true, false);
setEntityData(client, "agrp.isInitialized", true, false);
sendPlayerGUIColours(client);

View File

@@ -97,7 +97,7 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
getPlayerData(client).animationForced = false;
makePedPlayAnimation(getPlayerPed(client), animationSlot, offsetPosition);
setEntityData(getPlayerPed(client), "vrr.anim", animationSlot, true);
setEntityData(getPlayerPed(client), "agrp.anim", animationSlot, true);
//if(getAnimationData(animationSlot)[9] != VRR_ANIMMOVE_NONE) {
// if(getGame() < VRR_GAME_GTA_SA) {
// setPlayerMouseCameraState(client, true);

View File

@@ -271,7 +271,7 @@ async function onPlayerEnteredVehicle(client, vehicle, seat) {
return false;
}
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
getPlayerData(client).lastVehicle = vehicle;
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
@@ -385,7 +385,7 @@ function onPlayerExitedVehicle(client, vehicle) {
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("agrp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
}
// ===========================================================================
@@ -518,7 +518,7 @@ async function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
setEntityData(getPlayerPed(client), "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
setEntityData(getPlayerPed(client), "agrp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
@@ -574,7 +574,7 @@ async function onPlayerSpawn(client) {
if (areServerElementsSupported() && getGame() == VRR_GAME_GTA_SA) {
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
setEntityData(getPlayerPed(client), "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
setEntityData(getPlayerPed(client), "agrp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
}
@@ -600,20 +600,20 @@ async function onPlayerSpawn(client) {
}
//if(isGTAIV()) {
// setEntityData(getPlayerPed(client), "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
// setEntityData(getPlayerPed(client), "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
// setEntityData(getPlayerPed(client), "agrp.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
//}
if (isGTAIV()) {

View File

@@ -346,7 +346,7 @@ function createGroundItemObject(itemId) {
setElementRotation(getItemData(itemId).object, getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation);
setElementOnAllDimensions(getItemData(itemId).object, false);
setElementDimension(getItemData(itemId).object, getItemData(itemId).dimension);
//setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
//setEntityData(getItemData(itemId).object, "agrp.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
addToWorld(getItemData(itemId).object);
}
}

View File

@@ -624,11 +624,11 @@ function createAllJobPickups() {
for (let j in getServerData().jobs[i].locations) {
pickupCount++;
getServerData().jobs[i].locations[j].pickup = game.createPickup(getServerData().jobs[i].pickupModel, getServerData().jobs[i].locations[j].position);
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.id", j, false);
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.name", getServerData().jobs[i].name, true);
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.jobType", getServerData().jobs[i].databaseId, true);
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.owner.type", VRR_PICKUP_JOB, false);
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.owner.id", j, false);
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.type", VRR_LABEL_JOB, true);
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.name", getServerData().jobs[i].name, true);
setEntityData(getServerData().jobs[i].locations[j].pickup, "agrp.label.jobType", getServerData().jobs[i].databaseId, true);
setElementOnAllDimensions(getServerData().jobs[i].locations[j].pickup, false);
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
addToWorld(getServerData().jobs[i].locations[j].pickup);
@@ -2743,11 +2743,11 @@ function createJobLocationPickup(jobId, locationId) {
tempJobData.locations[locationId].pickup = pickup;
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
setElementOnAllDimensions(pickup, false);
setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
setEntityData(pickup, "vrr.owner.id", locationId, false);
setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
setEntityData(pickup, "agrp.owner.type", VRR_PICKUP_JOB, false);
setEntityData(pickup, "agrp.owner.id", locationId, false);
setEntityData(pickup, "agrp.label.type", VRR_LABEL_JOB, true);
setEntityData(pickup, "agrp.label.name", tempJobData.name, true);
setEntityData(pickup, "agrp.label.jobType", tempJobData.databaseId, true);
addToWorld(pickup);
}
} else {

View File

@@ -40,10 +40,10 @@ let disconnectReasons = [
// ===========================================================================
function getPlayerPosition(client) {
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return getPlayerData(client).syncPosition;
} else {
if(getPlayerPed(client) != null) {
if (getPlayerPed(client) != null) {
return getPlayerPed(client).position;
}
}
@@ -59,10 +59,10 @@ function setPlayerPosition(client, position) {
// ===========================================================================
function getPlayerHeading(client) {
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return getPlayerData(client).syncHeading;
} else {
if(getPlayerPed(client) != null) {
if (getPlayerPed(client) != null) {
return getPlayerPed(client).heading;
}
}
@@ -78,10 +78,10 @@ function setPlayerHeading(client, heading) {
// ===========================================================================
function getPlayerVehicle(client) {
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return getPlayerData().syncVehicle;
} else {
if(getPlayerPed(client).vehicle) {
if (getPlayerPed(client).vehicle) {
return getPlayerPed(client).vehicle;
}
}
@@ -91,10 +91,10 @@ function getPlayerVehicle(client) {
// ===========================================================================
function getPlayerDimension(client) {
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return getPlayerData(client).syncDimension;
} else {
if(getPlayerPed(client) != null) {
if (getPlayerPed(client) != null) {
return getPlayerPed(client).dimension;
}
}
@@ -110,10 +110,10 @@ function getPlayerInterior(client) {
function setPlayerDimension(client, dimension) {
logToConsole(LOG_VERBOSE, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
getPlayerData(client).syncDimension = dimension;
} else {
if(getPlayerPed(client) != null) {
if (getPlayerPed(client) != null) {
getPlayerPed(client).dimension = dimension;
}
}
@@ -124,7 +124,7 @@ function setPlayerDimension(client, dimension) {
function setPlayerInterior(client, interior) {
logToConsole(LOG_VERBOSE, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
sendPlayerSetInterior(client, interior);
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
if (isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
getPlayerCurrentSubAccount(client).interior = interior;
}
}
@@ -132,7 +132,7 @@ function setPlayerInterior(client, interior) {
// ===========================================================================
function isPlayerInAnyVehicle(client) {
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return (getPlayerData().syncVehicle != null);
} else {
return (getPlayerPed(client).vehicle != null);
@@ -142,15 +142,15 @@ function isPlayerInAnyVehicle(client) {
// ===========================================================================
function getPlayerVehicleSeat(client) {
if(!isPlayerInAnyVehicle(client)) {
if (!isPlayerInAnyVehicle(client)) {
return false;
}
if(!areServerElementsSupported()) {
if (!areServerElementsSupported()) {
return getPlayerData().syncVehicleSeat;
} else {
for(let i = 0 ; i <= 8 ; i++) {
if(getPlayerVehicle(client).getOccupant(i) == getPlayerPed(client)) {
for (let i = 0; i <= 8; i++) {
if (getPlayerVehicle(client).getOccupant(i) == getPlayerPed(client)) {
return i;
}
}
@@ -180,8 +180,8 @@ function getVehicleHeading(vehicle) {
// ===========================================================================
function setVehicleHeading(vehicle, heading) {
if(getGame() == VRR_GAME_GTA_IV) {
return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
if (getGame() == VRR_GAME_GTA_IV) {
return sendNetworkEventToPlayer("agrp.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
}
return vehicle.heading = heading;
}
@@ -189,20 +189,20 @@ function setVehicleHeading(vehicle, heading) {
// ===========================================================================
function getElementTransient(element) {
if(typeof element.transient != "undefined") {
if (typeof element.transient != "undefined") {
return element.transient;
}
return false;
return false;
}
// ===========================================================================
function setElementTransient(element, state) {
if(typeof element.transient != "undefined") {
if (typeof element.transient != "undefined") {
element.transient = state;
return true;
}
return false;
return false;
}
// ===========================================================================
@@ -214,8 +214,8 @@ function getVehicleSyncer(vehicle) {
// ===========================================================================
function getVehicleForNetworkEvent(vehicle) {
if(getGame() == VRR_GAME_GTA_IV) {
if(getVehicleData(vehicle).ivNetworkId != -1) {
if (getGame() == VRR_GAME_GTA_IV) {
if (getVehicleData(vehicle).ivNetworkId != -1) {
return getVehicleData(vehicle).ivNetworkId;
}
return -1;
@@ -227,11 +227,11 @@ function getVehicleForNetworkEvent(vehicle) {
function deleteGameElement(element) {
try {
if(element != null) {
if (element != null) {
destroyElement(element);
return true;
}
} catch(error) {
} catch (error) {
return false;
}
}
@@ -254,8 +254,8 @@ function removePlayerFromVehicle(client) {
function setPlayerSkin(client, skinIndex) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
if(getGame() == VRR_GAME_GTA_IV) {
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
if (getGame() == VRR_GAME_GTA_IV) {
triggerNetworkEvent("agrp.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
} else {
getPlayerPed(client).modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
}
@@ -292,7 +292,7 @@ function setPlayerArmour(client, armour) {
// ===========================================================================
function getPlayerArmour(client) {
if(areServerElementsSupported(client)) {
if (areServerElementsSupported(client)) {
return getPlayerPed(client).armour;
} else {
return getPlayerData(client).syncArmour;
@@ -302,11 +302,11 @@ function getPlayerArmour(client) {
// ===========================================================================
function setPlayerCash(client, amount) {
if(client == null) {
if (client == null) {
return false;
}
if(isNaN(amount)) {
if (isNaN(amount)) {
return false;
}
@@ -317,11 +317,11 @@ function setPlayerCash(client, amount) {
// ===========================================================================
function givePlayerCash(client, amount) {
if(client == null) {
if (client == null) {
return false;
}
if(isNaN(amount)) {
if (isNaN(amount)) {
return false;
}
@@ -332,11 +332,11 @@ function givePlayerCash(client, amount) {
// ===========================================================================
function takePlayerCash(client, amount) {
if(client == null) {
if (client == null) {
return false;
}
if(isNaN(amount)) {
if (isNaN(amount)) {
return false;
}
@@ -368,7 +368,7 @@ function getPlayerWeaponAmmo(client) {
function setPlayerVelocity(client, velocity) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
if(typeof getPlayerPed(client).velocity != "undefined") {
if (typeof getPlayerPed(client).velocity != "undefined") {
getPlayerPed(client).velocity = velocity;
}
}
@@ -376,7 +376,7 @@ function setPlayerVelocity(client, velocity) {
// ===========================================================================
function getPlayerVelocity(client) {
if(typeof getPlayerPed(client).velocity != "undefined") {
if (typeof getPlayerPed(client).velocity != "undefined") {
return getPlayerPed(client).velocity;
}
return toVector3(0.0, 0.0, 0.0);
@@ -385,7 +385,7 @@ function getPlayerVelocity(client) {
// ===========================================================================
function getElementDimension(element) {
if(typeof element.dimension != "undefined") {
if (typeof element.dimension != "undefined") {
return element.dimension;
}
return 0;
@@ -394,18 +394,18 @@ function getElementDimension(element) {
// ===========================================================================
function setElementDimension(element, dimension) {
if(typeof element.dimension != "undefined") {
if (typeof element.dimension != "undefined") {
logToConsole(LOG_VERBOSE, `Setting element ${element} (${element.id}) dimension to ${dimension}`);
element.dimension = dimension;
return true;
}
return false;
element.dimension = dimension;
return true;
}
return false;
}
// ===========================================================================
function setElementRotation(element, rotation) {
if(typeof element.setRotation != "undefined") {
if (typeof element.setRotation != "undefined") {
element.setRotation(rotation);
} else {
return element.rotation = rotation;
@@ -415,24 +415,24 @@ function setElementRotation(element, rotation) {
// ===========================================================================
function givePlayerHealth(client, amount) {
if(getPlayerHealth(client)+amount > 100) {
if (getPlayerHealth(client) + amount > 100) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to 100`);
setPlayerHealth(client, 100);
} else {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client)+amount}`);
setPlayerHealth(client, getPlayerHealth(client)+amount);
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client) + amount}`);
setPlayerHealth(client, getPlayerHealth(client) + amount);
}
}
// ===========================================================================
function givePlayerArmour(client, amount) {
if(getPlayerArmour(client)+amount > 100) {
if (getPlayerArmour(client) + amount > 100) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to 100`);
setPlayerArmour(client, 100);
} else {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client)+amount}`);
setPlayerArmour(client, getPlayerArmour(client)+amount);
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client) + amount}`);
setPlayerArmour(client, getPlayerArmour(client) + amount);
}
}
@@ -469,7 +469,7 @@ function getServerName() {
// ===========================================================================
function createGamePickup(modelIndex, position, type) {
if(!isGameFeatureSupported("pickups")) {
if (!isGameFeatureSupported("pickups")) {
return false;
}
return game.createPickup(modelIndex, position, type);
@@ -478,7 +478,7 @@ function createGamePickup(modelIndex, position, type) {
// ===========================================================================
function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255)) {
if(!isGameFeatureSupported("blips")) {
if (!isGameFeatureSupported("blips")) {
return false;
}
return game.createBlip(type, position, 1, colour);
@@ -487,7 +487,7 @@ function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255
// ===========================================================================
function createGameObject(modelIndex, position) {
if(!isGameFeatureSupported("objects")) {
if (!isGameFeatureSupported("objects")) {
return false;
}
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
@@ -496,13 +496,13 @@ function createGameObject(modelIndex, position) {
// ===========================================================================
function setElementOnAllDimensions(element, state) {
if(!isNull(element) && element != false) {
if(typeof element.netFlags != "undefined") {
if(typeof element.netFlags.onAllDimensions != "undefined") {
if (!isNull(element) && element != false) {
if (typeof element.netFlags != "undefined") {
if (typeof element.netFlags.onAllDimensions != "undefined") {
element.netFlags.onAllDimensions = state;
}
} else {
if(typeof element.onAllDimensions != "undefined") {
if (typeof element.onAllDimensions != "undefined") {
element.onAllDimensions = state;
}
}
@@ -512,7 +512,7 @@ function setElementOnAllDimensions(element, state) {
// ===========================================================================
function destroyGameElement(element) {
if(!isNull(element) && element != false) {
if (!isNull(element) && element != false) {
destroyElement(element);
}
}
@@ -532,7 +532,7 @@ function getPlayerLastVehicle(client) {
// ===========================================================================
function isVehicleObject(vehicle) {
if(vehicle == null || vehicle == undefined) {
if (vehicle == null || vehicle == undefined) {
return false;
}
return (vehicle.type == ELEMENT_VEHICLE);
@@ -547,15 +547,15 @@ function repairVehicle(vehicle) {
// ===========================================================================
function setVehicleLights(vehicle, lights) {
setEntityData(vehicle, "vrr.lights", lights, true);
sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, lights);
setEntityData(vehicle, "agrp.lights", lights, true);
sendNetworkEventToPlayer("agrp.veh.lights", null, vehicle.id, lights);
}
// ===========================================================================
function setVehicleEngine(vehicle, engine) {
vehicle.engine = engine;
setEntityData(vehicle, "vrr.engine", engine, true);
setEntityData(vehicle, "agrp.engine", engine, true);
}
// ===========================================================================
@@ -600,11 +600,11 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
vehicle.colour1 = colour1;
vehicle.colour2 = colour2;
if(colour3 != -1) {
if (colour3 != -1) {
vehicle.colour3 = colour3;
}
if(colour4 != -1) {
if (colour4 != -1) {
vehicle.colour4 = colour4;
}
}
@@ -612,7 +612,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
if(areServerElementsSupported()) {
if (areServerElementsSupported()) {
return mp.vehicles.new(getGameConfig().vehicles[getGame()][modelIndex][0], position, {
heading: heading,
numberPlate: "",
@@ -628,7 +628,7 @@ function createGameVehicle(modelIndex, position, heading) {
// ===========================================================================
function createGameCivilian(modelIndex, position, heading) {
if(areServerElementsSupported()) {
if (areServerElementsSupported()) {
return mp.peds.new(getGameConfig().skins[getGame()][modelIndex][1], position, heading, 0);
}
@@ -644,7 +644,7 @@ function getIsland(position) {
// ===========================================================================
function isValidVehicleModel(model) {
if(getVehicleModelIndexFromModel(model) != false) {
if (getVehicleModelIndexFromModel(model) != false) {
return true;
}
@@ -654,7 +654,7 @@ function isValidVehicleModel(model) {
// ===========================================================================
function setGameTime(hour, minute, minuteDuration = 1000) {
if(isTimeSupported()) {
if (isTimeSupported()) {
game.time.hour = hour;
game.time.minute = minute;
game.time.minuteDuration = minuteDuration;
@@ -664,7 +664,7 @@ function setGameTime(hour, minute, minuteDuration = 1000) {
// ===========================================================================
function setGameWeather(weather) {
if(isWeatherSupported()) {
if (isWeatherSupported()) {
mp.world.weather = weather;
}
}
@@ -690,7 +690,7 @@ function getPlayerElement(client) {
// ===========================================================================
function setElementPosition(element, position) {
sendNetworkEventToPlayer("vrr.elementPosition", null, element.id, position);
sendNetworkEventToPlayer("agrp.elementPosition", null, element.id, position);
}
// ===========================================================================
@@ -714,13 +714,13 @@ function setElementInterior(element, interior) {
// ===========================================================================
function setElementCollisionsEnabled(element, state) {
//sendNetworkEventToPlayer("vrr.elementCollisions", null, element.id, state);
//sendNetworkEventToPlayer("agrp.elementCollisions", null, element.id, state);
}
// ===========================================================================
function isTaxiVehicle(vehicle) {
if(getGameConfig().taxiModels[getGame()].indexOf(vehicle.modelIndex) != -1) {
if (getGameConfig().taxiModels[getGame()].indexOf(vehicle.modelIndex) != -1) {
return true;
}
@@ -737,7 +737,7 @@ function getVehicleName(vehicle) {
// ===========================================================================
function getElementModel(element) {
if(typeof element.model != "undefined") {
if (typeof element.model != "undefined") {
return element.model;
}
}
@@ -757,11 +757,11 @@ function getPlayerWeapon(client) {
// ===========================================================================
function connectToDatabase() {
if(getDatabaseConfig().usePersistentConnection) {
if(persistentDatabaseConnection == null) {
if (getDatabaseConfig().usePersistentConnection) {
if (persistentDatabaseConnection == null) {
logToConsole(LOG_DEBUG, `[VRR.Database] Initializing database connection ...`);
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if(persistentDatabaseConnection.error) {
if (persistentDatabaseConnection.error) {
logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
persistentDatabaseConnection = null;
return false;
@@ -775,7 +775,7 @@ function connectToDatabase() {
}
} else {
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
if(databaseConnection.error) {
if (databaseConnection.error) {
logToConsole(LOG_ERROR, `[VRR.Database] Database connection error: ${persistentDatabaseConnection.error}`);
return false;
} else {
@@ -787,11 +787,11 @@ function connectToDatabase() {
// ===========================================================================
function disconnectFromDatabase(dbConnection) {
if(!getDatabaseConfig().usePersistentConnection) {
if (!getDatabaseConfig().usePersistentConnection) {
try {
dbConnection.close();
logToConsole(LOG_DEBUG, `[VRR.Database] Database connection closed successfully`);
} catch(error) {
} catch (error) {
logToConsole(LOG_ERROR, `[VRR.Database] Database connection could not be closed! (Error: ${error})`);
}
}
@@ -802,7 +802,7 @@ function disconnectFromDatabase(dbConnection) {
function queryDatabase(dbConnection, queryString, useThread = false) {
logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
if(useThread == true) {
if (useThread == true) {
Promise.resolve().then(() => {
let queryResult = dbConnection.query(queryString);
return queryResult;
@@ -815,11 +815,11 @@ function queryDatabase(dbConnection, queryString, useThread = false) {
// ===========================================================================
function escapeDatabaseString(dbConnection, unsafeString = "") {
if(!dbConnection) {
if (!dbConnection) {
dbConnection = connectToDatabase();
}
if(typeof unsafeString == "string") {
if (typeof unsafeString == "string") {
return dbConnection.escapeString(unsafeString);
}
return unsafeString;
@@ -846,7 +846,7 @@ function getDatabaseError(dbConnection) {
// ===========================================================================
function freeDatabaseQuery(dbQuery) {
if(dbQuery != null) {
if (dbQuery != null) {
dbQuery.free();
}
return;
@@ -863,26 +863,26 @@ function fetchQueryAssoc(dbQuery) {
function quickDatabaseQuery(queryString) {
let dbConnection = connectToDatabase();
let insertId = 0;
if(dbConnection) {
if (dbConnection) {
//logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
let dbQuery = queryDatabase(dbConnection, queryString);
if(getDatabaseInsertId(dbConnection)) {
if (getDatabaseInsertId(dbConnection)) {
insertId = getDatabaseInsertId(dbConnection);
logToConsole(LOG_DEBUG, `[VRR.Database] Query returned insert id ${insertId}`);
}
if(dbQuery) {
if (dbQuery) {
try {
freeDatabaseQuery(dbQuery);
logToConsole(LOG_DEBUG, `[VRR.Database] Query result free'd successfully`);
} catch(error) {
} catch (error) {
logToConsole(LOG_ERROR, `[VRR.Database] Query result could not be free'd! (Error: ${error})`);
}
}
disconnectFromDatabase(dbConnection);
if(insertId != 0) {
if (insertId != 0) {
return insertId;
}
@@ -915,8 +915,8 @@ function getElementId(element) {
function getClientFromIndex(index) {
let clients = getClients();
for(let i in clients) {
if(clients[i].index == index) {
for (let i in clients) {
if (clients[i].index == index) {
return clients[i];
}
}
@@ -955,7 +955,7 @@ function getClosestCivilian(position) {
// ===========================================================================
function getVehiclesInRange(position, range) {
if(getGame() == VRR_GAME_GTA_IV) {
if (getGame() == VRR_GAME_GTA_IV) {
return getServerData().vehicles.reduce((i, j) => (getDistance(position, i.syncPosition) <= getDistance(position, j.syncPosition)) ? i : j);
}
return getElementsByTypeInRange(ELEMENT_VEHICLE, position, range);
@@ -976,8 +976,8 @@ function getClosestElementByType(elementType, position) {
// ===========================================================================
function getVehicleFirstEmptySeat(vehicle) {
for(let i = 0; i <= 4; i++) {
if(vehicle.getOccupant(i) == null) {
for (let i = 0; i <= 4; i++) {
if (vehicle.getOccupant(i) == null) {
return i;
}
}
@@ -1014,14 +1014,14 @@ function setVehicleHealth(vehicle, health) {
function givePlayerWeapon(client, weaponId, ammo, active = true) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
//sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
//sendNetworkEventToPlayer("agrp.giveWeapon", client, weaponId, ammo, active);
client.giveWeapon(weaponId, ammo);
}
// ===========================================================================
function setPlayerWantedLevel(client, wantedLevel) {
//sendNetworkEventToPlayer("vrr.wantedLevel", client, wantedLevel);
//sendNetworkEventToPlayer("agrp.wantedLevel", client, wantedLevel);
return true;
}
@@ -1046,9 +1046,9 @@ function getPlayerPed(client) {
// ===========================================================================
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
if(entity != null) {
if(areServerElementsSupported()) {
if(syncToClients) {
if (entity != null) {
if (areServerElementsSupported()) {
if (syncToClients) {
return entity.setVariable(dataName, dataValue);
} else {
return entity.setOwnVariable(dataName, dataValue);
@@ -1061,8 +1061,8 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
// ===========================================================================
function removeEntityData(entity, dataName) {
if(entity != null) {
if(areServerElementsSupported()) {
if (entity != null) {
if (areServerElementsSupported()) {
return entity.setVariable(dataName, null);
}
}
@@ -1072,8 +1072,8 @@ function removeEntityData(entity, dataName) {
// ===========================================================================
function doesEntityDataExist(entity, dataName) {
if(entity != null) {
if(areServerElementsSupported()) {
if (entity != null) {
if (areServerElementsSupported()) {
return (entity.getVariable(dataName) != null);
} else {
return false;
@@ -1169,7 +1169,7 @@ function serverBanIP(ip) {
// ===========================================================================
function setVehicleTrunkState(vehicle, trunkState) {
//sendNetworkEventToPlayer("vrr.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
//sendNetworkEventToPlayer("agrp.veh.trunk", null, getVehicleForNetworkEvent(vehicle), trunkState);
}
// ===========================================================================
@@ -1201,7 +1201,7 @@ function addAllEventHandlers() {
// ===========================================================================
function addServerCommandHandler(command, handlerFunction) {
mp.events.addCommand(command, function(client, ...args) {
mp.events.addCommand(command, function (client, ...args) {
handlerFunction.call(command, args.join(" "), client);
});
}
@@ -1209,7 +1209,7 @@ function addServerCommandHandler(command, handlerFunction) {
// ===========================================================================
function addServerEventHandler(eventName, handlerFunction) {
mp.events.add(eventName, function(event, ...args) {
mp.events.add(eventName, function (event, ...args) {
let result = handlerFunction.apply(this, args);
});
}
@@ -1217,7 +1217,7 @@ function addServerEventHandler(eventName, handlerFunction) {
// ===========================================================================
function bindServerEventHandler(eventName, bindTo, handlerFunction) {
mp.events.add(eventName, function(event, ...args) {
mp.events.add(eventName, function (event, ...args) {
let result = handlerFunction.apply(this, args);
});
}

View File

@@ -18,72 +18,72 @@ function addAllNetworkEventHandlers() {
logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
// KeyBind
addNetworkEventHandler("vrr.useKeyBind", playerUsedKeyBind);
addNetworkEventHandler("agrp.useKeyBind", playerUsedKeyBind);
// GUI
addNetworkEventHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
addNetworkEventHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
addNetworkEventHandler("vrr.toggleGUI", playerToggledGUI);
addNetworkEventHandler("vrr.2fa", checkPlayerTwoFactorAuthentication);
addNetworkEventHandler("agrp.promptAnswerNo", playerPromptAnswerNo);
addNetworkEventHandler("agrp.promptAnswerYes", playerPromptAnswerYes);
addNetworkEventHandler("agrp.toggleGUI", playerToggledGUI);
addNetworkEventHandler("agrp.2fa", checkPlayerTwoFactorAuthentication);
// AFK
addNetworkEventHandler("vrr.afk", playerChangeAFKState);
addNetworkEventHandler("agrp.afk", playerChangeAFKState);
// Event
addNetworkEventHandler("vrr.pickup", onPlayerNearPickup);
addNetworkEventHandler("vrr.enteredSphere", onPlayerEnteredSphere);
addNetworkEventHandler("vrr.exitedSphere", onPlayerExitedSphere);
addNetworkEventHandler("vrr.playerDeath", onPlayerDeath);
//addNetworkEventHandler("vrr.onPlayerEnterVehicle", onPlayerEnteredVehicle);
//addNetworkEventHandler("vrr.onPlayerExitVehicle", onPlayerExitedVehicle);
addNetworkEventHandler("agrp.pickup", onPlayerNearPickup);
addNetworkEventHandler("agrp.enteredSphere", onPlayerEnteredSphere);
addNetworkEventHandler("agrp.exitedSphere", onPlayerExitedSphere);
addNetworkEventHandler("agrp.playerDeath", onPlayerDeath);
//addNetworkEventHandler("agrp.onPlayerEnterVehicle", onPlayerEnteredVehicle);
//addNetworkEventHandler("agrp.onPlayerExitVehicle", onPlayerExitedVehicle);
// Job
addNetworkEventHandler("vrr.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
addNetworkEventHandler("agrp.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
// Client
addNetworkEventHandler("vrr.clientReady", playerClientReady);
addNetworkEventHandler("vrr.guiReady", playerGUIReady);
addNetworkEventHandler("vrr.clientStarted", playerClientStarted);
addNetworkEventHandler("vrr.clientStopped", playerClientStopped);
addNetworkEventHandler("agrp.clientReady", playerClientReady);
addNetworkEventHandler("agrp.guiReady", playerGUIReady);
addNetworkEventHandler("agrp.clientStarted", playerClientStarted);
addNetworkEventHandler("agrp.clientStopped", playerClientStopped);
// Account
addNetworkEventHandler("vrr.checkLogin", checkLogin);
addNetworkEventHandler("vrr.checkRegistration", checkRegistration);
addNetworkEventHandler("vrr.checkResetPassword", checkAccountResetPasswordRequest);
addNetworkEventHandler("vrr.checkChangePassword", checkAccountChangePassword);
addNetworkEventHandler("agrp.checkLogin", checkLogin);
addNetworkEventHandler("agrp.checkRegistration", checkRegistration);
addNetworkEventHandler("agrp.checkResetPassword", checkAccountResetPasswordRequest);
addNetworkEventHandler("agrp.checkChangePassword", checkAccountChangePassword);
// Developer
addNetworkEventHandler("vrr.runCodeSuccess", clientRunCodeSuccess);
addNetworkEventHandler("vrr.runCodeFail", clientRunCodeFail);
addNetworkEventHandler("agrp.runCodeSuccess", clientRunCodeSuccess);
addNetworkEventHandler("agrp.runCodeFail", clientRunCodeFail);
// SubAccount
addNetworkEventHandler("vrr.checkNewCharacter", checkNewCharacter);
addNetworkEventHandler("vrr.nextCharacter", checkNextCharacter);
addNetworkEventHandler("vrr.previousCharacter", checkPreviousCharacter);
addNetworkEventHandler("vrr.selectCharacter", selectCharacter);
addNetworkEventHandler("agrp.checkNewCharacter", checkNewCharacter);
addNetworkEventHandler("agrp.nextCharacter", checkNextCharacter);
addNetworkEventHandler("agrp.previousCharacter", checkPreviousCharacter);
addNetworkEventHandler("agrp.selectCharacter", selectCharacter);
// Item
addNetworkEventHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete);
addNetworkEventHandler("vrr.weaponDamage", playerDamagedByPlayer);
addNetworkEventHandler("agrp.itemActionDelayComplete", playerItemActionDelayComplete);
addNetworkEventHandler("agrp.weaponDamage", playerDamagedByPlayer);
// Locale
addNetworkEventHandler("vrr.localeSelect", playerSelectedNewLocale);
addNetworkEventHandler("agrp.localeSelect", playerSelectedNewLocale);
// Misc
addNetworkEventHandler("vrr.plr.pos", updatePositionInPlayerData);
addNetworkEventHandler("vrr.plr.rot", updateHeadingInPlayerData);
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
addNetworkEventHandler("vrr.playerCop", setPlayerAsCopState);
addNetworkEventHandler("agrp.plr.pos", updatePositionInPlayerData);
addNetworkEventHandler("agrp.plr.rot", updateHeadingInPlayerData);
addNetworkEventHandler("agrp.skinSelected", playerFinishedSkinSelection);
addNetworkEventHandler("agrp.clientInfo", updateConnectionLogOnClientInfoReceive);
addNetworkEventHandler("agrp.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("agrp.playerPedId", receivePlayerPedNetworkId);
addNetworkEventHandler("agrp.playerCop", setPlayerAsCopState);
}
// ===========================================================================
function updatePlayerNameTag(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("vrr.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
}
// ===========================================================================
@@ -100,7 +100,7 @@ function updateAllPlayerNameTags() {
function updatePlayerPing(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
sendNetworkEventToPlayer("vrr.ping", null, getPlayerName(client), getPlayerPing(client));
sendNetworkEventToPlayer("agrp.ping", null, getPlayerName(client), getPlayerPing(client));
}
// ===========================================================================
@@ -142,7 +142,7 @@ function playerClientStopped(client) {
function showSmallGameMessage(client, text, colour, duration, fontName = "Pricedown") {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
sendNetworkEventToPlayer("vrr.smallGameMessage", client, text, colour, duration, fontName);
sendNetworkEventToPlayer("agrp.smallGameMessage", client, text, colour, duration, fontName);
}
// ===========================================================================
@@ -153,7 +153,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
//}
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("vrr.ambience", client, true);
//sendNetworkEventToPlayer("agrp.ambience", client, true);
}
// ===========================================================================
@@ -164,14 +164,14 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
//}
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//sendNetworkEventToPlayer("vrr.ambience", client, false, clearElements);
//sendNetworkEventToPlayer("agrp.ambience", client, false, clearElements);
}
// ===========================================================================
function clearPlayerOwnedPeds(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.clearPeds", client);
sendNetworkEventToPlayer("agrp.clearPeds", client);
}
// ===========================================================================
@@ -179,41 +179,41 @@ function clearPlayerOwnedPeds(client) {
function updatePlayerSpawnedState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
getPlayerData(client).spawned = true;
sendNetworkEventToPlayer("vrr.spawned", client, state);
sendNetworkEventToPlayer("agrp.spawned", client, state);
}
// ===========================================================================
function setPlayerControlState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("vrr.control", client, state, !state);
sendNetworkEventToPlayer("agrp.control", client, state, !state);
}
// ===========================================================================
function updatePlayerShowLogoState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
sendNetworkEventToPlayer("vrr.logo", client, state);
sendNetworkEventToPlayer("agrp.logo", client, state);
}
// ===========================================================================
function restorePlayerCamera(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
sendNetworkEventToPlayer("vrr.restoreCamera", client);
sendNetworkEventToPlayer("agrp.restoreCamera", client);
}
// ===========================================================================
function setPlayer2DRendering(client, hudState = false, labelState = false, smallGameMessageState = false, scoreboardState = false, hotBarState = false, itemActionDelayState = false) {
sendNetworkEventToPlayer("vrr.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState);
sendNetworkEventToPlayer("agrp.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState);
}
// ===========================================================================
function syncPlayerProperties(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
sendNetworkEventToPlayer("vrr.syncElement", null, getPlayerPed(client).id);
sendNetworkEventToPlayer("agrp.syncElement", null, getPlayerPed(client).id);
}
// ===========================================================================
@@ -221,7 +221,7 @@ function syncPlayerProperties(client) {
function updatePlayerSnowState(client) {
if (isSnowSupported(getGame())) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
sendNetworkEventToPlayer("vrr.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
sendNetworkEventToPlayer("agrp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
}
}
@@ -245,21 +245,21 @@ function updatePlayerHotBar(client) {
}
tempHotBarItems.push([i, itemExists, itemImage, itemValue]);
}
sendNetworkEventToPlayer("vrr.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
sendNetworkEventToPlayer("agrp.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
}
// ===========================================================================
function setPlayerWeaponDamageEnabled(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("vrr.weaponDamageEnabled", null, getPlayerName(client), state);
sendNetworkEventToPlayer("agrp.weaponDamageEnabled", null, getPlayerName(client), state);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(client, eventType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
sendNetworkEventToPlayer("vrr.weaponDamageEvent", null, getPlayerName(client), eventType);
sendNetworkEventToPlayer("agrp.weaponDamageEvent", null, getPlayerName(client), eventType);
getPlayerData(client).weaponDamageEvent = eventType;
}
@@ -267,259 +267,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
function sendJobRouteLocationToPlayer(client, position, colour) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showJobRouteLocation", client, position, colour);
sendNetworkEventToPlayer("agrp.showJobRouteLocation", client, position, colour);
}
// ===========================================================================
function showPlayerLoginSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.loginSuccess", client);
sendNetworkEventToPlayer("agrp.loginSuccess", client);
}
// ===========================================================================
function showPlayerLoginFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.loginFailed", client, errorMessage);
sendNetworkEventToPlayer("agrp.loginFailed", client, errorMessage);
}
// ===========================================================================
function showPlayerRegistrationSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.registrationSuccess", client);
sendNetworkEventToPlayer("agrp.registrationSuccess", client);
}
// ===========================================================================
function showPlayerRegistrationFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.registrationFailed", client, errorMessage);
sendNetworkEventToPlayer("agrp.registrationFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerGUIColours(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
sendNetworkEventToPlayer("agrp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
}
// ===========================================================================
function sendPlayerGUIInit(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.guiInit", client);
sendNetworkEventToPlayer("agrp.guiInit", client);
}
// ===========================================================================
function showPlayerLoginGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showLogin", client);
sendNetworkEventToPlayer("agrp.showLogin", client);
}
// ===========================================================================
function showPlayerRegistrationGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showRegistration", client);
sendNetworkEventToPlayer("agrp.showRegistration", client);
}
// ===========================================================================
function showPlayerNewCharacterGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showNewCharacter", client);
sendNetworkEventToPlayer("agrp.showNewCharacter", client);
}
// ===========================================================================
function showPlayerChangePasswordGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showChangePassword", client, errorMessage);
sendNetworkEventToPlayer("agrp.showChangePassword", client, errorMessage);
}
// ===========================================================================
function showPlayerResetPasswordCodeInputGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showResetPasswordCodeInput", client);
sendNetworkEventToPlayer("agrp.showResetPasswordCodeInput", client);
}
// ===========================================================================
function showPlayerResetPasswordEmailInputGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showResetPasswordEmailInput", client);
sendNetworkEventToPlayer("agrp.showResetPasswordEmailInput", client);
}
// ===========================================================================
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
sendNetworkEventToPlayer("agrp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
sendNetworkEventToPlayer("agrp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function showPlayerCharacterSelectSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.characterSelectSuccess", client);
sendNetworkEventToPlayer("agrp.characterSelectSuccess", client);
}
// ===========================================================================
function showPlayerCharacterSelectFailedGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.characterSelectFailed", client);
sendNetworkEventToPlayer("agrp.characterSelectFailed", client);
}
// ===========================================================================
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
sendNetworkEventToPlayer("vrr.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
sendNetworkEventToPlayer("agrp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
}
// ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
sendNetworkEventToPlayer("vrr.showInfo", client, infoMessage, infoTitle, buttonText);
sendNetworkEventToPlayer("agrp.showInfo", client, infoMessage, infoTitle, buttonText);
}
// ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
sendNetworkEventToPlayer("vrr.showError", client, errorMessage, errorTitle, buttonText);
sendNetworkEventToPlayer("agrp.showError", client, errorMessage, errorTitle, buttonText);
}
// ===========================================================================
function sendRunCodeToClient(client, code, returnTo) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
sendNetworkEventToPlayer("vrr.runCode", client, code, getPlayerId(returnTo));
sendNetworkEventToPlayer("agrp.runCode", client, code, getPlayerId(returnTo));
}
// ===========================================================================
function sendPlayerWorkingState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.working", client, state);
sendNetworkEventToPlayer("agrp.working", client, state);
}
// ===========================================================================
function sendPlayerJobType(client, jobType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.jobType", client, jobType);
sendNetworkEventToPlayer("agrp.jobType", client, jobType);
}
// ===========================================================================
function sendPlayerStopJobRoute(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.hideJobRouteLocation", client);
sendNetworkEventToPlayer("agrp.hideJobRouteLocation", client);
}
// ===========================================================================
function sendPlayerMouseCameraToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.mouseCamera", client);
sendNetworkEventToPlayer("agrp.mouseCamera", client);
}
// ===========================================================================
function setPlayerMouseCameraState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.mouseCameraForce", client, state);
sendNetworkEventToPlayer("agrp.mouseCameraForce", client, state);
}
// ===========================================================================
function sendPlayerMouseCursorToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.mouseCursor", client);
sendNetworkEventToPlayer("agrp.mouseCursor", client);
}
// ===========================================================================
function sendAddAccountKeyBindToClient(client, key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("vrr.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
sendNetworkEventToPlayer("agrp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
}
// ===========================================================================
function sendClearKeyBindsToClient(client, key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
sendNetworkEventToPlayer("vrr.clearKeyBinds", client);
sendNetworkEventToPlayer("agrp.clearKeyBinds", client);
}
// ===========================================================================
function sendRemoveAccountKeyBindToClient(client, key) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
sendNetworkEventToPlayer("vrr.delKeyBind", client, toInteger(key));
sendNetworkEventToPlayer("agrp.delKeyBind", client, toInteger(key));
}
// ===========================================================================
function sendPlayerSetPosition(client, position) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
sendNetworkEventToPlayer("vrr.position", client, position);
sendNetworkEventToPlayer("agrp.position", client, position);
}
// ===========================================================================
function sendPlayerSetHeading(client, heading) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
sendNetworkEventToPlayer("vrr.heading", client, heading);
sendNetworkEventToPlayer("agrp.heading", client, heading);
}
// ===========================================================================
function sendPlayerSetInterior(client, interior) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
sendNetworkEventToPlayer("vrr.interior", client, interior);
sendNetworkEventToPlayer("agrp.interior", client, interior);
}
// ===========================================================================
function sendPlayerFrozenState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
sendNetworkEventToPlayer("vrr.frozen", client, state);
sendNetworkEventToPlayer("agrp.frozen", client, state);
}
// ===========================================================================
function clearPlayerWeapons(client, clearData = true) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
sendNetworkEventToPlayer("vrr.clearWeapons", client, clearData);
sendNetworkEventToPlayer("agrp.clearWeapons", client, clearData);
}
// ===========================================================================
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.newCharacterFailed", client, errorMessage);
sendNetworkEventToPlayer("agrp.newCharacterFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerRemoveFromVehicle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.removeFromVehicle", client);
sendNetworkEventToPlayer("agrp.removeFromVehicle", client);
}
// ===========================================================================
@@ -536,7 +536,7 @@ function showPlayerItemTakeDelay(client, itemId) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -551,7 +551,7 @@ function showPlayerItemUseDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -566,7 +566,7 @@ function showPlayerItemDropDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -581,7 +581,7 @@ function showPlayerItemPickupDelay(client, itemId) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -596,7 +596,7 @@ function showPlayerItemPutDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -612,7 +612,7 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
if (delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
sendNetworkEventToPlayer("vrr.showItemActionDelay", client, delay);
sendNetworkEventToPlayer("agrp.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerItemActionDelayComplete(client);
@@ -631,14 +631,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
function sendPlayerDrunkEffect(client, amount, duration) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
sendNetworkEventToPlayer("vrr.drunkEffect", client, amount, duration);
sendNetworkEventToPlayer("agrp.drunkEffect", client, amount, duration);
}
// ===========================================================================
function sendPlayerClearPedState(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
sendNetworkEventToPlayer("vrr.clearPedState", client);
sendNetworkEventToPlayer("agrp.clearPedState", client);
}
// ===========================================================================
@@ -696,13 +696,13 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
// ===========================================================================
function setPlayerCameraLookAt(client, cameraPosition, lookAtPosition) {
sendNetworkEventToPlayer("vrr.cameraLookAt", client, cameraPosition, lookAtPosition);
sendNetworkEventToPlayer("agrp.cameraLookAt", client, cameraPosition, lookAtPosition);
}
// ===========================================================================
function sendTimeMinuteDurationToPlayer(client, minuteDuration) {
sendNetworkEventToPlayer("vrr.minuteDuration", client, minuteDuration);
sendNetworkEventToPlayer("agrp.minuteDuration", client, minuteDuration);
}
// ===========================================================================
@@ -745,13 +745,13 @@ function forcePlayerIntoSkinSelect(client) {
setPlayerDimension(client, getPlayerId(client) + 500);
}
sendNetworkEventToPlayer("vrr.skinSelect", client, true);
sendNetworkEventToPlayer("agrp.skinSelect", client, true);
}
// ===========================================================================
function updatePlayerCash(client) {
sendNetworkEventToPlayer("vrr.money", client, getPlayerCurrentSubAccount(client).cash);
sendNetworkEventToPlayer("agrp.money", client, getPlayerCurrentSubAccount(client).cash);
}
// ===========================================================================
@@ -769,7 +769,7 @@ function sendAllPoliceStationBlips(client) {
getColourByName("policeBlue"),
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
@@ -788,7 +788,7 @@ function sendAllFireStationBlips(client) {
getColourByName("firefighterRed"),
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
@@ -807,7 +807,7 @@ function sendAllHospitalBlips(client) {
getColourByName("medicPink"),
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
@@ -826,7 +826,7 @@ function sendAllAmmunationBlips(client) {
0
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
@@ -845,7 +845,7 @@ function sendAllPayAndSprayBlips(client) {
0
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
@@ -864,26 +864,26 @@ function sendAllFuelStationBlips(client) {
getColourByName("burntOrange"),
]);
}
sendNetworkEventToPlayer("vrr.blips", client, tempBlips);
sendNetworkEventToPlayer("agrp.blips", client, tempBlips);
}
}
// ===========================================================================
function sendPlayerSetHealth(client, health) {
sendNetworkEventToPlayer("vrr.health", client, toInteger(health));
sendNetworkEventToPlayer("agrp.health", client, toInteger(health));
}
// ===========================================================================
function sendPlayerSetArmour(client, armour) {
sendNetworkEventToPlayer("vrr.armour", client, armour);
sendNetworkEventToPlayer("agrp.armour", client, armour);
}
// ===========================================================================
function playerFinishedSkinSelection(client, allowedSkinIndex) {
sendNetworkEventToPlayer("vrr.skinSelect", client, false);
sendNetworkEventToPlayer("agrp.skinSelect", client, false);
if (allowedSkinIndex == -1) {
messagePlayerAlert(client, "You canceled the skin change.");
restorePlayerCamera(client);
@@ -935,34 +935,34 @@ function playerFinishedSkinSelection(client, allowedSkinIndex) {
// ===========================================================================
function sendPlayerChatScrollLines(client, amount) {
sendNetworkEventToPlayer("vrr.chatScrollLines", client, amount);
sendNetworkEventToPlayer("agrp.chatScrollLines", client, amount);
}
// ===========================================================================
function sendPlayerChatAutoHideDelay(client, delay) {
sendNetworkEventToPlayer("vrr.chatAutoHideDelay", client, delay);
sendNetworkEventToPlayer("agrp.chatAutoHideDelay", client, delay);
}
// ===========================================================================
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
sendNetworkEventToPlayer("vrr.radioStream", client, streamURL, loop, volume, element);
sendNetworkEventToPlayer("agrp.radioStream", client, streamURL, loop, volume, element);
}
// ===========================================================================
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
sendNetworkEventToPlayer("vrr.audioFileStream", client, audioName, loop, volume);
sendNetworkEventToPlayer("agrp.audioFileStream", client, audioName, loop, volume);
}
// ===========================================================================
function stopRadioStreamForPlayer(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
sendNetworkEventToPlayer("vrr.stopRadioStream", client);
sendNetworkEventToPlayer("agrp.stopRadioStream", client);
}
// ===========================================================================
@@ -970,65 +970,65 @@ function stopRadioStreamForPlayer(client) {
function setPlayerStreamingRadioVolume(client, volumeLevel, elementId = false) {
getPlayerData(client).accountData.streamingRadioVolume = volumeLevel;
getPlayerData(client).streamingRadioElement = elementId;
sendNetworkEventToPlayer("vrr.radioVolume", client, volumeLevel, elementId);
sendNetworkEventToPlayer("agrp.radioVolume", client, volumeLevel, elementId);
}
// ===========================================================================
function setVehicleLightsState(vehicle, state) {
setEntityData(vehicle, "vrr.lights", getVehicleData(vehicle).lights);
sendNetworkEventToPlayer("vrr.veh.lights", null, vehicle.id, state);
setEntityData(vehicle, "agrp.lights", getVehicleData(vehicle).lights);
sendNetworkEventToPlayer("agrp.veh.lights", null, vehicle.id, state);
}
// ===========================================================================
function sendPlayerEnterPropertyKey(client, key) {
sendNetworkEventToPlayer("vrr.enterPropertyKey", client, key);
sendNetworkEventToPlayer("agrp.enterPropertyKey", client, key);
}
// ===========================================================================
function makePedPlayAnimation(ped, animationSlot, positionOffset) {
setEntityData(ped, "vrr.anim", animationSlot, true);
sendNetworkEventToPlayer("vrr.anim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset);
setEntityData(ped, "agrp.anim", animationSlot, true);
sendNetworkEventToPlayer("agrp.anim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset);
}
// ===========================================================================
function makePedStopAnimation(ped) {
removeEntityData(ped, "vrr.anim");
sendNetworkEventToPlayer("vrr.stopAnim", null, getPedForNetworkEvent(ped));
removeEntityData(ped, "agrp.anim");
sendNetworkEventToPlayer("agrp.stopAnim", null, getPedForNetworkEvent(ped));
}
// ===========================================================================
function forcePedAnimation(ped, animationSlot, positionOffset = 0) {
addEntityData(ped, "vrr.anim", animationSlot, true);
sendNetworkEventToPlayer("vrr.forceAnim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset);
addEntityData(ped, "agrp.anim", animationSlot, true);
sendNetworkEventToPlayer("agrp.forceAnim", null, getPedForNetworkEvent(ped), animationSlot, positionOffset);
}
// ===========================================================================
function hideAllPlayerGUI(client) {
sendNetworkEventToPlayer("vrr.hideAllGUI", client);
sendNetworkEventToPlayer("agrp.hideAllGUI", client);
}
// ===========================================================================
function requestClientInfo(client) {
sendNetworkEventToPlayer("vrr.clientInfo", client);
sendNetworkEventToPlayer("agrp.clientInfo", client);
}
// ===========================================================================
function updateInteriorLightsForPlayer(client, state) {
sendNetworkEventToPlayer("vrr.interiorLights", client, state);
sendNetworkEventToPlayer("agrp.interiorLights", client, state);
}
// ===========================================================================
function forcePlayerToSyncElementProperties(client, element) {
sendNetworkEventToPlayer("vrr.syncElement", client, element.id);
sendNetworkEventToPlayer("agrp.syncElement", client, element.id);
}
// ===========================================================================
@@ -1037,7 +1037,7 @@ function sendPlayerPedPartsAndProps(client) {
let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
sendNetworkEventToPlayer("agrp.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
}
// ===========================================================================
@@ -1062,7 +1062,7 @@ function updateAllInteriorVehiclesForPlayer(client, interior, dimension) {
function setPlayerBuyingVehicleState(client, state, vehicleId, position) {
if (getGlobalConfig().useServerSideVehiclePurchaseCheck == false) {
sendNetworkEventToPlayer("vrr.vehBuyState", client, state, vehicleId, position);
sendNetworkEventToPlayer("agrp.vehBuyState", client, state, vehicleId, position);
}
}
@@ -1077,37 +1077,37 @@ function receiveVehiclePurchaseStateUpdateFromClient(client, state) {
// ===========================================================================
function sendPlayerLogLevel(client, tempLogLevel = logLevel) {
sendNetworkEventToPlayer("vrr.logLevel", client, tempLogLevel);
sendNetworkEventToPlayer("agrp.logLevel", client, tempLogLevel);
}
// ==========================================================================
function setPlayerInfiniteRun(client, state) {
sendNetworkEventToPlayer("vrr.infiniteRun", client, state);
sendNetworkEventToPlayer("agrp.infiniteRun", client, state);
}
// ==========================================================================
function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
sendNetworkEventToPlayer("agrp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
}
// ==========================================================================
function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
sendNetworkEventToPlayer("vrr.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
sendNetworkEventToPlayer("agrp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
}
// ==========================================================================
function sendJobToPlayer(client, jobId, jobLocationId, name, position) {
sendNetworkEventToPlayer("vrr.job", client, jobId, jobLocationId, name, position);
sendNetworkEventToPlayer("agrp.job", client, jobId, jobLocationId, name, position);
}
// ==========================================================================
function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4) {
sendNetworkEventToPlayer("vrr.vehicle", client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4);
sendNetworkEventToPlayer("agrp.vehicle", client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4);
}
// ==========================================================================
@@ -1151,7 +1151,7 @@ function sendAllVehiclesToPlayer(client) {
// ==========================================================================
function makePlayerHoldObjectModel(client, modelIndex) {
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).ped, modelIndex);
sendNetworkEventToPlayer("agrp.holdObject", client, getPlayerData(client).ped, modelIndex);
}
// ==========================================================================
@@ -1163,44 +1163,44 @@ function receivePlayerPedNetworkId(client, pedId) {
// ==========================================================================
function requestPlayerPedNetworkId(client) {
sendNetworkEventToPlayer("vrr.playerPedId", client);
sendNetworkEventToPlayer("agrp.playerPedId", client);
}
// ==========================================================================
function setPlayerInCutsceneInterior(client, cutsceneName) {
getPlayerData(client).interiorCutscene = cutsceneName;
sendNetworkEventToPlayer("vrr.cutsceneInterior", client, cutsceneName);
sendNetworkEventToPlayer("agrp.cutsceneInterior", client, cutsceneName);
}
// ==========================================================================
function makePlayerPedSpeak(client, pedSpeechName) {
sendNetworkEventToPlayer("vrr.pedSpeak", client, pedSpeechName);
sendNetworkEventToPlayer("agrp.pedSpeak", client, pedSpeechName);
}
// ==========================================================================
function setPlayerAsCopState(client, state) {
sendNetworkEventToPlayer("vrr.playerCop", client, state);
sendNetworkEventToPlayer("agrp.playerCop", client, state);
}
// ==========================================================================
function tellPlayerToSpawn(client, skinId, position) {
sendNetworkEventToPlayer("vrr.spawn", client, skinId, position);
sendNetworkEventToPlayer("agrp.spawn", client, skinId, position);
}
// ==========================================================================
function sendNameTagDistanceToClient(client, distance) {
sendNetworkEventToPlayer("vrr.nameTagDistance", client, distance);
sendNetworkEventToPlayer("agrp.nameTagDistance", client, distance);
}
// ==========================================================================
function sendGPSBlipToPlayer(client, position, colour) {
sendNetworkEventToPlayer("vrr.showGPSBlip", client, position, colour);
sendNetworkEventToPlayer("agrp.showGPSBlip", client, position, colour);
}
// ==========================================================================
@@ -1213,13 +1213,13 @@ function playerSelectedNewLocale(client, localeId) {
// ==========================================================================
function sendPlayerLocaleId(client, localeId) {
sendNetworkEventToPlayer("vrr.locale", client, localeId);
sendNetworkEventToPlayer("agrp.locale", client, localeId);
}
// ==========================================================================
function showLocaleChooserForPlayer(client) {
sendNetworkEventToPlayer("vrr.localeChooser", client);
sendNetworkEventToPlayer("agrp.localeChooser", client);
}
// ==========================================================================
@@ -1227,20 +1227,20 @@ function showLocaleChooserForPlayer(client) {
function sendPlayerLocaleStrings(client) {
let strings = getGlobalConfig().locale.sendStringsToClient;
for (let i in strings) {
sendNetworkEventToPlayer("vrr.localeString", client, strings[i], getLocaleString(client, strings[i]));
sendNetworkEventToPlayer("agrp.localeString", client, strings[i], getLocaleString(client, strings[i]));
}
}
// ==========================================================================
function clearLocalPickupsForPlayer(client) {
sendNetworkEventToPlayer("vrr.clearPickups", client);
sendNetworkEventToPlayer("agrp.clearPickups", client);
}
// ==========================================================================
function sendPlayerChatBoxTimeStampsState(client, state) {
sendNetworkEventToPlayer("vrr.chatTimeStamps", client, state);
sendNetworkEventToPlayer("agrp.chatTimeStamps", client, state);
}
// ==========================================================================

View File

@@ -468,11 +468,11 @@ function spawnNPC(npcIndex) {
let ped = createGamePed(npcData.skin, npcData.position, npcData.rotation.z);
if (ped) {
getNPCData(npcIndex).ped = ped;
setEntityData(ped, "vrr.dataIndex", npcIndex, false);
setEntityData(ped, "agrp.dataIndex", npcIndex, false);
if (npcData.animationName != "") {
let animationId = getAnimationFromParams(npcData.animationName);
if (animationId != false) {
setEntityData(ped, "vrr.anim", animationId, true);
setEntityData(ped, "agrp.anim", animationId, true);
}
}
setElementDimension(ped, npcData.dimension);
@@ -592,7 +592,7 @@ function toggleNPCLookAtClosestPlayerCommand(command, params, client) {
getNPCData(closestNPC).lookAtClosestPlayer = !getNPCData(closestNPC).lookAtClosestPlayer;
getNPCData(closestNPC).needsSaved = true;
setEntityData(getNPCData(closestNPC).ped, "vrr.lookAtClosestPlayer", getNPCData(closestNPC).lookAtClosestPlayer, true);
setEntityData(getNPCData(closestNPC).ped, "agrp.lookAtClosestPlayer", getNPCData(closestNPC).lookAtClosestPlayer, true);
forcePlayerToSyncElementProperties(null, getNPCData(closestNPC).ped);
//messagePlayerSuccess(client, getLocaleString(client, "NPCLookAtClosestPlayerSet", `{ALTCOLOUR}${getNPCData(closestNPC).name}{MAINCOLOUR}));
}

View File

@@ -322,7 +322,7 @@ function spawnAllVehicles() {
for (let i in getServerData().vehicles) {
let vehicle = spawnVehicle(getServerData().vehicles[i]);
getServerData().vehicles[i].vehicle = vehicle;
setEntityData(vehicle, "vrr.dataSlot", i, false);
setEntityData(vehicle, "agrp.dataSlot", i, false);
setAllVehicleIndexes();
}
}
@@ -336,7 +336,7 @@ function spawnAllVehicles() {
function getVehicleData(vehicle) {
if (getGame() != VRR_GAME_GTA_IV) {
if (isVehicleObject(vehicle)) {
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
if (typeof getServerData().vehicles[dataIndex] != "undefined") {
return getServerData().vehicles[dataIndex];
}
@@ -502,7 +502,7 @@ function deleteVehicleCommand(command, params, client) {
return false;
}
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
let dataIndex = getEntityData(vehicle, "agrp.dataSlot");
let vehicleName = getVehicleName(vehicle);
quickDatabaseQuery(`UPDATE veh_main SET veh_deleted = 1 WHERE veh_id = ${getVehicleData(vehicle).databaseId}`);
@@ -540,7 +540,7 @@ function vehicleEngineCommand(command, params, client) {
getVehicleData(vehicle).engine = !getVehicleData(vehicle).engine;
vehicle.engine = getVehicleData(vehicle).engine;
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
getVehicleData(vehicle).needsSaved = true;
@@ -666,7 +666,7 @@ function vehicleAdminLiveryCommand(command, params, client) {
getVehicleData(vehicle).livery = livery;
getVehicleData(vehicle).needsSaved = true;
setEntityData(vehicle, "vrr.livery", livery, true);
setEntityData(vehicle, "agrp.livery", livery, true);
forcePlayerToSyncElementProperties(null, vehicle);
meActionToNearbyPlayers(client, `sets the ${getVehicleName(vehicle)}'s livery/paintjob'`);
@@ -700,7 +700,7 @@ function buyVehicleCommand(command, params, client) {
getPlayerData(client).buyingVehicle = vehicle;
getVehicleData(vehicle).engine = true;
vehicle.engine = true;
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true);
getVehicleData(vehicle).needsSaved = true;
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
@@ -771,7 +771,7 @@ function rentVehicleCommand(command, params, client) {
// ===========================================================================
function enterVehicleAsPassengerCommand(command, params, client) {
sendNetworkEventToPlayer("vrr.passenger", client);
sendNetworkEventToPlayer("agrp.passenger", client);
}
// ===========================================================================
@@ -1452,7 +1452,7 @@ function respawnVehicle(vehicle) {
let newVehicle = spawnVehicle(vehicles[i]);
vehicles[i].vehicle = newVehicle;
setEntityData(newVehicle, "vrr.dataSlot", i, false);
setEntityData(newVehicle, "agrp.dataSlot", i, false);
}
}
@@ -1504,10 +1504,10 @@ function spawnVehicle(vehicleData) {
//setVehicleHealth(vehicle, 1000);
repairVehicle(vehicle);
setEntityData(vehicle, "vrr.livery", vehicleData.livery, true);
setEntityData(vehicle, "vrr.upgrades", vehicleData.extras, true);
setEntityData(vehicle, "vrr.interior", vehicleData.interior, true);
setEntityData(vehicle, "vrr.engine", vehicleData.engine, true);
setEntityData(vehicle, "agrp.livery", vehicleData.livery, true);
setEntityData(vehicle, "agrp.upgrades", vehicleData.extras, true);
setEntityData(vehicle, "agrp.interior", vehicleData.interior, true);
setEntityData(vehicle, "agrp.engine", vehicleData.engine, true);
forcePlayerToSyncElementProperties(null, vehicle);
@@ -1593,7 +1593,7 @@ function createNewDealershipVehicle(modelIndex, spawnPosition, spawnRotation, pr
tempVehicleData.dimension = dimension;
let slot = getServerData().vehicles.push(tempVehicleData);
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
}
// ===========================================================================
@@ -1618,7 +1618,7 @@ function createTemporaryVehicle(modelIndex, position, heading, interior = 0, dim
}
let slot = getServerData().vehicles.push(tempVehicleData);
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
return vehicle;
}
@@ -1646,7 +1646,7 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
let slot = getServerData().vehicles.push(tempVehicleData);
if (areServerElementsSupported()) {
setEntityData(vehicle, "vrr.dataSlot", slot - 1, false);
setEntityData(vehicle, "agrp.dataSlot", slot - 1, false);
}