Merge branch 'nightly'

This commit is contained in:
Vortrex
2022-03-07 02:28:57 -06:00
48 changed files with 1005 additions and 486 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -387,5 +387,9 @@
"TimeNotNumber": "The time must be a number",
"HeaderDefaultBusinessItemTypes": "Business Item Templates",
"FixingStuck": "Fixing your position and virtual world ...",
"CantUseCommandYet": "You must wait before you can use this command again!"
"CantUseCommandYet": "You must wait before you can use this command again!",
"NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors"
}

View File

@@ -387,5 +387,9 @@
"TimeNotNumber": "The time must be a number",
"HeaderDefaultBusinessItemTypes": "Business Item Templates",
"FixingStuck": "Fixing your position and virtual world ...",
"CantUseCommandYet": "You must wait before you can use this command again!"
"CantUseCommandYet": "You must wait before you can use this command again!",
"NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors"
}

View File

@@ -387,5 +387,9 @@
"TimeNotNumber": "The time must be a number",
"HeaderDefaultBusinessItemTypes": "Business Item Templates",
"FixingStuck": "Fixing your position and virtual world ...",
"CantUseCommandYet": "You must wait before you can use this command again!"
"CantUseCommandYet": "You must wait before you can use this command again!",
"NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors"
}

View File

@@ -320,71 +320,75 @@
},
"ADDED-21JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
"HeaderPlayerHousesList": "Player Houses ({1})",
"HeaderPlayerStaffFlagsList": "Player Staff Flags ({1})",
"HeaderStaffFlagsList": "Staff Flags",
"NonRPName": "Non-RP name! Choose a new one:",
"InvalidStaffFlag": "Staff flag not found!",
"InvalidClanFlag": "Clan flag not found!",
"InvalidLocale": "Language not found!",
"HeaderJobUniformList": "Job Uniforms ({1})",
"HeaderJobEquipmentList": "Job Equipment ({1})",
"InvalidJobUniform": "Job uniform not found!",
"InvalidJobEquipment": "Job equipment not found!",
"HeaderVehiclesInRangeList": "Vehicles within {1}",
"NoVehiclesWithInRange": "There are no vehicles within {1}",
"AmountNotNumber": "The amount must be a number!",
"NeedToBeWorking": "You need to be working! Use {1} at a job location or near a job vehicle.",
"NeedToBeOnJobRoute": "You need to be doing a job route! Use {1} in a job vehicle",
"CurrentJobRouteDeleted": "The job route you were on has been deleted by an admin",
"CurrentJobRouteVehicleColoursChanged": "Your job route's vehicle colours were changed by an admin",
"NotYourJob": "This is not your job!",
"JobPoints": "You can get a job by going the yellow points on the map.",
"QuitJobToTakeAnother": "If you want this job, use {1} to quit your current job.",
"NotAJobVehicle": "This is not a job vehicle!",
"NotYourJobVehicle": "This is not your job's vehicle!",
"JobRouteDisabled": "The job route you were on has been disabled by an admin",
"HeaderPickupTypes": "Pickup Types",
"HeaderBlipTypes": "Map Icon Types",
"InvalidGPSLocation": "There are no locations with that name or type",
"HeaderBusinessList": "Businesses",
"VehicleForSale": "This {1} is buyable for {2}! Use {3} if you want to buy it",
"VehicleForRent": "This {1} is rentable for {2}! Use {3} if you want to rent it",
"HeaderPlayerHousesList": "Дома Игрока ({1})",
"HeaderPlayerStaffFlagsList": "Флаги игрока персонала ({1})",
"HeaderStaffFlagsList": "Флаги персонала",
"NonRPName": "Ваше имя не подходит для ролевой игры! Выберете другое:",
"InvalidStaffFlag": "Не удалось найти флаг персонала!",
"InvalidClanFlag": "Не удалось найти флаг клана!",
"InvalidLocale": "Не удалось найти язык!",
"HeaderJobUniformList": "Рабочие униформы ({1})",
"HeaderJobEquipmentList": "Рабочие снаряжение ({1})",
"InvalidJobUniform": "Не удалось найти рабочую униформу!",
"InvalidJobEquipment": "Не удалось найти рабочее снаряжение!",
"HeaderVehiclesInRangeList": "Транспорт в пределах {1}",
"NoVehiclesWithInRange": "Нет транспорта в пределах {1}",
"AmountNotNumber": "Количество должно быть введено цифрой!",
"NeedToBeWorking": "Вы должны быть на работе! Используйте {1} на месте работы или возле рабочего транспорта.",
"NeedToBeOnJobRoute": "Вы должны быть на рабочем маршруте! Используйте {1} в рабочем транспорте",
"CurrentJobRouteDeleted": "Рабочий маршрут на котором вы находились был удален администратором",
"CurrentJobRouteVehicleColoursChanged": "Цвет транспорта на маршруте был изменен администратором",
"NotYourJob": "Это работа пренадлежит не вам!",
"JobPoints": "Вы можете устроиться на работу ориентируясь по желтым значкам на карте.",
"QuitJobToTakeAnother": "Если хотите покинуть работу, ипользуйте {1}.",
"NotAJobVehicle": "Это не рабочий транспорт!",
"NotYourJobVehicle": "Этот транспорт пренадлежит не вашей работе!",
"JobRouteDisabled": "Рабочий маршрут на котором вы были был удален администратором",
"HeaderPickupTypes": "Типы подбираемых предметов",
"HeaderBlipTypes": "Типы иконок карты",
"InvalidGPSLocation": "Не существует локаций с таки именем или такого типа",
"HeaderBusinessList": "Бизнесы",
"VehicleForSale": "Этот {1} можно купить за {2}! Используйте {3} если хотите его купить",
"VehicleForRent": "Этот {1} может быть орендован за {2}! Используйте {3} если хотите его орендовать",
"ADDED-31JAN2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
"LoginFailedInvalidPassword": "Invalid password! {1} attempts remaining",
"LoginFailedNoPassword": "You must enter a password! ! {1} attempts remaining",
"RegistrationFailedNoPassword": "You must enter a password!",
"RegistrationFailedNoPasswordConfirm": "You must confirm the password!",
"RegistrationFailedNoEmail": "You must enter an email!",
"AccountNameAlreadyRegistered": "Your name is already registered!",
"AlreadyLoggedIn": "You are already logged in!",
"RegistrationFailedInvalidEmail": "That email is invalid!",
"RegistrationFailedPasswordMismatch": "The passwords don't match!",
"RegistrationFailedCreateError": "Your account couldn't be created!",
"RegistrationSuccess": "Your account has been created!",
"RegistrationEmailVerifyReminder": "Don't forget to verify your email! A verification code has been sent to you.",
"RegistrationCreateCharReminder": "To play on the server, you will need to make a character.",
"NoCharactersGUIMessage": "You have no characters. Would you like to make one?",
"NoCharactersGUIWindowTitle": "No characters",
"NoCharactersChatMessage": "You have no characters. Use {1} to make one.",
"NeedEmailFor2FA": "You need to add your email to your account to use two-factor authentication.",
"NeedEmailVerifiedFor2FA": "You need to verify your email to use two-factor authentication.",
"SetEmailHelpTip": "Use {1} to set your email.",
"VerifyEmailHelpTip": "Use {1} to verify your email.",
"LoginFailedInvalidPassword": "Неправельный пароль! Осталось {1} попыток",
"LoginFailedNoPassword": "Вы должны ввести пароль! Осталось {1} попыток",
"RegistrationFailedNoPassword": "Вы должны ввести пароль!",
"RegistrationFailedNoPasswordConfirm": "Вы должны подтвердить пароль!",
"RegistrationFailedNoEmail": "Вы должны ввести адрес электронной почты!",
"AccountNameAlreadyRegistered": "Ваше имя уже зарегистрировано!",
"AlreadyLoggedIn": "Вы уже вошли!",
"RegistrationFailedInvalidEmail": "Такого адреса не существует!",
"RegistrationFailedPasswordMismatch": "Пароли не совпадают!",
"RegistrationFailedCreateError": "Не удалось создать аккаунт!",
"RegistrationSuccess": "Ваш аккаунт был успешно создан!",
"RegistrationEmailVerifyReminder": "Не забудьте подтвердить ваш электронный адрес, код подверждения был послан вам на электронную почту.",
"RegistrationCreateCharReminder": "Чтобы играть на сервере, вам нужно будет создать персонажа.",
"NoCharactersGUIMessage": "У вас нет персонажей. Не хотите создать?",
"NoCharactersGUIWindowTitle": "Нет персонажей",
"NoCharactersChatMessage": "У вас нет персонажей. Используйте {1} чтобы создать.",
"NeedEmailFor2FA": "Вам нужно добавить ваш адрес электронной почты чтобы использовать двухфакторную аунтентификацию.",
"NeedEmailVerifiedFor2FA": "Вам нужно подтвердить вашу электронную почту чтобы использовать двухфакторную аунтентификацию.",
"SetEmailHelpTip": "Используйте {1} чтобы установить ваш адрес электронной почты.",
"VerifyEmailHelpTip": "Используйте {1} чтобы подтвердить ваш адрес электронной почты.",
"ADDED-13FEB2022": "DO NOT TRANSLATE. This string is just a comment to separate newly added translations.",
"NearbyRadio": "Nearby radio",
"FromRadio": "From radio",
"ToRadio": "To radio",
"NeedToEnterPropertyCommand": "You need to enter the {1} first! Use {2} to enter and exit",
"NeedToEnterPropertyKeyPress": "You need to enter the {1} first! Press {2} to enter and exit",
"InventoryFullCantCarry": "You don't have any space to carry this (full inventory)!",
"NotEnoughCashNeedAmountMore": "You don't have enough money! You need {1} more!",
"AmountMustBeMoreThan": "The amount must be more than {1}!",
"WeaponBanned": "You are not allowed to buy or use weapons!",
"TimeNotNumber": "The time must be a number",
"HeaderDefaultBusinessItemTypes": "Business Item Templates",
"FixingStuck": "Fixing your position and virtual world ...",
"CantUseCommandYet": "You must wait before you can use this command again!"
"NearbyRadio": "Ближайшее радио",
"FromRadio": "Из радио",
"ToRadio": "В радио",
"NeedToEnterPropertyCommand": "Вам нужно сначало ввести {1}! Используйте {2} чтобы выйти",
"NeedToEnterPropertyKeyPress": "Вам нужно сначало ввести {1}! Используйте {2} чтобы выйти",
"InventoryFullCantCarry": "У вас недостаточно места в инвентаре(Инвентарь заполнен)!",
"NotEnoughCashNeedAmountMore": "У вас недостаточно денег! У вас не хватает {1}!",
"AmountMustBeMoreThan": "Количество должно быть больше {1}!",
"WeaponBanned": "Вам нельзя покупать оружие!",
"TimeNotNumber": "Время должно быть назначено цифрой",
"HeaderDefaultBusinessItemTypes": "Шаблоны предметов бизнеса",
"FixingStuck": "Исправляет вашу текущую позицию и виртуальный мир ...",
"CantUseCommandYet": "Подождите некоторое время перед тем как использовать комманду снова!",
"NotATester": "Вы не тестировщик!",
"AccessDenied": "Доступ запрещен",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors"
}

View File

@@ -391,5 +391,9 @@
"TimeNotNumber": "The time must be a number",
"HeaderDefaultBusinessItemTypes": "Business Item Templates",
"FixingStuck": "Fixing your position and virtual world ...",
"CantUseCommandYet": "You must wait before you can use this command again!"
"CantUseCommandYet": "You must wait before you can use this command again!",
"NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors"
}

View File

@@ -9,6 +9,7 @@
<script src="scripts/shared/gamedata.js" type="server" language="javascript" />
<script src="scripts/shared/gamedata.js" type="client" language="javascript" />
<!-- Multiplayer Mod (Wrapped Natives) -->
<script src="scripts/server/native/connected.js" type="server" language="javascript" />
<script src="scripts/client/native/connected.js" type="client" language="javascript" />
@@ -93,6 +94,7 @@
<file type="client" src="files/images/skins/none.png" />
<file type="client" src="files/images/mafiac-logo.png" />
<file type="client" src="files/images/gtac-logo.png" />
<file type="client" src="files/images/server-logo.png" />
<!-- GUI -->
<script src="scripts/client/gui/login.js" type="client" language="javascript" />
@@ -111,11 +113,9 @@
<script src="scripts/client/gui/list.js" type="client" language="javascript" />
<!-- Client Scripts -->
<script src="scripts/client/main.js" type="client" language="javascript" />
<script src="scripts/client/chatbox.js" type="client" language="javascript" />
<script src="scripts/client/afk.js" type="client" language="javascript" />
<script src="scripts/client/animation.js" type="client" language="javascript" />
<script src="scripts/client/content.js" type="client" language="javascript" />
<script src="scripts/client/chatbox.js" type="client" language="javascript" />
<script src="scripts/client/event.js" type="client" language="javascript" />
<script src="scripts/client/gui.js" type="client" language="javascript" />
<script src="scripts/client/item.js" type="client" language="javascript" />
@@ -123,12 +123,13 @@
<script src="scripts/client/keybind.js" type="client" language="javascript" />
<script src="scripts/client/label.js" type="client" language="javascript" />
<script src="scripts/client/logo.js" type="client" language="javascript" />
<script src="scripts/client/main.js" type="client" language="javascript" />
<script src="scripts/client/messaging.js" type="client" language="javascript" />
<script src="scripts/client/mousecam.js" type="client" language="javascript" />
<script src="scripts/client/nametag.js" type="client" language="javascript" />
<script src="scripts/client/radio.js" type="client" language="javascript" />
<script src="scripts/client/server.js" type="client" language="javascript" />
<script src="scripts/client/scoreboard.js" type="client" language="javascript" />
<script src="scripts/client/server.js" type="client" language="javascript" />
<script src="scripts/client/skin-select.js" type="client" language="javascript" />
<script src="scripts/client/sync.js" type="client" language="javascript" />
<script src="scripts/client/utilities.js" type="client" language="javascript" />

View File

@@ -56,14 +56,18 @@ function makePedStopAnimation(pedId) {
return false;
}
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
if(getGame() != VRR_GAME_GTA_IV) {
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
}
if(getElementFromId(pedId) == localPlayer) {
localPlayer.collisionsEnabled = true;
if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.collisionsEnabled = true;
}
setLocalPlayerControlState(true, false);
}
}

View File

@@ -8,7 +8,7 @@
// ===========================================================================
function getCustomImage(imageName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let image = contentResource.exports.getCustomImage(imageName);
@@ -23,7 +23,7 @@ function getCustomImage(imageName) {
// ===========================================================================
function getCustomFont(fontName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let font = contentResource.exports.getCustomFont(fontName);
@@ -38,7 +38,7 @@ function getCustomFont(fontName) {
// ===========================================================================
function getCustomAudio(audioName) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
let audioFile = contentResource.exports.getCustomAudio(audioName);
@@ -53,7 +53,7 @@ function getCustomAudio(audioName) {
// ===========================================================================
function playCustomAudio(audioName, volume = 0.5, loop = false) {
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
if(contentResource != null) {
if(contentResource.isStarted) {
contentResource.exports.playCustomAudio(audioName, volume, loop);

View File

@@ -91,7 +91,7 @@ function initGUI() {
// ===========================================================================
let closeAllWindows = function() {
function closeAllWindows() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing all GUI windows`);
infoDialog.window.shown = false;
yesNoDialog.window.shown = false;
@@ -104,6 +104,7 @@ let closeAllWindows = function() {
listDialog.window.shown = false;
resetPassword.window.shown = false;
passwordChange.window.shown = false;
mexui.setInput(false);
mexui.focusedControl = false;
@@ -116,7 +117,7 @@ let closeAllWindows = function() {
// ===========================================================================
let isAnyGUIActive = function() {
function isAnyGUIActive() {
if(!guiReady) {
return false;
}
@@ -299,14 +300,22 @@ function processGUIKeyPress(keyCode) {
if(guiSubmitKey != false) {
guiSubmitKey();
}
} else if(keyCode == SDLK_LEFT) {
} else if(keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
if(guiLeftKey != false) {
guiLeftKey();
}
} else if(keyCode == SDLK_RIGHT) {
} else if(keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
if(guiRightKey != false) {
guiRightKey();
}
} else if(keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
if(guiDownKey != false) {
guiDownKey();
}
} else if(keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
if(guiUpKey != false) {
guiUpKey();
}
}
}

View File

@@ -16,3 +16,5 @@ let clanManager = {
businessesTab: null,
housesTab: null,
};
// ===========================================================================

View File

@@ -46,7 +46,7 @@ function initErrorDialogGUI() {
},
});
errorDialog.okayButton = errorDialog.window.button(5, 105, 395, 30, 'OK', {
errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),

View File

@@ -45,7 +45,7 @@ function initInfoDialogGUI() {
},
});
infoDialog.okayButton = infoDialog.window.button(5, 105, 395, 30, 'OK', {
infoDialog.okayButton = infoDialog.window.button(5, 105, 390, 30, 'OK', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),

View File

@@ -22,7 +22,7 @@ let login = {
function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
login.window = mexui.window(game.width/2-150, game.height/2-130, 300, 260, 'LOGIN', {
login.window = mexui.window(game.width/2-150, game.height/2-135, 300, 275, 'LOGIN', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -42,7 +42,7 @@ function initLoginGUI() {
login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarHeight = 0;
login.logoImage = login.window.image(5, 20, 290, 80, mainLogoPath, {
login.logoImage = login.window.image(5, 20, 290, 100, mainLogoPath, {
focused: {
borderColour: toColour(0, 0, 0, 0),
},
@@ -169,3 +169,5 @@ function switchToPasswordResetGUI() {
showResetPasswordGUI();
return false;
}
// ===========================================================================

View File

@@ -21,7 +21,7 @@ let newCharacter = {
function initNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'New Character', {
newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'New Character', {
main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500,
@@ -46,7 +46,7 @@ function initNewCharacterGUI() {
},
});
newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
main: {
textSize: 10.0,
textAlign: 0.5,
@@ -58,7 +58,7 @@ function initNewCharacterGUI() {
},
});
newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
@@ -77,7 +77,7 @@ function initNewCharacterGUI() {
});
newCharacter.firstNameInput.placeholder = "First Name";
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
main: {
backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255),
@@ -96,7 +96,7 @@ function initNewCharacterGUI() {
});
newCharacter.lastNameInput.placeholder = "Last Name";
newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255),

View File

@@ -91,3 +91,5 @@ function hideJobRouteLocation() {
jobRouteLocationSphere = null;
jobRouteLocationBlip = null;
}
// ===========================================================================

View File

@@ -52,7 +52,7 @@ function deleteGameElement(element, position) {
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================

View File

@@ -82,6 +82,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
@@ -128,10 +129,12 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
renderHUD = hudState;
if(typeof setHUDEnabled != "undefined") {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayHud(false);
} else {
if(getGame() == VRR_GAME_GTA_IV) {
natives.displayCash(hudState);
natives.displayAmmo(hudState);
natives.displayHud(hudState);
} else {
if(typeof setHUDEnabled != "undefined") {
setHUDEnabled(hudState);
}
}
@@ -298,3 +301,14 @@ function setLocalPlayerInfiniteRun(state) {
}
// ===========================================================================
function setLocalPlayerSkin(skinId) {
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), skinId);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = skinId;
}
}
// ===========================================================================

View File

@@ -53,7 +53,12 @@ function processSkinSelectKeyPress(keyCode) {
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_PAGEDOWN) {
if(skinSelectorIndex <= 0) {
skinSelectorIndex = allowedSkins.length-1;
@@ -62,7 +67,12 @@ function processSkinSelectKeyPress(keyCode) {
}
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
} else if(keyCode == SDLK_RETURN) {
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
toggleSkinSelect(false);
@@ -109,7 +119,13 @@ function toggleSkinSelect(state) {
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
}
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
}
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
setLocalPlayerControlState(false, false);
} else {

View File

@@ -116,7 +116,7 @@ function syncVehicleProperties(vehicle) {
}
if(getGame() == VRR_GAME_GTA_SA) {
let allUpgrades = getGameData().vehicleUpgrades[getGame()];
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
for(let i in allUpgrades) {
vehicle.removeUpgrade(i);
}
@@ -392,3 +392,19 @@ function syncElementProperties(element) {
}
// ===========================================================================
function receiveBlipFromServer(model, position) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// ===========================================================================
function receivePickupFromServer(model, position) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// ===========================================================================

View File

@@ -188,8 +188,10 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
game.SET_PLAYER_CONTROL(localClient.index, boolToInt(controlState));
}
localPlayer.collisionsEnabled = controlState;
localPlayer.invincible = true;
if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.collisionsEnabled = controlState;
localPlayer.invincible = true;
}
}
// ===========================================================================
@@ -283,26 +285,21 @@ function enterVehicleAsPassenger() {
function giveLocalPlayerWeapon(weaponId, ammo, active) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
localPlayer.giveWeapon(weaponId, ammo, active);
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
forceWeapon = weaponId;
}
// ===========================================================================
function giveLocalPlayerWeapon(weaponId, ammo, active) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
if(getGame() == VRR_GAME_MAFIA_ONE) {
localPlayer.giveWeapon(weaponId, 0, ammo);
forceWeaponAmmo = 0;
forceWeaponClipAmmo = ammo;
} else {
localPlayer.giveWeapon(weaponId, ammo, active);
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
if(getGame() < VRR_GAME_GTA_IV) {
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(weaponId));
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(weaponId));
} else {
forceWeaponAmmo = ammo;
forceWeaponClipAmmo = ammo;
}
}
forceWeapon = weaponId;
}
// ===========================================================================
@@ -351,6 +348,9 @@ function setLocalPlayerInterior(interior) {
if(!isGTAIV()) {
localPlayer.interior = interior;
game.cameraInterior = interior;
} else {
let interiorId = natives.getInteriorAtCoords(localPlayer.position);
natives.activateInterior(interiorId, true);
}
}
@@ -618,11 +618,15 @@ function forceLocalPlayerEquippedWeaponItem() {
if(forceWeapon != 0) {
if(localPlayer.weapon != forceWeapon) {
localPlayer.weapon = forceWeapon;
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
if(getGame() <= VRR_GAME_GTA_IV) {
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
}
} else {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
if(getGame() <= VRR_GAME_GTA_IV) {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
}
}
} else {
if(localPlayer.weapon > 0) {
@@ -835,13 +839,13 @@ function setUpInitialGame() {
natives.setPlayersDropMoneyInNetworkGame(false);
natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true);
natives.setDisplayPlayerNameAndIcon(false);
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
natives.removeTemporaryRadarBlipsForPickups();
natives.setPickupsFixCars(false);
natives.displayCash(true);
natives.displayAmmo(true);
natives.displayHud(true);
natives.displayAreaName(true);
natives.displayCash(false);
natives.displayAmmo(false);
natives.displayHud(false);
natives.displayAreaName(false);
natives.setPoliceRadarBlips(false);
natives.requestAnims("DANCING");

View File

@@ -106,7 +106,7 @@ function toggleAccountGUICommand(command, params, client) {
if(!isPlayerLoggedIn(client)) {
if(getPlayerData().accountData.databaseId != 0) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
} else {
@@ -115,7 +115,7 @@ function toggleAccountGUICommand(command, params, client) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
}
} else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
@@ -566,13 +566,31 @@ function loginSuccess(client) {
client.administrator = true;
}
if(doesServerHaveTesterOnlyEnabled()) {
if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
setTimeout(function() {
client.disconnect();
}, 3500);
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
} else {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
}
}
}
if(getPlayerData(client).subAccounts.length == 0) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
showPlayerPromptGUI(client, `You have no characters. Would you like to make one?`, "No characters");
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"));
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
} else {
messagePlayerAlert(client, `You have no characters. Use /newchar to make one.`);
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
}
} else {
@@ -760,7 +778,7 @@ function checkLogin(client, password) {
if(isPlayerLoggedIn(client)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
messagePlayerError(client, "You are already logged in!");
@@ -771,7 +789,7 @@ function checkLogin(client, password) {
if(!isPlayerRegistered(client)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationGUI(client);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
} else {
@@ -783,7 +801,7 @@ function checkLogin(client, password) {
if(areParamsEmpty(password)) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
@@ -799,7 +817,7 @@ function checkLogin(client, password) {
if(!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
logToConsole(LOG_WARN, `[VRR.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginFailedGUI(client, `Invalid password! ${getPlayerData(client).loginAttemptsRemaining} tries remaining.`);
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
} else {
@@ -819,7 +837,7 @@ function checkLogin(client, password) {
// return true;
//}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
}
@@ -836,7 +854,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
logToConsole(LOG_DEBUG, `[VRR.Account]: Checking registration for ${getPlayerName(client)}`);
if(isPlayerRegistered(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginGUI(client);
} else {
messagePlayerError(client, getLocaleString(client, "AlreadyRegistered"));
@@ -846,7 +864,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}
if(isPlayerLoggedIn(client)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerLoginSuccessGUI(client);
} else {
messagePlayerError(client, getLocaleString(client, "AlreadyLoggedIn"));
@@ -856,7 +874,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}
if(areParamsEmpty(password)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPassword"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password is blank)`);
} else {
@@ -866,7 +884,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false;
}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
if(areParamsEmpty(confirmPassword)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordConfirm"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password confirm is blank)`);
@@ -874,7 +892,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}
}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
if(areParamsEmpty(emailAddress)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoEmail"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (email address is blank)`);
@@ -882,7 +900,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}
}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
if(password != confirmPassword) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedPasswordMismatch"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password and confirm don't match)`);
@@ -891,7 +909,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
}
if(!doesPasswordMeetRequirements(password)) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
// Work on this later. Function should return true by default anyway for now.
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedNoPasswordWeak"));
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} failed to create an account (password doesn't meet requirements)`);
@@ -901,7 +919,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
return false
}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
if(!isValidEmailAddress(emailAddress)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedInvalidEmail"));
return false
@@ -910,7 +928,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
let accountData = createAccount(getPlayerName(client), password, emailAddress);
if(!accountData) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationFailedGUI(client, getLocaleString(client, "RegistrationFailedCreateError"));
} else {
messagePlayerAlert(client, getLocaleString(client, "RegistrationFailedCreateError"));
@@ -926,22 +944,36 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
messagePlayerSuccess(client, getLocaleString(client, "RegistrationSuccess"));
if(checkForSMTPModule() && getEmailConfig().enabled) {
messagePlayerAlert(client, getLocaleString(client, "RegistrationEmailVerifyReminder"));
let emailVerificationCode = generateEmailVerificationCode();
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
}
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationSuccessGUI(client);
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
if(doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
setTimeout(function() {
client.disconnect();
}, 5000);
if(checkForSMTPModule() && getEmailConfig().enabled) {
let emailVerificationCode = generateEmailVerificationCode();
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
sendEmailVerificationEmail(client, emailVerificationCode);
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
return false;
} else {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
messagePlayerError(client, getLocaleString(client, "NotATester"));
return false;
}
} else {
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"));
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerRegistrationSuccessGUI(client);
showPlayerPromptGUI(client, getLocaleString(client, "NoCharactersMessage"), getLocaleString(client, "NoCharactersWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_CREATEFIRSTCHAR;
} else {
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage"), `{ALTCOLOUR}/newchar{MAINCOLOUR}`);
}
}
};
@@ -1084,6 +1116,12 @@ function initClient(client) {
return false;
}
if(client.getData("vrr.isInitialized") != null || client.getData("vrr.isInitialized") == true) {
return false;
}
client.setData("vrr.isInitialized", true, false);
sendPlayerGUIColours(client);
sendPlayerGUIInit(client);
updatePlayerSnowState(client);
@@ -1109,7 +1147,7 @@ function initClient(client) {
messagePlayerAlert(client, getLocaleString(client, "AutoLoggedInIP"));
loginSuccess(client);
} else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
showPlayerLoginGUI(client);
} else {
@@ -1119,7 +1157,7 @@ function initClient(client) {
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
}
} else {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
showPlayerRegistrationGUI(client);
} else {
@@ -1454,3 +1492,9 @@ function checkPlayerTwoFactorAuthentication(client, authCode) {
}
// ===========================================================================
function isPlayerATester(client) {
}
// ===========================================================================

View File

@@ -70,7 +70,7 @@ function stopPlayerAnimationCommand(command, params, client) {
// ===========================================================================
function showAnimationListCommand(command, params, client) {
let animList = getGameData().animations[getServerGame()].map(function(x) { return x[0]; });
let animList = getGameConfig().animations[getServerGame()].map(function(x) { return x[0]; });
let chunkedList = splitArrayIntoChunks(animList, 10);
@@ -88,7 +88,7 @@ function showAnimationListCommand(command, params, client) {
* @return {Array} The animation's data (array)
*/
function getAnimationData(animationSlot, gameId = getServerGame()) {
return getGameData().animations[gameId][animationSlot];
return getGameConfig().animations[gameId][animationSlot];
}
// ===========================================================================
@@ -145,13 +145,13 @@ function makePlayerStopAnimation(client) {
function getAnimationFromParams(params) {
if(isNaN(params)) {
for(let i in getGameData().animations[getServerGame()]) {
if(toLowerCase(getGameData().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
for(let i in getGameConfig().animations[getServerGame()]) {
if(toLowerCase(getGameConfig().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().animations[getServerGame()][params] != "undefined") {
if(typeof getGameConfig().animations[getServerGame()][params] != "undefined") {
return toInteger(params);
}
}

View File

@@ -62,7 +62,8 @@ let serverBitFlagKeys = {
"TwoFactorAuthVerified",
"NonRoleplayCharacterName",
"CanHearEverything",
"DontSyncClientElements"
"DontSyncClientElements",
"IsTester"
],
factionFlagKeys: [
"None",
@@ -409,7 +410,7 @@ function getModerationFlagValue(flagName) {
// ===========================================================================
function getServerSettingFlagValue(flagName) {
function getServerSettingsFlagValue(flagName) {
if(flagName == "All") {
return -1;
}

View File

@@ -1336,6 +1336,10 @@ function createAllBusinessBlips() {
// ===========================================================================
function createBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(!getServerConfig().createBusinessPickups) {
return false;
}
@@ -1349,17 +1353,23 @@ function createBusinessEntrancePickup(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
if(areServerElementsSupported()) {
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
}
}
}
// ===========================================================================
function createBusinessEntranceBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(!getServerConfig().createBusinessBlips) {
return false;
}
@@ -1373,10 +1383,12 @@ function createBusinessEntranceBlip(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
addToWorld(getBusinessData(businessId).entranceBlip);
if(areServerElementsSupported()) {
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
addToWorld(getBusinessData(businessId).entranceBlip);
}
}
}
@@ -1397,11 +1409,13 @@ function createBusinessExitPickup(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
if(areServerElementsSupported()) {
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
}
}
}
}
@@ -1421,15 +1435,17 @@ function createBusinessExitBlip(businessId) {
blipModelId = getBusinessData(businessId).exitBlipModel;
}
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
if(areServerElementsSupported()) {
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).exitBlip);
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).exitBlip);
}
}
}
}
@@ -1907,6 +1923,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
// ===========================================================================
function updateBusinessPickupLabelData(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitPickup != null) {
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);

View File

@@ -22,8 +22,6 @@ function initClassScript() {
class ServerData {
constructor(dbAssoc = false) {
this.databaseId = 0;
this.name = "";
this.password = "";
this.needsSaved = false;
this.newCharacter = {
@@ -59,6 +57,8 @@ class ServerData {
this.guiTextColourSecondary = [0, 0, 0];
this.showLogo = true;
this.inflationMultiplier = 1;
this.testerOnly = false;
this.settings = 0;
this.antiCheat = {
enabled: false,
@@ -104,52 +104,47 @@ class ServerData {
bank: dbAssoc["svr_newchar_bank"],
skin: dbAssoc["svr_newchar_skin"],
},
this.settings = toInteger(dbAssoc["svr_settings"]);
this.connectCameraPosition = toVector3(dbAssoc["svr_connectcam_pos_x"], dbAssoc["svr_connectcam_pos_y"], dbAssoc["svr_connectcam_pos_z"]);
this.connectCameraLookAt = toVector3(dbAssoc["svr_connectcam_lookat_x"], dbAssoc["svr_connectcam_lookat_y"], dbAssoc["svr_connectcam_lookat_z"]);
//this.characterSelectCameraPosition = toVector3(dbAssoc["svr_charselect_cam_pos_x"], dbAssoc["svr_charselect_cam_pos_y"], dbAssoc["svr_charselect_cam_pos_z"]);
//this.characterSelectCameraLookAt = toVector3(dbAssoc["svr_charselect_cam_lookat_x"], dbAssoc["svr_charselect_cam_lookat_y"], dbAssoc["svr_charselect_cam_lookat_z"]);
//this.characterSelectPedPosition = toVector3(dbAssoc["svr_charselect_ped_pos_x"], dbAssoc["svr_charselect_ped_pos_y"], dbAssoc["svr_charselect_ped_pos_z"]);
//this.characterSelectPedHeading = toFloat(dbAssoc["svr_charselect_ped_rot_z"]);
//this.characterSelectInterior = toInteger(dbAssoc["svr_charselect_int"]);
//this.characterSelectDimension = toInteger(dbAssoc["svr_charselect_int"]);
this.hour = toInteger(dbAssoc["svr_start_time_hour"]);
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
this.weather = toInteger(dbAssoc["svr_start_weather"]);
this.fallingSnow = intToBool(dbAssoc["svr_start_snow_falling"]);
this.groundSnow = intToBool(dbAssoc["svr_start_snow_ground"]);
this.useGUI = intToBool(dbAssoc["svr_gui"]);
this.fallingSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("FallingSnow"));
this.groundSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("GroundSnow"));
this.useGUI = hasBitFlag(this.settings, getServerSettingsFlagValue("GUI"));
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
this.showLogo = intToBool(dbAssoc["svr_logo"]);
this.showLogo = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
this.testerOnly = hasBitFlag(this.settings, getServerSettingsFlagValue("Testing"));
this.antiCheat = {
enabled: intToBool(dbAssoc["svr_ac_enabled"]),
checkGameScripts: intToBool(dbAssoc["svr_ac_check_scripts"]),
gameScriptBlackListEnabled: intToBool(dbAssoc["svr_ac_script_bl"]),
gameScriptWhiteListEnabled: intToBool(dbAssoc["svr_ac_script_wl"]),
enabled: hasBitFlag(this.settings, getServerSettingsFlagValue("Anticheat")),
checkGameScripts: hasBitFlag(this.settings, getServerSettingsFlagValue("CheckGameScripts")),
gameScriptBlackListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptBlackList")),
gameScriptWhiteListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptWhiteList")),
gameScriptWhiteList: [],
gameScriptBlackList: [],
};
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
this.discordEnabled = intToBool(dbAssoc["svr_discord_bot_enabled"]);
this.discordEnabled = hasBitFlag(this.settings, getServerSettingsFlagValue("DiscordBot"));
this.createJobPickups = intToBool(dbAssoc["svr_job_pickups"]);
this.createBusinessPickups = intToBool(dbAssoc["svr_biz_pickups"]);
this.createHousePickups = intToBool(dbAssoc["svr_house_pickups"]);
this.createJobBlips = intToBool(dbAssoc["svr_job_blips"]);
this.createBusinessBlips = intToBool(dbAssoc["svr_biz_blips"]);
this.createHouseBlips = intToBool(dbAssoc["svr_house_blips"]);
this.createJobPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("JobPickups"));
this.createBusinessPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessPickups"));
this.createHousePickups = hasBitFlag(this.settings, getServerSettingsFlagValue("HousePickups"));
this.createJobBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("JobBlips"));
this.createBusinessBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessBlips"));
this.createHouseBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("HouseBlips"));
this.introMusicURL = dbAssoc["svr_intro_music"];
this.useRealTime = intToBool(dbAssoc["svr_time_realtime_enabled"]);
this.useRealTime = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
this.discordConfig = {

View File

@@ -410,14 +410,14 @@ function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText,
// ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle) {
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);
}
// ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle) {
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.showInfo", client, errorMessage, errorTitle, buttonText);
}
@@ -522,13 +522,6 @@ function sendPlayerFrozenState(client, state) {
// ===========================================================================
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);
}
// ===========================================================================
function clearPlayerWeapons(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
sendNetworkEventToPlayer("vrr.clearWeapons", client);
@@ -1142,3 +1135,15 @@ function setPlayerInfiniteRun(client, state) {
}
// ==========================================================================
function sendBusinessEntranceToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
}
// ==========================================================================
function sendHouseEntranceToPlayer(client, houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
}
// ==========================================================================

View File

@@ -68,12 +68,12 @@ function loadCommands() {
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
],
antiCheat: [
commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
commandData("delacscriptwl", removeAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
commandData("addacscriptbl", addAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
commandData("delacscriptbl", removeAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("Developer"), true, true),
commandData("setacscriptbl", toggleAntiCheatScriptBlackListCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
commandData("setacscriptwl", toggleAntiCheatScriptWhiteListCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
commandData("delacscriptwl", removeAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
commandData("addacscriptbl", addAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
commandData("delacscriptbl", removeAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
commandData("setacscriptbl", toggleAntiCheatScriptBlackListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
commandData("setacscriptwl", toggleAntiCheatScriptWhiteListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
//commandData("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
//commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
],
@@ -183,10 +183,10 @@ function loadCommands() {
commandData("cmddisable", disableCommand, "<command>", getStaffFlagValue("Developer"), true, true, "Disables a specific command"),
],
config: [
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("ManageServer"), true, true, "Sets the time. Hours are required, minute is optional and will default to 0"),
commandData("setminuteduration", setMinuteDurationCommand, "<time in ms>", getStaffFlagValue("ManageServer"), true, true, "Sets how long a minute lasts in milliseconds. 60000 is real time."),
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("ManageServer"), true, true, "Change the weather to specified type."),
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("ManageServer"), true, true, "Toggles winter/snow"),
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("ManageWorld"), true, true, "Sets the time. Hours are required, minute is optional and will default to 0"),
commandData("setminuteduration", setMinuteDurationCommand, "<time in ms>", getStaffFlagValue("ManageWorld"), true, true, "Sets how long a minute lasts in milliseconds. 60000 is real time."),
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("ManageWorld"), true, true, "Change the weather to specified type."),
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("ManageWorld"), true, true, "Toggles winter/snow"),
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("ManageServer"), true, true, "Toggles the corner server logo display on/off"),
commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("ManageServer"), true, true, "Toggles server GUI on/off"),
commandData("setguicolours", setServerGUIColoursCommand, "<red> <green> <blue>", getStaffFlagValue("ManageServer"), true, true),
@@ -229,7 +229,7 @@ function loadCommands() {
commandData("forceresetpass", forceAccountPasswordResetCommand, "<account name>", getStaffFlagValue("Developer"), true, true),
commandData("fixblips", fixAllServerBlipsCommand, "", getStaffFlagValue("Developer"), true, true),
commandData("fixpickups", fixAllServerPickupsCommand, "", getStaffFlagValue("Developer"), true, true),
commandData("resetambience", resetAllServerAmbienceElementsCommand, "", getStaffFlagValue("Developer"), true, true),
commandData("resetambience", resetAllServerAmbienceElementsCommand, "", getStaffFlagValue("ManageWorld"), true, true),
],
discord: [],
economy: [
@@ -335,7 +335,7 @@ function loadCommands() {
commandData("drag", policeDragCommand, "", getStaffFlagValue("None"), true, false),
commandData("search", policeSearchCommand, "", getStaffFlagValue("None"), true, false),
// Bus/Garbage
// Routes
commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("None"), true, false),
commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("None"), true, false),
@@ -381,6 +381,9 @@ function loadCommands() {
],
locale: [
commandData("lang", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
commandData("language", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
commandData("locale", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
commandData("setlang", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
],
messaging: [],
misc: [
@@ -421,14 +424,14 @@ function loadCommands() {
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to a job location by name and location ID."),
commandData("gotoloc", gotoGameLocationCommand, "<location name>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to a game location by name."),
commandData("gotospawn", gotoNewPlayerSpawnCommand, "", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the new player spawn location"),
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you forward a certain distance in meters."),
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you backward a certain distance in meters."),
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the left a certain distance in meters."),
commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the right a certain distance in meters."),
commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you upward a certain distance in meters."),
commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("BasicModeration"), true, true, "Teleports you downward a certain distance in meters."),
commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's game interior."),
commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's virtual world/dimension."),
commandData("fr", teleportForwardCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you forward a certain distance in meters."),
commandData("ba", teleportBackwardCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you backward a certain distance in meters."),
commandData("lt", teleportLeftCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the left a certain distance in meters."),
commandData("rt", teleportRightCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you to the right a certain distance in meters."),
commandData("up", teleportUpCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you upward a certain distance in meters."),
commandData("dn", teleportDownCommand, "[distance in meters]", getStaffFlagValue("BasicModeration"), true, true, "Teleports you downward a certain distance in meters."),
commandData("int", playerInteriorCommand, "<player name/id> [interior id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's game interior."),
commandData("vw", playerVirtualWorldCommand, "<player name/id> [virtual world id]", getStaffFlagValue("BasicModeration"), true, true, "Gets or sets a player's virtual world/dimension."),
commandData("addstaffflag", addStaffFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("ManageAdmins"), true, true, "Gives a player a staff flag by name (this server only)."),
commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("ManageAdmins"), true, true, "Takes a player's staff flag by name (this server only)."),
commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("ManageAdmins"), true, true, "Shows a list of all staff flags a player has (this server only)."),

View File

@@ -7,10 +7,10 @@
// TYPE: Server (JavaScript)
// ===========================================================================
let serverConfig = {};
let databaseConfig = {};
let emailConfig = {};
let gameConfig = {};
let serverConfig = false;
let databaseConfig = false;
let emailConfig = false;
let gameConfig = false;
// ===========================================================================
@@ -75,9 +75,22 @@ let globalConfig = {
// ===========================================================================
function loadGameConfig() {
return gameData;
};
function initConfigScript() {
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading global config ...");
loadGlobalConfig();
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading server config ...");
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
logToConsole(LOG_DEBUG, "[VRR.Config]: Applying server config ...");
applyConfigToServer(serverConfig);
logToConsole(LOG_DEBUG, "[VRR.Config]: All config loaded and applied successfully!");
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
}
// ===========================================================================
@@ -89,19 +102,6 @@ function loadGlobalConfig() {
// ===========================================================================
function initConfigScript() {
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
gameConfig = loadGameConfig();
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
applyConfigToServer(serverConfig);
loadGlobalConfig();
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
}
// ===========================================================================
function loadServerConfigFromGameAndPort(gameId, port, mpMod) {
let dbConnection = connectToDatabase();
if(dbConnection) {
@@ -144,10 +144,12 @@ function loadServerConfigFromId(tempServerId) {
function applyConfigToServer(tempServerConfig) {
if(isTimeSupported()) {
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration)
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
}
if(isWeatherSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
game.forceWeather(tempServerConfig.weather);
}
@@ -162,13 +164,10 @@ function saveServerConfigToDatabase() {
let dbConnection = connectToDatabase();
if(dbConnection) {
let data = [
["svr_logo", boolToInt(getServerConfig().showLogo)],
["svr_gui", boolToInt(getServerConfig().useGUI)],
["svr_settings", toInteger(getServerConfig().settings)],
["svr_start_time_hour", getServerConfig().hour],
["svr_start_time_min", getServerConfig().minute],
["svr_start_weather", getServerConfig().weather],
["svr_start_snow_falling", boolToInt(getServerConfig().fallingSnow)],
["svr_start_snow_ground", boolToInt(getServerConfig().groundSnow)],
["svr_newchar_pos_x", getServerConfig().newCharacter.spawnPosition.x],
["svr_newchar_pos_y", getServerConfig().newCharacter.spawnPosition.y],
["svr_newchar_pos_z", getServerConfig().newCharacter.spawnPosition.z],
@@ -200,16 +199,6 @@ function saveServerConfigToDatabase() {
["svr_charselect_int", getServerConfig().characterSelectInterior],
["svr_charselect_vw", getServerConfig().characterSelectDimension],
["svr_inflation_multiplier", getServerConfig().inflationMultiplier],
["svr_ac_enabled", boolToInt(getServerConfig().antiCheat.enabled)],
["svr_ac_check_scripts", boolToInt(getServerConfig().antiCheat.checkGameScripts)],
["svr_ac_script_wl", boolToInt(getServerConfig().antiCheat.gameScriptWhiteListEnabled)],
["svr_ac_script_bl", boolToInt(getServerConfig().antiCheat.gameScriptBlackListEnabled)],
["svr_job_pickups", boolToInt(getServerConfig().createJobPickups)],
["svr_job_blips", boolToInt(getServerConfig().createJobBlips)],
["svr_biz_pickups", boolToInt(getServerConfig().createBusinessPickups)],
["svr_biz_blips", boolToInt(getServerConfig().createBusinessBlips)],
["svr_house_pickups", boolToInt(getServerConfig().createHousePickups)],
["svr_house_blips", boolToInt(getServerConfig().createHouseBlips)],
["svr_intro_music", getServerConfig().introMusicURL],
];
@@ -230,27 +219,29 @@ function saveServerConfigToDatabase() {
/**
*
* @return {ServerConfigData} - Server configuration data
* @return {ServerData} - Server configuration data
*
*/
function getServerConfig() {
//if(serverId != getServerId()) {
// return loadServerConfigFromId(serverId);
//}
return serverConfig;
}
// ===========================================================================
function getGameConfig() {
return gameConfig;
}
// ===========================================================================
function getGlobalConfig() {
return globalConfig;
}
// ===========================================================================
/**
*
* @return {number} - This server's ID
*
*/
function getServerId() {
return getServerConfig().databaseId;
}
@@ -356,7 +347,7 @@ function setWeatherCommand(command, params, client) {
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameData().weatherNames[getServerGame()][toInteger(weatherId)]}`);
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`);
updateServerRules();
return true;
}
@@ -447,7 +438,7 @@ function toggleServerLogoCommand(command, params, client) {
updatePlayerShowLogoState(null, getServerConfig().useLogo);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(getServerConfig().useLogo)}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
updateServerRules();
return true;
}
@@ -467,7 +458,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createJobBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
resetAllJobBlips();
return true;
}
@@ -487,7 +478,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createJobPickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
resetAllJobPickups();
return true;
}
@@ -507,7 +498,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
resetAllBusinessBlips();
return true;
}
@@ -527,7 +518,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createBusinessPickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
resetAllBusinessPickups();
return true;
}
@@ -547,7 +538,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHouseBlips)}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
resetAllHouseBlips();
return true;
}
@@ -567,7 +558,7 @@ function toggleServerLogoCommand(command, params, client) {
getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(getServerConfig().createHousePickups)}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
resetAllHousePickups();
return true;
}
@@ -584,10 +575,11 @@ function toggleServerLogoCommand(command, params, client) {
*
*/
function toggleServerGUICommand(command, params, client) {
getServerConfig().useGUI = !getServerConfig().useGUI;
getServerConfig().useGUI = !getServerConfig().useGUI;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(getServerConfig().useGUI))} for this server`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`);
updateServerRules();
return true;
}
@@ -604,10 +596,11 @@ function toggleServerGUICommand(command, params, client) {
*
*/
function toggleServerUseRealWorldTimeCommand(command, params, client) {
getServerConfig().useRealTime = !getServerConfig().useRealTime;
getServerConfig().useRealTime = !getServerConfig().useRealTime;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(getServerConfig().useRealTime))} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
updateServerGameTime();
updateServerRules();
return true;
@@ -738,3 +731,69 @@ function loadAccentConfig() {
}
// ===========================================================================
function doesServerHaveGUIEnabled() {
return getServerConfig().useGUI;
}
// ===========================================================================
function doesServerHaveTesterOnlyEnabled() {
return getServerConfig().testerOnly;
}
// ===========================================================================
function doesServerHaveRealTimeEnabled() {
return getServerConfig().useRealTime;
}
// ===========================================================================
function doesServerHaveBusinessPickupsEnabled() {
return getServerConfig().createBusinessPickups
}
// ===========================================================================
function doesServerHaveHousePickupsEnabled() {
return getServerConfig().createHousePickups;
}
// ===========================================================================
function doesServerHaveJobPickupsEnabled() {
return getServerConfig().createJobPickups;
}
// ===========================================================================
function doesServerHaveBusinesBlipsEnabled() {
return getServerConfig().createBusinessBlips;
}
// ===========================================================================
function doesServerHaveHouseBlipsEnabled() {
return getServerConfig().createHouseBlips;
}
// ===========================================================================
function doesServerHaveJobBlipsEnabled() {
return getServerConfig().createJobBlips;
}
// ===========================================================================
function doesServerHaveFallingSnowEnabled() {
return getServerConfig().fallingSnow;
}
// ===========================================================================
function doesServerHaveGroundSnowEnabled() {
return getServerConfig().groundSnow;
}
// ===========================================================================

View File

@@ -9,7 +9,7 @@
let scriptVersion = "1.0";
let serverStartTime = 0;
let logLevel = LOG_ERROR|LOG_WARN|LOG_INFO;
let logLevel = LOG_DEBUG;
// ===========================================================================

View File

@@ -341,7 +341,7 @@ function executeClientCodeCommand(command, params, client) {
let targetCode = splitParams.slice(1).join(" ");
if(!targetClient) {
messagePlayerError(client, "That player was not found!");
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
return false;
}
@@ -359,6 +359,33 @@ function executeClientCodeCommand(command, params, client) {
// ===========================================================================
function setPlayerTesterStatusCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let targetClient = getPlayerFromParams(params);
if(!targetClient) {
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
return false;
}
if(!hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"))) {
getPlayerData(targetClient).accountData.flags.moderation = addBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
} else {
getPlayerData(targetClient).accountData.flags.moderation = removeBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
}
let enabled = hasBitFlag(getPlayerData(targetClient).accountData.flags.moderation, getModerationFlagValue("IsTester"));
messageAdminAction(`{ALTCOLOUR}${client.name} ${getBoolRedGreenInlineColour(enabled)}${toUpperCase(getEnabledDisabledFromBool(enabled))} {ALTCOLOUR}${targetClient.name}'s {MAINCOLOUR}tester status`)
return true;
}
// ===========================================================================
function saveAllServerDataCommand(command, params, client) {
messageAdmins(`{clanOrange}Vortrex has forced a manual save of all data. Initiating ...`);
saveAllServerDataToDatabase();

View File

@@ -408,7 +408,7 @@ function onPlayerDeath(client, position) {
client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
spawnPlayer(client, closestJail.position, closestJail.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);
@@ -421,7 +421,7 @@ function onPlayerDeath(client, position) {
client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0);

View File

@@ -99,7 +99,7 @@ function playerPromptAnswerYes(client) {
// ===========================================================================
function canPlayerUseGUI(client) {
return (getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client));
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
}
// ===========================================================================

View File

@@ -873,11 +873,13 @@ function createHouseEntrancePickup(houseId) {
pickupModelId = getHouseData(houseId).entrancePickupModel;
}
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
addToWorld(getHouseData(houseId).entrancePickup);
if(areServerElementsSupported()) {
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
addToWorld(getHouseData(houseId).entrancePickup);
}
updateHousePickupLabelData(houseId);
}
}
@@ -895,14 +897,16 @@ function createHouseEntranceBlip(houseId) {
blipModelId = getHouseData(houseId).entranceBlipModel;
}
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
if(areServerElementsSupported()) {
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
//getHouseData(houseId).entranceBlip.streamInDistance = 300;
//getHouseData(houseId).entranceBlip.streamOutDistance = 350;
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
}
}
}
@@ -921,11 +925,13 @@ function createHouseExitPickup(houseId) {
pickupModelId = getHouseData(houseId).exitPickupModel;
}
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
updateHousePickupLabelData(houseId);
addToWorld(getHouseData(houseId).exitPickup);
if(areServerElementsSupported()) {
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
addToWorld(getHouseData(houseId).exitPickup);
}
updateHousePickupLabelData(houseId);
}
}
}
@@ -945,12 +951,14 @@ function createHouseExitBlip(houseId) {
blipModelId = getHouseData(houseId).exitBlipModel;
}
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
if(areServerElementsSupported()) {
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
}
}
}
}
@@ -1403,6 +1411,10 @@ function getHouseFromParams(params) {
// ===========================================================================
function updateHousePickupLabelData(houseId) {
if(!areServerElementsSupported()) {
return false;
}
let houseData = getHouseData(houseId);
if(houseData.entrancePickup != null) {

View File

@@ -1264,9 +1264,9 @@ function deleteItem(itemId) {
ownerTypeString = "Player";
owner = getPlayerFromCharacterId(getItemData(itemId).ownerId);
if(getPlayerData(owner) != false) {
switchPlayerActiveHotBarSlot(getPlayerData(owner), -1);
switchPlayerActiveHotBarSlot(owner, -1);
getPlayerData(owner).hotBarItems[getPlayerData(owner).hotBarItems.indexOf(itemId)] = -1;
updatePlayerHotBar(getPlayerData(owner));
updatePlayerHotBar(owner);
}
break;
@@ -1732,7 +1732,7 @@ function getItemValueDisplay(itemType, value) {
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_WALKIETALKIE) {
return toString(toString(value).slice(0,-2)+"."+toString(value).slice(-1)+"MHz");
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_VEHCOLOUR) {
return `[${getGameData().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
return `[${getGameConfig().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
} else {
return value;
}

View File

@@ -962,8 +962,8 @@ function createJob(name) {
tempJobData.name = name;
tempJobData.enabled = true;
tempJobData.needsSaved = true;
tempJobData.blipModel = getGameData().blipSprites[getGame()].job;
tempJobData.pickupModel = getGameData().pickupModels[getGame()].job;
tempJobData.blipModel = getGameConfig().blipSprites[getGame()].job;
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
getServerData().jobs.push(tempJobData);
saveJobToDatabase(tempJobData);

View File

@@ -6,3 +6,159 @@
// DESC: Provides police officer job functions and usage
// TYPE: Job (JavaScript)
// ===========================================================================
function policeTazerCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================
function policeCuffCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================
function policeArrestCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================
function policeSearchCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================
function policeDragCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================
function policeDetainCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use jobs.");
return false;
}
if(!canPlayerUsePoliceJob(client)) {
messagePlayerError(client, "You are not allowed to use the police job.");
return false;
}
if(!isPlayerWorking(client)) {
messagePlayerError(client, "You are not working! Use /startwork first.");
return false;
}
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
messagePlayerError(client, "You don't have a police job.");
return false;
}
return true;
}
// ===========================================================================

View File

@@ -163,13 +163,13 @@ function messagePlayerWhisper(client, whisperingClient, messageText) {
// ===========================================================================
function messagePlayerShout(client, shoutingClient, messageText) {
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
}
// ===========================================================================
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
function messagePlayerShout(client, shoutingClient, messageText) {
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
}

View File

@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
let isEntrance = false;
let isBusiness = false;
if(!getPlayerData(client).currentPickup) {
return false;
}
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
switch(ownerType) {
case VRR_PICKUP_BUSINESS_ENTRANCE:
isBusiness = true;
isEntrance = true;
closestProperty = getServerData().businesses[ownerId];
break;
case VRR_PICKUP_BUSINESS_EXIT:
isBusiness = true;
isEntrance = false;
closestProperty = getServerData().businesses[ownerId];
break;
case VRR_PICKUP_HOUSE_ENTRANCE:
isBusiness = false;
isEntrance = true;
closestProperty = getServerData().houses[ownerId];
break;
case VRR_PICKUP_HOUSE_EXIT:
isBusiness = false;
isEntrance = false;
closestProperty = getServerData().houses[ownerId];
break;
default:
if(areServerElementsSupported()) {
if(!getPlayerData(client).currentPickup) {
return false;
}
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
switch(ownerType) {
case VRR_PICKUP_BUSINESS_ENTRANCE:
isBusiness = true;
isEntrance = true;
closestProperty = getServerData().businesses[ownerId];
break;
case VRR_PICKUP_BUSINESS_EXIT:
isBusiness = true;
isEntrance = false;
closestProperty = getServerData().businesses[ownerId];
break;
case VRR_PICKUP_HOUSE_ENTRANCE:
isBusiness = false;
isEntrance = true;
closestProperty = getServerData().houses[ownerId];
break;
case VRR_PICKUP_HOUSE_EXIT:
isBusiness = false;
isEntrance = false;
closestProperty = getServerData().houses[ownerId];
break;
default:
return false;
}
} else {
for(let i in getServerData().businesses) {
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
isBusiness = true;
isEntrance = true;
closestProperty = getServerData().businesses[businessId];
} else {
let businessId = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
isBusiness = true;
isEntrance = false;
closestProperty = getServerData().businesses[businessId];
}
}
for(let j in getServerData().houses) {
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
let houseId = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
isBusiness = false;
isEntrance = true;
closestProperty = getServerData().businesses[houseId];
} else {
let houseId = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
isBusiness = false;
isEntrance = false;
closestProperty = getServerData().businesses[houseId];
}
}
}
if(closestProperty == null) {
@@ -451,7 +481,7 @@ function gpsCommand(command, params, client) {
} else {
let gameLocationId = getGameLocationFromParams(params);
if(gameLocationId != false) {
position = getGameData().locations[getServerGame()][gameLocationId][1]
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
}
}
}
@@ -548,8 +578,8 @@ function stuckPlayerCommand(command, params, client) {
}
} else {
setPlayerDimension(client, 1);
setPlayerDimension(client, getGameData().mainWorldDimension[getGame()]);
setPlayerInterior(client, getGameData().mainWorldInterior[getGame()]);
setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
}

View File

@@ -195,8 +195,12 @@ function removePlayerFromVehicle(client) {
// ===========================================================================
function setPlayerSkin(client, skinIndex) {
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameData().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameData().skins[getGame()][skinIndex][1]})`);
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0];
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]);
} else {
client.player.modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
}
}
// ===========================================================================
@@ -413,7 +417,7 @@ function createGameObject(modelIndex, position) {
if(!isGameFeatureSupported("objects")) {
return false;
}
return game.createObject(getGameData().objects[getGame()][modelIndex][0], position);
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
}
// ===========================================================================
@@ -435,7 +439,7 @@ function destroyGameElement(element) {
// ===========================================================================
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
return (getGameData().meleeWeapons[gameId].indexOf(weaponId) != -1);
return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
}
// ===========================================================================
@@ -523,7 +527,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================
@@ -574,7 +578,7 @@ function setPlayerFightStyle(client, fightStyleId) {
return false;
}
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameData().fightStyles[getServerGame()][fightStyleId][1][0], getGameData().fightStyles[getServerGame()][fightStyleId][1][1]]);
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getServerGame()][fightStyleId][1][0], getGameConfig().fightStyles[getServerGame()][fightStyleId][1][1]]);
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
}
@@ -1010,3 +1014,10 @@ 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);
}
// ===========================================================================

View File

@@ -374,19 +374,19 @@ function gotoGameLocationCommand(command, params, client) {
}
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0));
setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
setPlayerInterior(client, 0);
setPlayerDimension(client, 0);
updateInteriorLightsForPlayer(client, true);
//setTimeout(function() {
// setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
// setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
// setPlayerInterior(client, 0);
// setPlayerDimension(client, 0);
// updateInteriorLightsForPlayer(client, true);
//}, 500);
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameData().locations[getServerGame()][gameLocationId][0]}`);
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameConfig().locations[getServerGame()][gameLocationId][0]}`);
}
// ===========================================================================
@@ -1003,20 +1003,24 @@ function forcePlayerSkinCommand(command, params, client) {
let targetClient = getPlayerFromParams(splitParams[0]);
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
console.warn(targetClient.name);
console.warn(splitParams.slice(1).join(" "));
console.warn(skinIndex);
if(!targetClient) {
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
return false;
}
if(!skinIndex) {
messagePlayerError(client, "That skin is invalid!");
if(skinIndex == false) {
messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
return false;
}
getPlayerCurrentSubAccount(targetClient).skin = skinIndex;
setPlayerSkin(targetClient, skinIndex);
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
}
// ===========================================================================
@@ -1112,7 +1116,7 @@ function forcePlayerWantedLevelCommand(command, params, client) {
forcePlayerWantedLevel(targetClient, wantedLevel);
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
}
// ===========================================================================

View File

@@ -40,11 +40,12 @@ function initServerScripts() {
initLocaleScript();
initCommandScript();
initTimers();
serverStartTime = getCurrentUnixTimestamp();
initAllClients();
initTimers();
}
// ===========================================================================

View File

@@ -231,13 +231,13 @@ function showCharacterSelectToClient(client) {
}
}
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
getPlayerData(client).currentSubAccount = 0;
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
let tempSubAccount = getPlayerData(client).subAccounts[0];
let ClanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
//spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
//setTimeout(function() {
@@ -290,10 +290,10 @@ function checkNewCharacter(client, firstName, lastName) {
let subAccountData = createSubAccount(getPlayerData(client).accountData.databaseId, firstName, lastName);
if(!subAccountData) {
if(getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client)) {
if(doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
showPlayerNewCharacterFailedGUI(client, "Your character could not be created!");
} else {
messagePlayerAlert(client, "Your character could not be created!");
messagePlayerError(client, "Your character could not be created!");
}
messagePlayerAlert(client, `${getServerName()} staff have been notified of the problem and will fix it soon.`);
return false;
@@ -321,7 +321,7 @@ function checkPreviousCharacter(client) {
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
}
@@ -342,7 +342,7 @@ function checkNextCharacter(client) {
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
}
@@ -371,10 +371,12 @@ function selectCharacter(client, characterId = -1) {
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
if(getGame() < VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else {
spawnPlayer(client, getGameData().skins[getGame()][skin][0], spawnPosition, spawnHeading);
if(getGame() < VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else if(getGame() == VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
}
removePlayerKeyBind(client, getKeyIdFromParams("insert"));
@@ -515,7 +517,7 @@ function setFightStyleCommand(command, params, client) {
if(!fightStyle) {
messagePlayerError(client, `That fight style doesn't exist!`);
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
return false;
}
@@ -527,7 +529,7 @@ function setFightStyleCommand(command, params, client) {
}
setPlayerFightStyle(client, fightStyleId);
messagePlayerSuccess(client, `Your fight style has been set to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
messagePlayerSuccess(client, `Your fight style has been set to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
return true;
}
@@ -560,13 +562,13 @@ function forceFightStyleCommand(command, params, client) {
if(!fightStyleId) {
messagePlayerError(client, `That fight style doesn't exist!`);
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
return false;
}
getPlayerCurrentSubAccount(client).fightStyle = fightStyleId;
setPlayerFightStyle(client, fightStyleId);
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
return true;
}

View File

@@ -11,14 +11,6 @@ let serverTimers = {};
// ===========================================================================
function updateTimeRule() {
if(isTimeSupported()) {
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
}
}
// ===========================================================================
function saveAllServerDataToDatabase() {
if(getServerConfig().pauseSavingToDatabase) {
return false;
@@ -188,7 +180,7 @@ function updatePings() {
// ===========================================================================
function checkServerGameTime() {
if(!getServerConfig().useRealTime) {
//if(!getServerConfig().useRealTime) {
if(getServerConfig().minute >= 59) {
getServerConfig().minute = 0;
if(getServerConfig().hour >= 23) {
@@ -199,11 +191,11 @@ function checkServerGameTime() {
} else {
getServerConfig().minute = getServerConfig().minute + 1;
}
} else {
let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
getServerConfig().hour = dateTime.getHours();
getServerConfig().minute = dateTime.getMinutes();
}
//} else {
// let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
// getServerConfig().hour = dateTime.getHours();
// getServerConfig().minute = dateTime.getMinutes();
//}
updateTimeRule();
}

View File

@@ -52,7 +52,7 @@ function getAreaName(position) {
// ===========================================================================
function getGameAreas(gameId) {
return getGameData().areas[gameId];
return getGameConfig().areas[gameId];
}
// ===========================================================================
@@ -79,30 +79,46 @@ function initAllClients() {
// ===========================================================================
function updateServerRules() {
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
if(isTimeSupported()) {
server.setRule("Time", makeReadableTime(getServerConfig().hour, getServerConfig().minute));
if(getServerConfig() != false) {
let value = makeReadableTime(getServerConfig().hour, getServerConfig().minute);
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Time" as ${value}`);
server.setRule("Time", value);
}
}
if(isWeatherSupported()) {
server.setRule("Weather", getGameData().weatherNames[getServerGame()][getServerConfig().weather]);
if(getServerConfig() != false) {
let value = getGameConfig().weatherNames[getServerGame()][getServerConfig().weather];
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Weather" as ${value}`);
server.setRule("Weather", value);
}
}
if(isSnowSupported()) {
server.setRule("Snowing", getYesNoFromBool(getServerConfig().fallingSnow));
if(getServerConfig() != false) {
let value = getYesNoFromBool(getServerConfig().fallingSnow);
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Snowing" as ${value}`);
server.setRule("Snowing", value);
}
}
logToConsole(LOG_DEBUG, `[VRR.Utilities]: All server rules updated successfully!`);
}
// ===========================================================================
function getWeatherFromParams(params) {
if(isNaN(params)) {
for(let i in getGameData().weatherNames[getServerGame()]) {
if(toLowerCase(getGameData().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
for(let i in getGameConfig().weatherNames[getServerGame()]) {
if(toLowerCase(getGameConfig().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") {
if(typeof getGameConfig().weatherNames[getServerGame()][params] != "undefined") {
return toInteger(params);
}
}
@@ -114,13 +130,13 @@ function getWeatherFromParams(params) {
function getFightStyleFromParams(params) {
if(isNaN(params)) {
for(let i in getGameData().fightStyles[getServerGame()]) {
if(toLowerCase(getGameData().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
for(let i in getGameConfig().fightStyles[getServerGame()]) {
if(toLowerCase(getGameConfig().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().fightStyles[getServerGame()][params] != "undefined") {
if(typeof getGameConfig().fightStyles[getServerGame()][params] != "undefined") {
return toInteger(params);
}
}
@@ -132,26 +148,26 @@ function getFightStyleFromParams(params) {
function getClosestHospital(position) {
let closest = 0;
for(let i in getGameData().hospitals[getServerGame()]) {
if(getDistance(getGameData().hospitals[getServerGame()][i].position, position) < getDistance(getGameData().hospitals[getServerGame()][closest].position, position)) {
for(let i in getGameConfig().hospitals[getServerGame()]) {
if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
closest = i;
}
}
return getGameData().hospitals[getServerGame()][closest];
return getGameConfig().hospitals[getServerGame()][closest];
}
// ===========================================================================
function getClosestPoliceStation(position) {
let closest = 0;
for(let i in getGameData().policeStations[getServerGame()]) {
if(getDistance(getGameData().policeStations[getServerGame()][i].position, position) < getDistance(getGameData().policeStations[getServerGame()][closest].position, position)) {
for(let i in getGameConfig().policeStations[getServerGame()]) {
if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
closest = i;
}
}
return getGameData().policeStations[getServerGame()][closest];
return getGameConfig().policeStations[getServerGame()][closest];
}
// ===========================================================================
@@ -190,8 +206,8 @@ function getPlayerIsland(client) {
// ===========================================================================
function isAtPayAndSpray(position) {
for(let i in getGameData().payAndSprays[getServerGame()]) {
if(getDistance(position, getGameData().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
for(let i in getGameConfig().payAndSprays[getServerGame()]) {
if(getDistance(position, getGameConfig().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
return true;
}
}
@@ -432,3 +448,11 @@ function kickAllClients() {
}
// ===========================================================================
function updateTimeRule() {
if(isTimeSupported()) {
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
}
}
// ===========================================================================

View File

@@ -33,7 +33,7 @@ const VRR_WEAPON_DAMAGE_EVENT_MACE = 4;
const VRR_GAME_GTA_III = 1;
const VRR_GAME_GTA_VC = 2;
const VRR_GAME_GTA_SA = 3;
const VRR_GAME_GTA_IV = 4;
const VRR_GAME_GTA_IV = 5;
const VRR_GAME_GTA_V = 50;
const VRR_GAME_MAFIA_ONE = 10;
const VRR_GAME_MAFIA_TWO = 11;

View File

@@ -1255,15 +1255,15 @@ let gameData = {
[-1084007777,"Triad Member 3," , true],
[-164935626 ,"Triad Member 4," , true],
[-751071255 ,"Female Maid" , true],
[-109247258 ,"Female Binco Worker" , true],
[-109247258 ,"Female Binco Worker" , false],
[ 1366257926,"Female Bank Teller" , true],
[ 346338575 ,"Female Doctor" , true],
[ 1350216795,"Female Gym Worker" , true],
[ 924926104 ,"Female Burger Shot Worker" , true],
[-346378101 ,"Female Cluckin Bell Worker" , true],
[-2104311883,"Female Rockstar Cafe Worker" , true],
[ 212900845 ,"Female TW@ Cafe Worker" , true],
[-290070895 ,"Female Well Stacked Pizza Worker", true],
[ 924926104 ,"Female Burger Shot Worker" , false],
[-346378101 ,"Female Cluckin Bell Worker" , false],
[-2104311883,"Female Rockstar Cafe Worker" , false],
[ 212900845 ,"Female TW@ Cafe Worker" , false],
[-290070895 ,"Female Well Stacked Pizza Worker", false],
[ 552542187 ,"Hooker" , true],
[ 996267216 ,"Hooker 2," , true],
[-1193778389,"Nurse" , true],
@@ -1271,8 +1271,8 @@ let gameData = {
[ 1353709999,"Stripper 2," , true],
[ 24233425 ,"Waitress" , true],
[-1761003415,"Alcoholic Man" , true],
[ 1075583233,"Armoured Truck Driver" , true],
[ 134077503 ,"Bus Driver" , true],
[ 1075583233,"Armoured Truck Driver" , false],
[ 134077503 ,"Bus Driver" , false],
[ 757349871 ,"Generic Asian Man" , true],
[-1827421800,"Black Crackhead" , true],
[ 219393781 ,"Doctor (Scrubs)" , true],
@@ -1281,10 +1281,10 @@ let gameData = {
[ 2105015949,"Cook" , true],
[-200234085 ,"Italian Mob Enforcer" , true],
[ 800131009 ,"Factory Worker" , true],
[-999506922 ,"FIB Agent" , true],
[-999506922 ,"FIB Agent" , false],
[-1993909080,"Fat Delivery Driver" , true],
[ 610888851 ,"Fire Chief" , true],
[ 486302863 ,"Mercenary Soldier" , true],
[ 610888851 ,"Fire Chief" , false],
[ 486302863 ,"Mercenary Soldier" , false],
[-778316080 ,"Helicopter Pilot" , false],
[ 624314380 ,"Hotel Doorman" , true],
[-1784833142,"Korean Cook" , true],
@@ -1295,7 +1295,7 @@ let gameData = {
[ 807236245 ,"Generic Man" , true],
[-284362863 ,"Postal Worker" , true],
[-1188246269,"Saxophone Player" , true],
[-1870989171,"Security Guard" , true],
[-1870989171,"Security Guard" , false],
[ 420915580 ,"Stadium Food Vendor" , true],
[ 1878085135,"Stadium Food Cook" , true],
[ 142730876 ,"Street Food Vendor" , true],
@@ -1309,7 +1309,7 @@ let gameData = {
[-1284047560,"Janitor" , true],
[ 22944263 ,"Hotel Doorman 2," , true],
[ 1178487645,"Mob Boss" , true],
[-1464712858,"Airport Worker" , true],
[-1464712858,"Airport Worker" , false],
[-2139064254,"Bartender" , true],
[-1780698891,"Biker Bouncer" , true],
[-409283472 ,"High End Club Bouncer" , true],
@@ -1343,9 +1343,9 @@ let gameData = {
[ 501136335 ,"Generic Male 1," , true],
[ 186619473 ,"Generic Male 2," , true],
[-111611196 ,"Generic Male 3," , true],
[-1175077216,"Paramedic" , true],
[-1676937780,"Prisoner" , true],
[ 215190023 ,"Prisoner 2," , true],
[-1175077216,"Paramedic" , false],
[-1676937780,"Prisoner" , false],
[ 215190023 ,"Prisoner 2," , false],
[ 1552970117,"Roman's Taxi Service Driver" , true],
[-1481923910,"Male Runner" , true],
[ 357919731 ,"Male Shop Assistant 1," , true],
@@ -1493,7 +1493,7 @@ let gameData = {
[-1927496394,"Street Punk 2," , true],
[ 1374242512,"Street Punk 3," , true],
[-1139941790,"Tough Guy" , true],
[ 809067472 ,"Male Tourist" ,false]
[ 809067472 ,"Male Tourist" , true]
],
[], // GTA IV EFLC
[], // Unknown
@@ -2849,7 +2849,7 @@ let gameData = {
["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087, null],
["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621, null],
["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568, null],
["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569, null],
["Middle Park East Police Station", [50.12, 679.88, 15.316], 1.569, null],
["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127, null],
["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501, null],
["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200, null],
@@ -3488,6 +3488,24 @@ let gameData = {
{
// GTA Underground
},
{ // GTA IV
PoliceStation: -1,
FireStation: -1,
Hospital: -1,
Ammunation: -1,
PayAndSpray: -1,
VehicleDealership: -1,
Restaurant: -1,
FastFood: -1,
Bank: -1,
FuelStation: -1,
Business: -1,
House: -1,
Clothes: -1,
Misc: -1,
Exit: -1,
Job: -1,
}
],
pickupTypes: [
{},
@@ -3517,6 +3535,17 @@ let gameData = {
clothes: 1,
info: 1,
job: 1,
},
{
// GTA Underground
},
{ // GTA IV
business: -1,
house: -1,
bank: -1,
clothes: -1,
info: -1,
job: -1,
}
],
@@ -3977,7 +4006,7 @@ let gameData = {
},
{}, // GTA UG
{ // GTA IV
clothingStore: [
ClothingStore: [
["Outfit", 500, 2]
],
LegalGunStore: [
@@ -5380,6 +5409,22 @@ let gameData = {
0, // Mafia 3
0, // Mafia Definitive Edition
],
mainWorldInterior: [
0, // Invalid
0, // GTA 3
0, // GTA VC
0, // GTA SA
0, // GTA UG
0, // GTA IV
0, // GTA IV EFLC
0, // Invalid
0, // Invalid
0, // Invalid
0, // Mafia 1
0, // Mafia 2
0, // Mafia 3
0, // Mafia Definitive Edition
],
};
// ===========================================================================

View File

@@ -1125,6 +1125,10 @@ let serverEmoji = [
// ===========================================================================
function getGameConfig() {
return gameData;
}
// ===========================================================================
function makeLargeNumberReadable(num) {
@@ -1537,13 +1541,7 @@ function isGameFeatureSupported(featureName) {
// ===========================================================================
function getAllowedSkins(gameId = getGame()) {
return getGameData().skins[gameId].filter(skin => skin[2] == true);
}
// ===========================================================================
function getGameData() {
return gameData;
return getGameConfig().skins[gameId].filter(skin => skin[2] == true);
}
// ===========================================================================
@@ -1561,7 +1559,7 @@ function getAllowedSkinIndexFromSkin(skin) {
// ===========================================================================
function getSkinIndexFromModel(model, gameId = getGame()) {
let skins = getGameData().skins[gameId];
let skins = getGameConfig().skins[gameId];
for(let i in skins) {
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
return i;
@@ -1574,7 +1572,7 @@ function getSkinIndexFromModel(model, gameId = getGame()) {
// ===========================================================================
function getSkinIndexFromName(name, gameId = getGame()) {
let skins = getGameData().skins[gameId];
let skins = getGameConfig().skins[gameId];
for(let i in skins) {
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
return i;
@@ -1587,7 +1585,7 @@ function getSkinIndexFromName(name, gameId = getGame()) {
// ===========================================================================
function getObjectModelIndexFromModel(model, gameId = getGame()) {
let objects = getGameData().objects[gameId];
let objects = getGameConfig().objects[gameId];
for(let i in objects) {
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
return i;
@@ -1600,7 +1598,7 @@ function getObjectModelIndexFromModel(model, gameId = getGame()) {
// ===========================================================================
function getGameName(gameId = getGame()) {
return getGameData().gameNames[gameId];
return getGameConfig().gameNames[gameId];
}
// ===========================================================================
@@ -1623,7 +1621,7 @@ function getVehicleModelIndexFromParams(params, gameId = getGame()) {
// ===========================================================================
function getVehicleModelIndexFromName(name, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId];
let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) {
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
return i;
@@ -1636,7 +1634,7 @@ function getVehicleModelIndexFromName(name, gameId = getGame()) {
// ===========================================================================
function getVehicleModelIndexFromModel(model, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId];
let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) {
if(isNaN(model)) {
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
@@ -1655,7 +1653,7 @@ function getVehicleModelIndexFromModel(model, gameId = getGame()) {
// ===========================================================================
function getVehicleModelFromName(name, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId];
let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) {
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
return vehicles[i][0];
@@ -1668,7 +1666,7 @@ function getVehicleModelFromName(name, gameId = getGame()) {
// ===========================================================================
function getVehicleNameFromModel(model, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId];
let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) {
if(isNaN(model)) {
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
@@ -1686,7 +1684,7 @@ function getVehicleNameFromModel(model, gameId = getGame()) {
// ===========================================================================
function getSkinModelIndexFromParams(params, gameId = getServerGame()) {
function getSkinModelIndexFromParams(params, gameId = getGame()) {
let fromName = getSkinIndexFromName(params, gameId);
let fromModel = getSkinIndexFromModel(params, gameId);
@@ -1703,8 +1701,8 @@ function getSkinModelIndexFromParams(params, gameId = getServerGame()) {
// ===========================================================================
function getSkinNameFromModel(model, gameId = getServerGame()) {
let skins = getGameData().skins[gameId];
function getSkinNameFromModel(model, gameId = getGame()) {
let skins = getGameConfig().skins[gameId];
for(let i in skins) {
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
return skins[i][1];
@@ -1716,8 +1714,8 @@ function getSkinNameFromModel(model, gameId = getServerGame()) {
// ===========================================================================
function getSkinModelFromName(name, gameId = getServerGame()) {
let skins = getGameData().skins[gameId];
function getSkinModelFromName(name, gameId = getGame()) {
let skins = getGameConfig().skins[gameId];
for(let i in skins) {
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
return skins[i][0];
@@ -1727,7 +1725,7 @@ function getSkinModelFromName(name, gameId = getServerGame()) {
// ===========================================================================
function getObjectModelIndexFromParams(params, gameId = getServerGame()) {
function getObjectModelIndexFromParams(params, gameId = getGame()) {
let fromName = getObjectModelIndexFromName(params, gameId);
let fromModel = getObjectModelIndexFromModel(params, gameId);
@@ -1744,8 +1742,8 @@ function getObjectModelIndexFromParams(params, gameId = getServerGame()) {
// ===========================================================================
function getObjectNameFromModel(model, gameId = getServerGame()) {
let objects = getGameData().objects[gameId];
function getObjectNameFromModel(model, gameId = getGame()) {
let objects = getGameConfig().objects[gameId];
for(let i in objects) {
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
return objects[i][1];
@@ -1757,8 +1755,8 @@ function getObjectNameFromModel(model, gameId = getServerGame()) {
// ===========================================================================
function getObjectModelFromName(name, gameId = getServerGame()) {
let objects = getGameData().objects[gameId];
function getObjectModelFromName(name, gameId = getGame()) {
let objects = getGameConfig().objects[gameId];
for(let i in objects) {
if(toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) {
return objects[i][0];
@@ -2074,14 +2072,14 @@ async function waitUntil(condition) {
function getGameLocationFromParams(params) {
if(isNaN(params)) {
let locations = getGameData().locations[getGame()];
let locations = getGameConfig().locations[getGame()];
for(let i in locations) {
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
return i;
}
}
} else {
if(typeof getGameData().locations[getGame()][params] != "undefined") {
if(typeof getGameConfig().locations[getGame()][params] != "undefined") {
return toInteger(params);
}
}