Merge branch 'gtaiv' into 1.4.0-prep

This commit is contained in:
Vortrex
2022-03-09 00:21:37 -06:00
46 changed files with 1192 additions and 941 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -389,5 +389,9 @@
"FixingStuck": "Fixing your position and virtual world ...", "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!", "NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied" "AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
"ViewInventoryCommandTip": "Use {1} to see your items"
} }

View File

@@ -389,5 +389,9 @@
"FixingStuck": "Fixing your position and virtual world ...", "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!", "NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied" "AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
"ViewInventoryCommandTip": "Use {1} to see your items"
} }

View File

@@ -389,5 +389,9 @@
"FixingStuck": "Fixing your position and virtual world ...", "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!", "NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied" "AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
"ViewInventoryCommandTip": "Use {1} to see your items"
} }

View File

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

View File

@@ -393,5 +393,9 @@
"FixingStuck": "Fixing your position and virtual world ...", "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!", "NotATester": "You are not a tester!",
"AccessDenied": "AccessDenied" "AccessDenied": "AccessDenied",
"InvalidSkin": "That skin is invalid!",
"HeaderInteriorTypes": "Interiors List",
"ViewInventoryKeyPressTip": "Press {1} to see your items",
"ViewInventoryCommandTip": "Use {1} to see your items"
} }

View File

@@ -9,6 +9,7 @@
<script src="scripts/shared/gamedata.js" type="server" language="javascript" /> <script src="scripts/shared/gamedata.js" type="server" language="javascript" />
<script src="scripts/shared/gamedata.js" type="client" language="javascript" /> <script src="scripts/shared/gamedata.js" type="client" language="javascript" />
<!-- Multiplayer Mod (Wrapped Natives) --> <!-- Multiplayer Mod (Wrapped Natives) -->
<script src="scripts/server/native/connected.js" type="server" language="javascript" /> <script src="scripts/server/native/connected.js" type="server" language="javascript" />
<script src="scripts/client/native/connected.js" type="client" 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/skins/none.png" />
<file type="client" src="files/images/mafiac-logo.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/gtac-logo.png" />
<file type="client" src="files/images/server-logo.png" />
<!-- GUI --> <!-- GUI -->
<script src="scripts/client/gui/login.js" type="client" language="javascript" /> <script src="scripts/client/gui/login.js" type="client" language="javascript" />
@@ -111,27 +113,29 @@
<script src="scripts/client/gui/list.js" type="client" language="javascript" /> <script src="scripts/client/gui/list.js" type="client" language="javascript" />
<!-- Client Scripts --> <!-- Client Scripts -->
<script src="scripts/client/gui.js" type="client" language="javascript" />
<script src="scripts/client/main.js" type="client" language="javascript" />
<script src="scripts/client/nametag.js" type="client" language="javascript" />
<script src="scripts/client/sync.js" type="client" language="javascript" />
<script src="scripts/client/scoreboard.js" type="client" language="javascript" />
<script src="scripts/client/keybind.js" type="client" language="javascript" />
<script src="scripts/client/chatbox.js" type="client" language="javascript" />
<script src="scripts/client/label.js" type="client" language="javascript" />
<script src="scripts/client/skin-select.js" type="client" language="javascript" />
<script src="scripts/client/server.js" type="client" language="javascript" />
<script src="scripts/client/job.js" type="client" language="javascript" />
<script src="scripts/client/event.js" type="client" language="javascript" />
<script src="scripts/client/item.js" type="client" language="javascript" />
<script src="scripts/client/utilities.js" type="client" language="javascript" />
<script src="scripts/client/messaging.js" type="client" language="javascript" />
<script src="scripts/client/logo.js" type="client" language="javascript" />
<script src="scripts/client/afk.js" type="client" language="javascript" /> <script src="scripts/client/afk.js" type="client" language="javascript" />
<script src="scripts/client/mousecam.js" type="client" language="javascript" />
<script src="scripts/client/radio.js" type="client" language="javascript" />
<script src="scripts/client/animation.js" type="client" language="javascript" /> <script src="scripts/client/animation.js" type="client" language="javascript" />
<script src="scripts/client/business.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/house.js" type="client" language="javascript" />
<script src="scripts/client/item.js" type="client" language="javascript" />
<script src="scripts/client/job.js" type="client" language="javascript" />
<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/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" />
<!-- MexUI --> <!-- MexUI -->
<file type="client" src="third-party/mexui/Images/down-arrow.png" /> <file type="client" src="third-party/mexui/Images/down-arrow.png" />
<script language="javascript" type="client" src="third-party/mexui/mexui.js" /> <script language="javascript" type="client" src="third-party/mexui/mexui.js" />

View File

@@ -0,0 +1,84 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: business.js
// DESC: Provides business functions and usage
// TYPE: Client (JavaScript)
// ===========================================================================
class BusinessData {
constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
this.index = -1;
this.businessId = businessId;
this.name = name;
this.entrancePosition = entrancePosition;
this.blipModel = blipModel;
this.pickupModel = pickupModel;
this.hasInterior = hasInterior;
this.hasItems = hasItems;
this.blipId = -1;
}
}
// ===========================================================================
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
if(getGame() == VRR_GAME_GTA_IV) {
if(getBusinessData(businessId) != false) {
if(blipModel == -1) {
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
getBusinessData(businessId).blipId = -1;
//businesses.splice(getBusinessData(businessId).index, 1);
//setAllBusinessDataIndexes();
} else {
if(getBusinessData(businessId).blipId != -1) {
natives.setBlipCoordinates(getBusinessData(businessId).blipId, getBusinessData(businessId).entrancePosition);
natives.changeBlipSprite(getBusinessData(businessId).blipId, getBusinessData(businessId).blipModel);
natives.changeBlipNameFromAscii(getBusinessData(businessId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
} else {
let blipId = natives.addBlipForCoord(entrancePosition);
if(blipId) {
getBusinessData(businessId).blipId = blipId;
natives.changeBlipSprite(blipId, blipModel);
natives.setBlipMarkerLongDistance(blipId, false);
}
}
}
} else {
if(blipModel != -1) {
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
let blipId = natives.addBlipForCoord(entrancePosition);
if(blipId) {
tempBusinessData.blipId = blipId;
natives.changeBlipSprite(blipId, blipModel);
natives.setBlipMarkerLongDistance(blipId, false);
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
}
businesses.push(tempBusinessData);
setAllBusinessDataIndexes();
}
}
}
}
// ===========================================================================
/**
* @param {number} businessId - The ID of the business (initially provided by server)
* @return {BusinessData} The business's data (class instance)
*/
function getBusinessData(businessId) {
let tempBusinessData = businesses.find((b) => b.businessId == businessId);
return (typeof tempBusinessData != "undefined") ? tempBusinessData : false;
}
// ===========================================================================
function setAllBusinessDataIndexes() {
for(let i in businesses) {
businesses[i].index = i;
}
}
// ===========================================================================

View File

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

View File

@@ -104,6 +104,7 @@ function closeAllWindows() {
listDialog.window.shown = false; listDialog.window.shown = false;
resetPassword.window.shown = false; resetPassword.window.shown = false;
passwordChange.window.shown = false; passwordChange.window.shown = false;
mexui.setInput(false); mexui.setInput(false);
mexui.focusedControl = false; mexui.focusedControl = false;
@@ -299,14 +300,22 @@ function processGUIKeyPress(keyCode) {
if(guiSubmitKey != false) { if(guiSubmitKey != false) {
guiSubmitKey(); guiSubmitKey();
} }
} else if(keyCode == SDLK_LEFT) { } else if(keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
if(guiLeftKey != false) { if(guiLeftKey != false) {
guiLeftKey(); guiLeftKey();
} }
} else if(keyCode == SDLK_RIGHT) { } else if(keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
if(guiRightKey != false) { if(guiRightKey != false) {
guiRightKey(); 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

@@ -15,4 +15,6 @@ let clanManager = {
vehiclesTab: null, vehiclesTab: null,
businessesTab: null, businessesTab: null,
housesTab: null, housesTab: null,
}; };
// ===========================================================================

View File

@@ -22,7 +22,7 @@ let login = {
function initLoginGUI() { function initLoginGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`); 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: { main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500, transitionTime: 500,
@@ -42,7 +42,7 @@ function initLoginGUI() {
login.window.titleBarIconSize = toVector2(0,0); login.window.titleBarIconSize = toVector2(0,0);
login.window.titleBarHeight = 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: { focused: {
borderColour: toColour(0, 0, 0, 0), borderColour: toColour(0, 0, 0, 0),
}, },
@@ -168,4 +168,6 @@ function switchToPasswordResetGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`); logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
showResetPasswordGUI(); showResetPasswordGUI();
return false; return false;
} }
// ===========================================================================

View File

@@ -21,7 +21,7 @@ let newCharacter = {
function initNewCharacterGUI() { function initNewCharacterGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`); 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: { main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500, 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: { main: {
textSize: 10.0, textSize: 10.0,
textAlign: 0.5, 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: { main: {
backgroundColour: toColour(0, 0, 0, 120), backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255), textColour: toColour(200, 200, 200, 255),
@@ -77,7 +77,7 @@ function initNewCharacterGUI() {
}); });
newCharacter.firstNameInput.placeholder = "First Name"; newCharacter.firstNameInput.placeholder = "First Name";
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', { newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
main: { main: {
backgroundColour: toColour(0, 0, 0, 120), backgroundColour: toColour(0, 0, 0, 120),
textColour: toColour(200, 200, 200, 255), textColour: toColour(200, 200, 200, 255),
@@ -96,7 +96,7 @@ function initNewCharacterGUI() {
}); });
newCharacter.lastNameInput.placeholder = "Last Name"; 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: { main: {
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha), backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
textColour: toColour(255, 255, 255, 255), textColour: toColour(255, 255, 255, 255),

82
scripts/client/house.js Normal file
View File

@@ -0,0 +1,82 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: house.js
// DESC: Provides house functions and usage
// TYPE: Client (JavaScript)
// ===========================================================================
class HouseData {
constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
this.index = -1;
this.houseId = houseId;
this.entrancePosition = entrancePosition;
this.blipModel = blipModel;
this.pickupModel = pickupModel;
this.hasInterior = hasInterior;
this.blipId = -1;
}
}
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
if(getGame() == VRR_GAME_GTA_IV) {
if(getHouseData(houseId) != false) {
if(blipModel == -1) {
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
getHouseData(houseId).blipId = -1;
//houses.splice(getHouseData(houseId).index, 1);
//setAllHouseDataIndexes();
} else {
if(getHouseData(houseId).blipId != -1) {
natives.setBlipCoordinates(getHouseData(houseId).blipId, getHouseData(houseId).entrancePosition);
natives.changeBlipSprite(getHouseData(houseId).blipId, getHouseData(houseId).blipModel);
//natives.changeBlipNameFromAscii(getHouseData(houseId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
} else {
let blipId = natives.addBlipForCoord(entrancePosition);
if(blipId) {
getHouseData(houseId).blipId = blipId;
natives.changeBlipSprite(blipId, blipModel);
natives.setBlipMarkerLongDistance(blipId, false);
}
}
}
} else {
if(blipModel != -1) {
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
let blipId = natives.addBlipForCoord(entrancePosition);
if(blipId) {
tempHouseData.blipId = blipId;
natives.changeBlipSprite(blipId, blipModel);
natives.setBlipMarkerLongDistance(blipId, false);
//natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
}
houses.push(tempHouseData);
setAllHouseDataIndexes();
}
}
}
}
// ===========================================================================
/**
* @param {number} houseId - The ID of the house (initially provided by server)
* @return {HouseData} The house's data (class instance)
*/
function getHouseData(houseId) {
let tempHouseData = houses.find((h) => h.houseId == houseId);
return (typeof tempHouseData != "undefined") ? tempHouseData : false;
}
// ===========================================================================
function setAllHouseDataIndexes() {
for(let i in houses) {
houses[i].index = i;
}
}
// ===========================================================================

View File

@@ -249,42 +249,54 @@ function renderJobLabel(name, position, jobType) {
function processLabelRendering() { function processLabelRendering() {
if(renderLabels && areWorldLabelsSupported()) { if(renderLabels && areWorldLabelsSupported()) {
if(localPlayer != null) { if(localPlayer != null) {
let pickups = getElementsByType(ELEMENT_PICKUP); if(!areServerElementsSupported()) {
for(let i in pickups) { //for(let i in businesses) {
if(pickups[i].getData("vrr.label.type") != null) { // if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) { // natives.drawColouredCylinder(businesses[i].entrancePosition, 0.0, 0.0, 0, 153, 255);
if(!pickups[i].isOnScreen) { // }
let price = "0"; //}
let rentPrice = "0";
let labelInfoType = VRR_PROPLABEL_INFO_NONE; // natives.getScreenViewportId
if(pickups[i].getData("vrr.label.price") != null) { // natives.getGameViewportId
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price")); // natives.getViewportPositionOfCoord
} } else {
let pickups = getElementsByType(ELEMENT_PICKUP);
if(pickups[i].getData("vrr.label.rentprice") != null) { for(let i in pickups) {
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice")); if(pickups[i].getData("vrr.label.type") != null) {
} if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
if(!pickups[i].isOnScreen) {
if(pickups[i].getData("vrr.label.help") != null) { let price = "0";
labelInfoType = pickups[i].getData("vrr.label.help"); let rentPrice = "0";
} let labelInfoType = VRR_PROPLABEL_INFO_NONE;
if(pickups[i].getData("vrr.label.price") != null) {
switch(pickups[i].getData("vrr.label.type")) { price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
case VRR_LABEL_BUSINESS: }
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
break; if(pickups[i].getData("vrr.label.rentprice") != null) {
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
case VRR_LABEL_HOUSE: }
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
break; if(pickups[i].getData("vrr.label.help") != null) {
labelInfoType = pickups[i].getData("vrr.label.help");
case VRR_LABEL_JOB: }
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
break; switch(pickups[i].getData("vrr.label.type")) {
case VRR_LABEL_BUSINESS:
case VRR_LABEL_EXIT: renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
renderPropertyExitLabel(pickups[i].position); break;
break;
case VRR_LABEL_HOUSE:
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
break;
case VRR_LABEL_JOB:
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
break;
case VRR_LABEL_EXIT:
renderPropertyExitLabel(pickups[i].position);
break;
}
} }
} }
} }

View File

@@ -69,4 +69,9 @@ let forceWantedLevel = 0;
// Pre-cache all allowed skins // Pre-cache all allowed skins
let allowedSkins = getAllowedSkins(getGame()); let allowedSkins = getAllowedSkins(getGame());
let businesses = [];
let houses = [];
let jobs = [];
let vehicles = [];
// =========================================================================== // ===========================================================================

View File

@@ -52,7 +52,7 @@ function deleteGameElement(element, position) {
// =========================================================================== // ===========================================================================
function createGameVehicle(modelIndex, position, heading) { 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

@@ -85,7 +85,6 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin); addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation); addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI); addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo); addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState); addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
@@ -101,6 +100,13 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.logLevel", setLogLevel); addNetworkEventHandler("vrr.logLevel", setLogLevel);
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun); addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
} }
// =========================================================================== // ===========================================================================
@@ -133,6 +139,8 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
natives.displayCash(hudState); natives.displayCash(hudState);
natives.displayAmmo(hudState); natives.displayAmmo(hudState);
natives.displayHud(hudState); natives.displayHud(hudState);
natives.displayRadar(hudState);
natives.displayAreaName(hudState);
} else { } else {
if(typeof setHUDEnabled != "undefined") { if(typeof setHUDEnabled != "undefined") {
setHUDEnabled(hudState); setHUDEnabled(hudState);
@@ -205,18 +213,6 @@ function setEnterPropertyKey(key) {
// =========================================================================== // ===========================================================================
function setGameScriptState(scriptName, state) {
if(state == VRR_GAMESCRIPT_FORCE) {
logToConsole(`[VRR.Server] Starting game script '${scriptName}'`);
game.startNewScript(scriptName);
} else if(state == VRR_GAMESCRIPT_DENY) {
logToConsole(`[VRR.Server] Terminating game script '${scriptName}'`);
game.terminateScript(scriptName);
}
}
// ===========================================================================
function serverRequestedClientInfo() { function serverRequestedClientInfo() {
sendServerClientInfo(); sendServerClientInfo();
} }
@@ -266,6 +262,9 @@ function setElementCollisionsEnabled(elementId, state) {
function setLocalPlayerPedPartsAndProps(parts, props) { function setLocalPlayerPedPartsAndProps(parts, props) {
for(let i in parts) { for(let i in parts) {
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]); localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
}
for(let i in props) {
localPlayer.changeBodyProp(props[0], props[1]); localPlayer.changeBodyProp(props[0], props[1]);
} }
} }
@@ -304,11 +303,26 @@ function setLocalPlayerInfiniteRun(state) {
function setLocalPlayerSkin(skinId) { function setLocalPlayerSkin(skinId) {
if(getGame() == VRR_GAME_GTA_IV) { if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), skinId); natives.changePlayerModel(natives.getPlayerId(), skinId);
localPlayer.skin = allowedSkins[skinSelectorIndex][0]; //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
} else { } else {
localPlayer.skin = skinId; localPlayer.skin = skinId;
} }
} }
// ===========================================================================
function makePedHoldObject(pedId, modelIndex) {
if(getGame() == VRR_GAME_GTA_IV) {
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
}
}
// ===========================================================================
function sendLocalPlayerNetworkIdToServer() {
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
}
// =========================================================================== // ===========================================================================

View File

@@ -55,7 +55,8 @@ function processSkinSelectKeyPress(keyCode) {
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1]; skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) { if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]); //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0]; //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
} else { } else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0]; localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} }
@@ -69,7 +70,8 @@ function processSkinSelectKeyPress(keyCode) {
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1]; skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
if(getGame() == VRR_GAME_GTA_IV) { if(getGame() == VRR_GAME_GTA_IV) {
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]); //natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
localPlayer.skin = allowedSkins[skinSelectorIndex][0]; //localPlayer.skin = allowedSkins[skinSelectorIndex][0];
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
} else { } else {
localPlayer.skin = allowedSkins[skinSelectorIndex][0]; localPlayer.skin = allowedSkins[skinSelectorIndex][0];
} }

View File

@@ -24,6 +24,146 @@ function initClientScripts() {
// =========================================================================== // ===========================================================================
function setUpInitialGame() {
if(getGame() == VRR_GAME_GTA_III) {
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
game.SET_PED_DENSITY_MULTIPLIER(3.0);
game.onMission = true;
SetStandardControlsEnabled(true);
return true;
}
if(getGame() == VRR_GAME_GTA_VC) {
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
game.SET_PED_DENSITY_MULTIPLIER(3.0);
game.REQUEST_ANIMATION("bikev");
game.REQUEST_ANIMATION("bikeh");
game.REQUEST_ANIMATION("biked");
game.REQUEST_ANIMATION("knife");
game.REQUEST_ANIMATION("python");
game.REQUEST_ANIMATION("shotgun");
game.REQUEST_ANIMATION("buddy");
game.REQUEST_ANIMATION("tec");
game.REQUEST_ANIMATION("uzi");
game.REQUEST_ANIMATION("rifle");
game.REQUEST_ANIMATION("m60");
game.REQUEST_ANIMATION("sniper");
game.REQUEST_ANIMATION("grenade");
game.REQUEST_ANIMATION("flame");
game.REQUEST_ANIMATION("medic");
game.REQUEST_ANIMATION("sunbathe");
//game.REQUEST_ANIMATION("playidles");
game.REQUEST_ANIMATION("riot");
game.REQUEST_ANIMATION("strip");
game.REQUEST_ANIMATION("lance");
game.REQUEST_ANIMATION("skate");
game.LOAD_ALL_MODELS_NOW();
game.onMission = true;
SetStandardControlsEnabled(true);
return true;
}
if(getGame() == VRR_GAME_GTA_SA) {
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
game.setGameStat(STAT_DRIVING_SKILL, 9999);
game.setGameStat(STAT_FAT, 9999);
game.setGameStat(STAT_ENERGY, 9999);
game.setGameStat(STAT_CYCLE_SKILL, 9999);
game.setGameStat(STAT_BIKE_SKILL, 9999);
game.setGameStat(STAT_GAMBLING, 9999);
game.setGameStat(STAT_PROGRESS_MADE, 9999);
game.setGameStat(STAT_RESPECT, 0);
game.setGameStat(STAT_RESPECT_TOTAL, 0);
game.setGameStat(STAT_SEX_APPEAL, 0);
game.setGameStat(STAT_STAMINA, 9999);
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
game.setGameStat(STAT_BODY_MUSCLE, 9999);
game.setDefaultInteriors(false);
game.onMission = true;
return true;
}
if(getGame() == VRR_GAME_GTA_IV) {
natives.allowEmergencyServices(false);
natives.setCreateRandomCops(true);
natives.setMaxWantedLevel(0);
natives.setWantedMultiplier(0.0);
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
natives.setPlayerTeam(natives.getPlayerId(), 0);
natives.loadAllObjectsNow();
natives.setCellphoneRanked(false);
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true);
natives.disablePauseMenu(true);
natives.allowReactionAnims(localPlayer, true);
natives.allowGameToPauseForStreaming(false);
natives.allowStuntJumpsToTrigger(false);
natives.setPickupsFixCars(false);
// HUD and Display
//natives.displayCash(false);
//natives.displayAmmo(false);
//natives.displayHud(false);
//natives.displayRadar(false);
//natives.displayAreaName(false);
//natives.displayPlayerNames(false);
natives.setPoliceRadarBlips(false);
natives.removeTemporaryRadarBlipsForPickups();
natives.displayNonMinigameHelpMessages(false);
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
// Item/Money Dropping
natives.setMoneyCarriedByAllNewPeds(0);
natives.setDeadPedsDropWeapons(false);
natives.setPlayersDropMoneyInNetworkGame(false);
// Population
//natives.dontSuppressAnyCarModels(5.0);
//natives.dontSuppressAnyPedModels(5.0);
//natives.forceGenerateParkedCarsTooCloseToOthers(true);
//natives.setParkedCarDensityMultiplier(5.0);
//natives.setRandomCarDensityMultiplier(5.0);
//natives.setPedDensityMultiplier(5.0);
//natives.setCarDensityMultiplier(5.0);
//natives.setScenarioPedDensityMultiplier(5.0, 5.0);
natives.switchRandomTrains(true);
natives.switchRandomBoats(true);
natives.switchAmbientPlanes(true);
natives.switchMadDrivers(false);
natives.requestAnims("DANCING");
return true;
}
if(getGame() == VRR_GAME_MAFIA_ONE) {
game.mapEnabled = false;
game.setTrafficEnabled(false);
return true;
}
}
// ===========================================================================
initClientScripts(); initClientScripts();
// =========================================================================== // ===========================================================================

View File

@@ -14,18 +14,6 @@ function processSync(event, deltaTime) {
sendNetworkEventToServer("vrr.player.heading", localPlayer.heading); sendNetworkEventToServer("vrr.player.heading", localPlayer.heading);
} }
//if(game.game == VRR_GAME_GTA_SA) {
// let lookAtPos = getLocalPlayerLookAtPosition();
// sendNetworkEventToServer("vrr.player.lookat", lookAtPos);
// setEntityData(localPlayer, "vrr.headLook", lookAtPos);
// let peds = getPeds();
// for(let i in peds) {
// if(doesEntityDataExist(peds[i], "vrr.headLook")) {
// peds[i].lookAt(getEntityData(peds[i], "vrr.headLook"), 99999);
// }
// }
//}
if(localPlayer.health <= 0) { if(localPlayer.health <= 0) {
if(!calledDeathEvent) { if(!calledDeathEvent) {
logToConsole(LOG_DEBUG, `Local player died`); logToConsole(LOG_DEBUG, `Local player died`);
@@ -116,7 +104,7 @@ function syncVehicleProperties(vehicle) {
} }
if(getGame() == VRR_GAME_GTA_SA) { if(getGame() == VRR_GAME_GTA_SA) {
let allUpgrades = getGameData().vehicleUpgrades[getGame()]; let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
for(let i in allUpgrades) { for(let i in allUpgrades) {
vehicle.removeUpgrade(i); vehicle.removeUpgrade(i);
} }
@@ -391,4 +379,14 @@ function syncElementProperties(element) {
} }
} }
// ===========================================================================
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// =========================================================================== // ===========================================================================

View File

@@ -275,9 +275,17 @@ function runClientCode(code, returnTo) {
function enterVehicleAsPassenger() { function enterVehicleAsPassenger() {
if(localPlayer.vehicle == null) { if(localPlayer.vehicle == null) {
let tempVehicle = getClosestVehicle(localPlayer.position); let tempVehicle = getClosestVehicle(localPlayer.position);
if(tempVehicle != null) { if(getGame() != VRR_GAME_GTA_IV) {
localPlayer.enterVehicle(tempVehicle, false); if(tempVehicle != null) {
} localPlayer.enterVehicle(tempVehicle, false);
}
} else {
for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 1);
}
}
}
} }
} }
@@ -348,6 +356,9 @@ function setLocalPlayerInterior(interior) {
if(!isGTAIV()) { if(!isGTAIV()) {
localPlayer.interior = interior; localPlayer.interior = interior;
game.cameraInterior = interior; game.cameraInterior = interior;
} else {
let interiorId = natives.getInteriorAtCoords(localPlayer.position);
natives.activateInterior(interiorId, true);
} }
} }
@@ -401,7 +412,11 @@ function clearLocalPedState() {
// =========================================================================== // ===========================================================================
function getWeaponSlot(weaponId) { function getWeaponSlot(weaponId) {
return weaponSlots[game.game][weaponId]; if(getGame() == VRR_GAME_GTA_IV) {
return false;
}
return weaponSlots[getGame()][weaponId];
} }
// =========================================================================== // ===========================================================================
@@ -498,6 +513,10 @@ function setLocalPlayerCash(amount) {
if(typeof localPlayer.money != "undefined") { if(typeof localPlayer.money != "undefined") {
localPlayer.money = toInteger(amount); localPlayer.money = toInteger(amount);
} }
if(getGame() == VRR_GAME_GTA_IV) {
natives.setMultiplayerHudCash(amount);
}
} }
// =========================================================================== // ===========================================================================
@@ -615,12 +634,12 @@ function forceLocalPlayerEquippedWeaponItem() {
if(forceWeapon != 0) { if(forceWeapon != 0) {
if(localPlayer.weapon != forceWeapon) { if(localPlayer.weapon != forceWeapon) {
localPlayer.weapon = forceWeapon; localPlayer.weapon = forceWeapon;
if(getGame() <= VRR_GAME_GTA_IV) { if(getGame() < VRR_GAME_GTA_IV) {
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo); localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo); localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
} }
} else { } else {
if(getGame() <= VRR_GAME_GTA_IV) { if(getGame() < VRR_GAME_GTA_IV) {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon)); forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon)); forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
} }
@@ -745,119 +764,6 @@ function processNearbyPickups() {
// =========================================================================== // ===========================================================================
function setUpInitialGame() {
if(getGame() == VRR_GAME_GTA_III) {
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
game.SET_PED_DENSITY_MULTIPLIER(3.0);
game.onMission = true;
SetStandardControlsEnabled(true);
return true;
}
if(getGame() == VRR_GAME_GTA_VC) {
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
game.setGameStat(STAT_PROGRESSMADE, 9999);
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
game.SET_PED_DENSITY_MULTIPLIER(3.0);
game.REQUEST_ANIMATION("bikev");
game.REQUEST_ANIMATION("bikeh");
game.REQUEST_ANIMATION("biked");
game.REQUEST_ANIMATION("knife");
game.REQUEST_ANIMATION("python");
game.REQUEST_ANIMATION("shotgun");
game.REQUEST_ANIMATION("buddy");
game.REQUEST_ANIMATION("tec");
game.REQUEST_ANIMATION("uzi");
game.REQUEST_ANIMATION("rifle");
game.REQUEST_ANIMATION("m60");
game.REQUEST_ANIMATION("sniper");
game.REQUEST_ANIMATION("grenade");
game.REQUEST_ANIMATION("flame");
game.REQUEST_ANIMATION("medic");
game.REQUEST_ANIMATION("sunbathe");
//game.REQUEST_ANIMATION("playidles");
game.REQUEST_ANIMATION("riot");
game.REQUEST_ANIMATION("strip");
game.REQUEST_ANIMATION("lance");
game.REQUEST_ANIMATION("skate");
game.LOAD_ALL_MODELS_NOW();
game.onMission = true;
SetStandardControlsEnabled(true);
return true;
}
if(getGame() == VRR_GAME_GTA_SA) {
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
game.setGameStat(STAT_DRIVING_SKILL, 9999);
game.setGameStat(STAT_FAT, 9999);
game.setGameStat(STAT_ENERGY, 9999);
game.setGameStat(STAT_CYCLE_SKILL, 9999);
game.setGameStat(STAT_BIKE_SKILL, 9999);
game.setGameStat(STAT_GAMBLING, 9999);
game.setGameStat(STAT_PROGRESS_MADE, 9999);
game.setGameStat(STAT_RESPECT, 0);
game.setGameStat(STAT_RESPECT_TOTAL, 0);
game.setGameStat(STAT_SEX_APPEAL, 0);
game.setGameStat(STAT_STAMINA, 9999);
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
game.setGameStat(STAT_BODY_MUSCLE, 9999);
game.setDefaultInteriors(false);
game.onMission = true;
return true;
}
if(getGame() == VRR_GAME_GTA_IV) {
natives.allowEmergencyServices(false);
natives.setCreateRandomCops(true);
natives.setMaxWantedLevel(0);
natives.setWantedMultiplier(0.0);
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
natives.setPlayerTeam(natives.getPlayerId(), 0);
natives.loadAllObjectsNow();
natives.setCellphoneRanked(false);
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
natives.setPlayersDropMoneyInNetworkGame(false);
natives.setSyncWeatherAndGameTime(false);
natives.usePlayerColourInsteadOfTeamColour(true);
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
natives.removeTemporaryRadarBlipsForPickups();
natives.setPickupsFixCars(false);
natives.displayCash(false);
natives.displayAmmo(false);
natives.displayHud(false);
natives.displayAreaName(false);
natives.setPoliceRadarBlips(false);
natives.requestAnims("DANCING");
return true;
}
if(getGame() == VRR_GAME_MAFIA_ONE) {
game.mapEnabled = false;
game.setTrafficEnabled(false);
return true;
}
}
// ===========================================================================
function processGameSpecifics() { function processGameSpecifics() {
if(game.game < VRR_GAME_GTA_IV) { if(game.game < VRR_GAME_GTA_IV) {
game.clearMessages(); game.clearMessages();

View File

@@ -63,8 +63,7 @@ function listAccentsCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(accentList, 8); let chunkedList = splitArrayIntoChunks(accentList, 8);
messagePlayerInfo(client, `{clanOrange}== {jobYellow}Accents {clanOrange}==================================`); messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentList")));
for(let i in chunkedList) { for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", ")); messagePlayerInfo(client, chunkedList[i].join(", "));
} }
@@ -112,7 +111,7 @@ function addAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName); getGlobalConfig().accents.push(newAccentName);
saveAccentConfig(); saveAccentConfig();
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`); messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
} }
// =========================================================================== // ===========================================================================
@@ -132,7 +131,7 @@ function removeAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName); getGlobalConfig().accents.push(newAccentName);
saveAccentConfig(); saveAccentConfig();
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`); messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
} }
// =========================================================================== // ===========================================================================

View File

@@ -599,7 +599,6 @@ function loginSuccess(client) {
getPlayerData(client).accountData.ipAddress = client.ip; getPlayerData(client).accountData.ipAddress = client.ip;
//sendRemovedWorldObjectsToPlayer(client);
sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines); sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow")); messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow"));
@@ -1127,6 +1126,7 @@ function initClient(client) {
updatePlayerSnowState(client); updatePlayerSnowState(client);
showConnectCameraToPlayer(client); showConnectCameraToPlayer(client);
messageClient(`Please wait ...`, client, getColourByName("softGreen")); messageClient(`Please wait ...`, client, getColourByName("softGreen"));
setTimeout(function() { setTimeout(function() {

View File

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

View File

@@ -9,57 +9,8 @@
function initAntiCheatScript() { function initAntiCheatScript() {
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ..."); logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
getServerData().antiCheat.whiteListedGameScripts = loadAntiCheatGameScriptWhiteListFromDatabase();
getServerData().antiCheat.blackListedGameScripts = loadAntiCheatGameScriptBlackListFromDatabase();
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!"); logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
} }
// ===========================================================================
function loadAntiCheatGameScriptWhiteListFromDatabase() {
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading whitelisted game scripts ...`);
let dbConnection = connectToDatabase();
let tempWhiteListedGameScripts = [];
if(dbConnection) {
let dbQueryString = `SELECT * FROM ac_script_wl WHERE ac_script_wl_enabled = 1 AND ac_script_wl_server = ${getServerId()}`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(dbAssoc);
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
}
}
disconnectFromDatabase(dbConnection);
}
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempWhiteListedGameScripts.length} whitelisted game scripts loaded!`);
return tempWhiteListedGameScripts;
}
// ===========================================================================
function loadAntiCheatGameScriptBlackListFromDatabase() {
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading blacklisted game scripts ...`);
let dbConnection = connectToDatabase();
let tempBlackListedGameScripts = [];
if(dbConnection) {
let dbQueryString = `SELECT * FROM ac_script_bl WHERE ac_script_bl_enabled = 1 AND ac_script_bl_server = ${getServerId()}`;
let dbQuery = queryDatabase(dbConnection, dbQueryString);
if(dbQuery) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempBlackListedGameScriptData = new BlackListedGameScriptData(dbAssoc);
tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
}
}
disconnectFromDatabase(dbConnection);
}
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempBlackListedGameScripts.length} blacklisted game scripts loaded!`);
return tempBlackListedGameScripts;
}
// =========================================================================== // ===========================================================================
@@ -76,170 +27,6 @@ function clearPlayerStateToEnterExitProperty(client) {
// =========================================================================== // ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function addAntiCheatBlackListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let scriptName = params;
let tempBlackListedGameScriptData = new BlackListedGameScriptData(false);
tempBlackListedGameScriptData.scriptName = scriptName;
tempBlackListedGameScriptData.serverId = getServerId();
tempBlackListedGameScriptData.enabled = true;
tempBlackListedGameScriptData.needsSaved = true;
getServerConfig().antiCheat.blackListedGameScripts.push(tempBlackListedGameScriptData);
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_DENY);
}
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script blacklist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function addAntiCheatWhiteListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let scriptName = params;
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(false);
tempWhiteListedGameScriptData.scriptName = scriptName;
tempWhiteListedGameScriptData.serverId = getServerId();
tempWhiteListedGameScriptData.enabled = true;
tempWhiteListedGameScriptData.needsSaved = true;
getServerConfig().antiCheat.whiteListedGameScripts.push(tempWhiteListedGameScriptData);
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_ALLOW);
}
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script whitelist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function removeAntiCheatWhiteListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let whiteListScriptId = getAntiCheatWhiteListedScriptFromParams(params);
getServerConfig().antiCheat.whiteListedGameScripts.splice(whiteListScriptId, 1);
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
}
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script whitelist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function removeAntiCheatBlackListedScriptCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let blackListScriptId = getAntiCheatBlackListedScriptFromParams(params);
getServerConfig().antiCheat.blackListedGameScripts.splice(blackListScriptId, 1);
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
}
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script blacklist`);
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function toggleAntiCheatScriptWhiteListCommand(command, params, client) {
getServerConfig().antiCheat.gameScriptWhiteListEnabled = !getServerConfig().antiCheat.gameScriptWhiteListEnabled;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script whitelist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptWhiteListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptWhiteListEnabled))}`);
updateServerRules();
return true;
}
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function toggleAntiCheatScriptBlackListCommand(command, params, client) {
getServerConfig().antiCheat.gameScriptBlackListEnabled = !getServerConfig().antiCheat.gameScriptBlackListEnabled;
getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script blacklist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptBlackListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptBlackListEnabled))}`);
updateServerRules();
return true;
}
// ===========================================================================
function isPlayerExemptFromAntiCheat(client) { function isPlayerExemptFromAntiCheat(client) {
if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("ExemptFromAntiCheat"))) { if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("ExemptFromAntiCheat"))) {
return true; return true;

View File

@@ -58,7 +58,7 @@ function loadBusinessesFromDatabase() {
while(dbAssoc = fetchQueryAssoc(dbQuery)) { while(dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessData = new BusinessData(dbAssoc); let tempBusinessData = new BusinessData(dbAssoc);
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId); tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId); //tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
tempBusinesses.push(tempBusinessData); tempBusinesses.push(tempBusinessData);
logToConsole(LOG_INFO, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`); logToConsole(LOG_INFO, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
} }
@@ -105,6 +105,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
// =========================================================================== // ===========================================================================
/*
function loadBusinessGameScriptsFromDatabase(businessId) { function loadBusinessGameScriptsFromDatabase(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business game scripts for business ${businessId} from database ...`); logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business game scripts for business ${businessId} from database ...`);
@@ -133,6 +134,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`); logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
return tempBusinessGameScripts; return tempBusinessGameScripts;
} }
*/
// =========================================================================== // ===========================================================================
@@ -1335,7 +1337,7 @@ function createAllBusinessBlips() {
// =========================================================================== // ===========================================================================
function createBusinessEntrancePickup(businessId) { function createBusinessEntrancePickup(businessId) {
if(!getServerConfig().createBusinessPickups) { if(!getServerConfig().createBusinessPickups) {
return false; return false;
} }
@@ -1348,18 +1350,26 @@ function createBusinessEntrancePickup(businessId) {
} }
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`); 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); if(areServerElementsSupported()) {
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false); getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension); setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
updateBusinessPickupLabelData(businessId); setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
addToWorld(getBusinessData(businessId).entrancePickup); updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
} else {
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId), getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
}
} }
} }
// =========================================================================== // ===========================================================================
function createBusinessEntranceBlip(businessId) { function createBusinessEntranceBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(!getServerConfig().createBusinessBlips) { if(!getServerConfig().createBusinessBlips) {
return false; return false;
} }
@@ -1372,11 +1382,15 @@ function createBusinessEntranceBlip(businessId) {
} }
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`); 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")); if(areServerElementsSupported()) {
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false); getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension); setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
addToWorld(getBusinessData(businessId).entranceBlip); setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
addToWorld(getBusinessData(businessId).entranceBlip);
} else {
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, blipModelId, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
}
} }
} }
@@ -1396,12 +1410,14 @@ function createBusinessExitPickup(businessId) {
} }
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`); 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); if(areServerElementsSupported()) {
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension); getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false); setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
updateBusinessPickupLabelData(businessId); setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
addToWorld(getBusinessData(businessId).exitPickup); updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).exitPickup);
}
} }
} }
} }
@@ -1421,15 +1437,17 @@ function createBusinessExitBlip(businessId) {
blipModelId = getBusinessData(businessId).exitBlipModel; 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")); getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension); setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false); setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior; //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.type", VRR_BLIP_BUSINESS_EXIT, false);
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false); //setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).exitBlip); addToWorld(getBusinessData(businessId).exitBlip);
}
} }
} }
} }
@@ -1535,6 +1553,10 @@ function doesBusinessHaveInterior(businessId) {
// =========================================================================== // ===========================================================================
function deleteBusinessEntrancePickup(businessId) { function deleteBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entrancePickup != null) { if(getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup); //removeFromWorld(getBusinessData(businessId).entrancePickup);
deleteGameElement(getBusinessData(businessId).entrancePickup); deleteGameElement(getBusinessData(businessId).entrancePickup);
@@ -1545,6 +1567,10 @@ function deleteBusinessEntrancePickup(businessId) {
// =========================================================================== // ===========================================================================
function deleteBusinessExitPickup(businessId) { function deleteBusinessExitPickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitPickup != null) { if(getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup); //removeFromWorld(getBusinessData(businessId).exitPickup);
deleteGameElement(getBusinessData(businessId).exitPickup); deleteGameElement(getBusinessData(businessId).exitPickup);
@@ -1555,6 +1581,10 @@ function deleteBusinessExitPickup(businessId) {
// =========================================================================== // ===========================================================================
function deleteBusinessEntranceBlip(businessId) { function deleteBusinessEntranceBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entranceBlip != null) { if(getBusinessData(businessId).entranceBlip != null) {
//removeFromWorld(getBusinessData(businessId).entranceBlip); //removeFromWorld(getBusinessData(businessId).entranceBlip);
deleteGameElement(getBusinessData(businessId).entranceBlip); deleteGameElement(getBusinessData(businessId).entranceBlip);
@@ -1565,6 +1595,10 @@ function deleteBusinessEntranceBlip(businessId) {
// =========================================================================== // ===========================================================================
function deleteBusinessExitBlip(businessId) { function deleteBusinessExitBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitBlip != null) { if(getBusinessData(businessId).exitBlip != null) {
//removeFromWorld(getBusinessData(businessId).exitBlip); //removeFromWorld(getBusinessData(businessId).exitBlip);
deleteGameElement(getBusinessData(businessId).exitBlip); deleteGameElement(getBusinessData(businessId).exitBlip);
@@ -1907,6 +1941,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
// =========================================================================== // ===========================================================================
function updateBusinessPickupLabelData(businessId) { function updateBusinessPickupLabelData(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitPickup != null) { if(getBusinessData(businessId).exitPickup != null) {
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false); setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false); setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
@@ -2022,19 +2060,19 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
// =========================================================================== // ===========================================================================
function sendPlayerBusinessGameScripts(client, businessId) { //function sendPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) { // for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state); // sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
} // }
} //}
// =========================================================================== // ===========================================================================
function clearPlayerBusinessGameScripts(client, businessId) { //function clearPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) { // for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY); // sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
} // }
} //}
// =========================================================================== // ===========================================================================

View File

@@ -62,11 +62,11 @@ class ServerData {
this.antiCheat = { this.antiCheat = {
enabled: false, enabled: false,
checkGameScripts: false, //checkGameScripts: false,
gameScriptWhiteListEnabled: false, //gameScriptWhiteListEnabled: false,
gameScriptBlackListEnabled: false, //gameScriptBlackListEnabled: false,
gameScriptWhiteList: [], //gameScriptWhiteList: [],
gameScriptBlackList: [], //gameScriptBlackList: [],
}; };
this.discordBotToken = ""; this.discordBotToken = "";
@@ -113,38 +113,14 @@ class ServerData {
this.minute = toInteger(dbAssoc["svr_start_time_min"]); this.minute = toInteger(dbAssoc["svr_start_time_min"]);
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]); this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
this.weather = toInteger(dbAssoc["svr_start_weather"]); this.weather = toInteger(dbAssoc["svr_start_weather"]);
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.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.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.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.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
this.showLogo = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]); this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
this.testerOnly = hasBitFlag(this.settings, getServerSettingsFlagValue("Testing"));
this.antiCheat = {
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.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
this.discordEnabled = hasBitFlag(this.settings, getServerSettingsFlagValue("DiscordBot"));
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.introMusicURL = dbAssoc["svr_intro_music"];
this.useRealTime = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"]; this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
this.discordConfig = { this.discordConfig = {
@@ -263,6 +239,8 @@ class ClientData {
this.locale = 0; this.locale = 0;
this.enteringVehicle = null; this.enteringVehicle = null;
this.pedId = -1;
} }
}; };
@@ -672,7 +650,7 @@ class HouseData {
this.itemCache = []; this.itemCache = [];
this.locations = []; this.locations = [];
this.gameScripts = []; //this.gameScripts = [];
this.entrancePosition = false; this.entrancePosition = false;
this.entranceRotation = 0.0; this.entranceRotation = 0.0;

View File

@@ -74,6 +74,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection); addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive); addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient); addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
} }
// =========================================================================== // ===========================================================================
@@ -223,29 +224,6 @@ function updatePlayerSnowState(client) {
// =========================================================================== // ===========================================================================
function sendExcludedModelsForGroundSnowToPlayer(client) {
if(getGameConfig().excludedGroundSnowModels[getServerGame()].length > 0) {
for(let i in getGameConfig().excludedGroundSnowModels[getServerGame()]) {
logToConsole(LOG_DEBUG, `[VRR.Misc] Sending excluded model ${i} for ground snow to ${getPlayerName(client)}`);
sendNetworkEventToPlayer("vrr.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
}
}
}
// ===========================================================================
function sendRemovedWorldObjectsToPlayer(client) {
if(getGameConfig().removedWorldObjects[getServerGame()].length > 0) {
for(let i in getGameConfig().removedWorldObjects[getServerGame()]) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending removed world object ${i} (${getGameConfig().removedWorldObjects[getServerGame()][i][0]}) to ${getPlayerName(client)}`);
sendNetworkEventToPlayer("vrr.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i][0], getGameConfig().removedWorldObjects[getServerGame()][i][1], getGameConfig().removedWorldObjects[getServerGame()][i][2]);
}
}
return true;
}
// ===========================================================================
function updatePlayerHotBar(client) { function updatePlayerHotBar(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`); logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
let tempHotBarItems = []; let tempHotBarItems = [];
@@ -1053,12 +1031,6 @@ function setPlayerHeadLookPosition(client, position) {
// =========================================================================== // ===========================================================================
function sendPlayerGameScriptState(client, scriptName, state) {
sendNetworkEventToPlayer("vrr.gameScript", client, scriptName, state);
}
// ===========================================================================
function requestClientInfo(client) { function requestClientInfo(client) {
sendNetworkEventToPlayer("vrr.clientInfo", client); sendNetworkEventToPlayer("vrr.clientInfo", client);
} }
@@ -1078,7 +1050,10 @@ function forcePlayerToSyncElementProperties(client, element) {
// =========================================================================== // ===========================================================================
function sendPlayerPedPartsAndProps(client) { function sendPlayerPedPartsAndProps(client) {
sendNetworkEventToPlayer("vrr.ped") let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
} }
// =========================================================================== // ===========================================================================
@@ -1134,4 +1109,56 @@ function setPlayerInfiniteRun(client, state) {
sendNetworkEventToPlayer("vrr.infiniteRun", client, state); sendNetworkEventToPlayer("vrr.infiniteRun", 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);
}
// ==========================================================================
function sendAllBusinessEntrancesToPlayer(client) {
let businesses = getServerData().businesses;
for(let i in businesses) {
if(businesses[i].entranceBlipModel > 0) {
sendBusinessEntranceToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
}
}
}
// ==========================================================================
function sendAllHouseEntrancesToPlayer(client) {
let houses = getServerData().houses;
for(let i in houses) {
if(houses[i].entranceBlipModel > 0) {
sendBusinessEntranceToPlayer(client, businesses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
}
}
}
// ==========================================================================
function makePlayerHoldObjectModel(client, modelIndex) {
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).pedId, modelIndex);
}
// ==========================================================================
function receivePlayerPedNetworkId(client, pedId) {
getPlayerData(client).pedId = pedId;
}
// ==========================================================================
function requestPlayerPedNetworkId(client) {
sendNetworkEventToPlayer("vrr.playerPedId", client);
}
// ========================================================================== // ==========================================================================

View File

@@ -68,12 +68,6 @@ function loadCommands() {
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"), commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
], ],
antiCheat: [ antiCheat: [
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("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
//commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true), //commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
], ],

View File

@@ -7,10 +7,10 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
let serverConfig = {}; let serverConfig = false;
let databaseConfig = {}; let databaseConfig = false;
let emailConfig = {}; let emailConfig = false;
let gameConfig = {}; let gameConfig = false;
// =========================================================================== // ===========================================================================
@@ -75,9 +75,38 @@ let globalConfig = {
// =========================================================================== // ===========================================================================
function loadGameConfig() { function initConfigScript() {
return gameData; 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 ...");
getServerConfig().fallingSnow = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
getServerConfig().groundSnow = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
getServerConfig().useGUI = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
getServerConfig().showLogo = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Logo"));
getServerConfig().testerOnly = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing"));
getServerConfig().discordEnabled = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("DiscordBot"));
getServerConfig().createJobPickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
getServerConfig().createBusinessPickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
getServerConfig().createHousePickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
getServerConfig().createJobBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
getServerConfig().createBusinessBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
getServerConfig().createHouseBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
getServerConfig().useRealTime = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
getServerConfig().antiCheat.enabled = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Anticheat"));
applyConfigToServer(serverConfig);
logToConsole(LOG_DEBUG, "[VRR.Config]: All config loaded and applied successfully!");
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
}
// =========================================================================== // ===========================================================================
@@ -89,19 +118,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) { function loadServerConfigFromGameAndPort(gameId, port, mpMod) {
let dbConnection = connectToDatabase(); let dbConnection = connectToDatabase();
if(dbConnection) { if(dbConnection) {
@@ -144,10 +160,12 @@ function loadServerConfigFromId(tempServerId) {
function applyConfigToServer(tempServerConfig) { function applyConfigToServer(tempServerConfig) {
if(isTimeSupported()) { 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()) { if(isWeatherSupported()) {
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
game.forceWeather(tempServerConfig.weather); game.forceWeather(tempServerConfig.weather);
} }
@@ -220,21 +238,15 @@ function saveServerConfigToDatabase() {
* @return {ServerData} - Server configuration data * @return {ServerData} - Server configuration data
* *
*/ */
function getServerConfig(serverId = getServerId()) { function getServerConfig() {
if(serverId != getServerId()) { //if(serverId != getServerId()) {
return loadServerConfigFromId(serverId); // return loadServerConfigFromId(serverId);
} //}
return serverConfig; return serverConfig;
} }
// =========================================================================== // ===========================================================================
function getGameConfig() {
return gameConfig;
}
// ===========================================================================
function getGlobalConfig() { function getGlobalConfig() {
return globalConfig; return globalConfig;
} }
@@ -351,7 +363,7 @@ function setWeatherCommand(command, params, client) {
getServerConfig().needsSaved = true; 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(); updateServerRules();
return true; return true;
} }
@@ -380,18 +392,6 @@ function setSnowingCommand(command, params, client) {
getServerConfig().fallingSnow = intToBool(falling); getServerConfig().fallingSnow = intToBool(falling);
getServerConfig().groundSnow = intToBool(ground); getServerConfig().groundSnow = intToBool(ground);
if(falling == true && doesServerHaveFallingSnowEnabled()) {
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
} else if(falling == false && !doesServerHaveFallingSnowEnabled()) {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
}
if(ground == true && doesServerHaveGroundSnowEnabled()) {
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
} else if(ground == false && !doesServerHaveGroundSnowEnabled()) {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
}
updatePlayerSnowState(null); updatePlayerSnowState(null);
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -449,13 +449,7 @@ function setServerGUIColoursCommand(command, params, client) {
* *
*/ */
function toggleServerLogoCommand(command, params, client) { function toggleServerLogoCommand(command, params, client) {
if(doesServerHaveServerLogoEnabled()) { getServerConfig().useLogo = !getServerConfig().useLogo;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("ServerLogo"));
getServerConfig().useLogo = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("ServerLogo"));
getServerConfig().useLogo = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
updatePlayerShowLogoState(null, getServerConfig().useLogo); updatePlayerShowLogoState(null, getServerConfig().useLogo);
@@ -477,13 +471,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerJobBlipsCommand(command, params, client) { function toggleServerJobBlipsCommand(command, params, client) {
if(doesServerHaveJobBlipsEnabled()) { getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
getServerConfig().createJobBlips = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
getServerConfig().createJobBlips = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
@@ -503,13 +491,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerJobPickupsCommand(command, params, client) { function toggleServerJobPickupsCommand(command, params, client) {
if(doesServerHaveJobPickupsEnabled()) { getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
getServerConfig().createJobPickups = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
getServerConfig().createJobPickups = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
@@ -529,13 +511,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerBusinessBlipsCommand(command, params, client) { function toggleServerBusinessBlipsCommand(command, params, client) {
if(doesServerHaveBusinessBlipsEnabled()) { getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
getServerConfig().createBusinessBlips = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
getServerConfig().createBusinessBlips = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
@@ -555,13 +531,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerBusinessPickupsCommand(command, params, client) { function toggleServerBusinessPickupsCommand(command, params, client) {
if(doesServerHaveBusinessPickupsEnabled()) { getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
getServerConfig().createBusinessPickups = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
getServerConfig().createBusinessPickups = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
@@ -581,13 +551,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerHouseBlipsCommand(command, params, client) { function toggleServerHouseBlipsCommand(command, params, client) {
if(doesServerHaveHouseBlipsEnabled()) { getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
getServerConfig().createHouseBlips = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
getServerConfig().createHousePickups = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
@@ -607,13 +571,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerHousePickupsCommand(command, params, client) { function toggleServerHousePickupsCommand(command, params, client) {
if(doesServerHaveHousePickupsEnabled()) { getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
getServerConfig().createHousePickups = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
getServerConfig().createHousePickups = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`); messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
@@ -633,13 +591,7 @@ function toggleServerLogoCommand(command, params, client) {
* *
*/ */
function toggleServerGUICommand(command, params, client) { function toggleServerGUICommand(command, params, client) {
if(doesServerHaveGUIEnabled()) { getServerConfig().useGUI = !getServerConfig().useGUI;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
getServerConfig().useGUI = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
getServerConfig().useGUI = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
@@ -660,17 +612,11 @@ function toggleServerGUICommand(command, params, client) {
* *
*/ */
function toggleServerUseRealWorldTimeCommand(command, params, client) { function toggleServerUseRealWorldTimeCommand(command, params, client) {
if(doesServerHaveRealTimeEnabled()) { getServerConfig().useRealTime = !getServerConfig().useRealTime;
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
getServerConfig().useRealTime = false;
} else {
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
getServerConfig().useRealTime = true;
}
getServerConfig().needsSaved = true; getServerConfig().needsSaved = true;
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(doesServerHaveRealTimeEnabled()))} 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(); updateServerGameTime();
updateServerRules(); updateServerRules();
return true; return true;
@@ -803,67 +749,67 @@ function loadAccentConfig() {
// =========================================================================== // ===========================================================================
function doesServerHaveGUIEnabled() { function doesServerHaveGUIEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI")); return getServerConfig().useGUI;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveTesterOnlyEnabled() { function doesServerHaveTesterOnlyEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing")); return getServerConfig().testerOnly;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveRealTimeEnabled() { function doesServerHaveRealTimeEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime")); return getServerConfig().useRealTime;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveBusinessPickupsEnabled() { function doesServerHaveBusinessPickupsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups")); return getServerConfig().createBusinessPickups
} }
// =========================================================================== // ===========================================================================
function doesServerHaveHousePickupsEnabled() { function doesServerHaveHousePickupsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups")); return getServerConfig().createHousePickups;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveJobPickupsEnabled() { function doesServerHaveJobPickupsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups")); return getServerConfig().createJobPickups;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveBusinesBlipsEnabled() { function doesServerHaveBusinesBlipsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips")); return getServerConfig().createBusinessBlips;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveHouseBlipsEnabled() { function doesServerHaveHouseBlipsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips")); return getServerConfig().createHouseBlips;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveJobBlipsEnabled() { function doesServerHaveJobBlipsEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips")); return getServerConfig().createJobBlips;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveFallingSnowEnabled() { function doesServerHaveFallingSnowEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow")); return getServerConfig().fallingSnow;
} }
// =========================================================================== // ===========================================================================
function doesServerHaveGroundSnowEnabled() { function doesServerHaveGroundSnowEnabled() {
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow")); return getServerConfig().groundSnow;
} }
// =========================================================================== // ===========================================================================

View File

@@ -9,7 +9,7 @@
let scriptVersion = "1.0"; let scriptVersion = "1.0";
let serverStartTime = 0; let serverStartTime = 0;
let logLevel = LOG_ERROR|LOG_WARN|LOG_INFO; let logLevel = LOG_INFO;
// =========================================================================== // ===========================================================================
@@ -25,8 +25,8 @@ let serverData = {
itemTypes: [], itemTypes: [],
clans: [], clans: [],
antiCheat: { antiCheat: {
whiteListedGameScripts: [], //whiteListedGameScripts: [],
blackListedGameScripts: [], //blackListedGameScripts: [],
}, },
localeStrings: {}, localeStrings: {},
cachedTranslations: [], cachedTranslations: [],

View File

@@ -408,7 +408,7 @@ function onPlayerDeath(client, position) {
client.despawnPlayer(); client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestJail.interior; getPlayerCurrentSubAccount(client).interior = closestJail.interior;
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension; 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()) { if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0); fadeCamera(client, true, 1.0);
@@ -421,7 +421,7 @@ function onPlayerDeath(client, position) {
client.despawnPlayer(); client.despawnPlayer();
getPlayerCurrentSubAccount(client).interior = closestHospital.interior; getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension; 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()) { if(isFadeCameraSupported()) {
fadeCamera(client, true, 1.0); fadeCamera(client, true, 1.0);
@@ -596,6 +596,14 @@ function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`); logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
updateAllPlayerNameTags(); updateAllPlayerNameTags();
if(!areServerElementsSupported()) {
sendAllBusinessEntrancesToPlayer(client);
sendAllHouseEntrancesToPlayer(client);
//sendAllJobLocationsToPlayer(client);
}
requestPlayerPedNetworkId(client);
getPlayerData(client).payDayTickStart = sdl.ticks; getPlayerData(client).payDayTickStart = sdl.ticks;
//} //}
} }

View File

@@ -873,6 +873,7 @@ function createHouseEntrancePickup(houseId) {
pickupModelId = getHouseData(houseId).entrancePickupModel; pickupModelId = getHouseData(houseId).entrancePickupModel;
} }
if(areServerElementsSupported()) {
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house); getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false); setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension); setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
@@ -897,15 +898,17 @@ function createHouseEntranceBlip(houseId) {
blipModelId = getHouseData(houseId).entranceBlipModel; blipModelId = getHouseData(houseId).entranceBlipModel;
} }
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen")); if(areServerElementsSupported()) {
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension); getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false); setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance); setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance); setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
setElementTransient(getHouseData(houseId).entranceBlip, false); setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false); setElementTransient(getHouseData(houseId).entranceBlip, false);
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false); setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
addToWorld(getHouseData(houseId).entranceBlip); setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).entranceBlip);
}
} }
} }
@@ -924,13 +927,16 @@ function createHouseExitPickup(houseId) {
pickupModelId = getHouseData(houseId).exitPickupModel; pickupModelId = getHouseData(houseId).exitPickupModel;
} }
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house); if(areServerElementsSupported()) {
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension); getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false); setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance); setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance); setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
setElementTransient(getHouseData(houseId).exitPickup, false); setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
addToWorld(getHouseData(houseId).exitPickup); setElementTransient(getHouseData(houseId).exitPickup, false);
addToWorld(getHouseData(houseId).exitPickup);
}
updateHousePickupLabelData(houseId);
} }
} }
} }
@@ -950,15 +956,17 @@ function createHouseExitBlip(houseId) {
blipModelId = getHouseData(houseId).exitBlipModel; blipModelId = getHouseData(houseId).exitBlipModel;
} }
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen")); if(areServerElementsSupported()) {
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension); getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false); setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance); setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance); setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
setElementTransient(getHouseData(houseId).exitBlip, false); setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false); setElementTransient(getHouseData(houseId).exitBlip, false);
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false); setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
addToWorld(getHouseData(houseId).exitBlip); setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
addToWorld(getHouseData(houseId).exitBlip);
}
} }
} }
} }
@@ -1140,6 +1148,10 @@ function doesHouseHaveInterior(houseId) {
// =========================================================================== // ===========================================================================
function deleteHouseEntrancePickup(houseId) { function deleteHouseEntrancePickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entrancePickup != null) { if(getHouseData(houseId).entrancePickup != null) {
//removeFromWorld(getHouseData(houseId).entrancePickup); //removeFromWorld(getHouseData(houseId).entrancePickup);
deleteGameElement(getHouseData(houseId).entrancePickup); deleteGameElement(getHouseData(houseId).entrancePickup);
@@ -1150,6 +1162,10 @@ function deleteHouseEntrancePickup(houseId) {
// =========================================================================== // ===========================================================================
function deleteHouseExitPickup(houseId) { function deleteHouseExitPickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitPickup != null) { if(getHouseData(houseId).exitPickup != null) {
//removeFromWorld(getHouseData(houseId).exitPickup); //removeFromWorld(getHouseData(houseId).exitPickup);
deleteGameElement(getHouseData(houseId).exitPickup); deleteGameElement(getHouseData(houseId).exitPickup);
@@ -1160,6 +1176,10 @@ function deleteHouseExitPickup(houseId) {
// =========================================================================== // ===========================================================================
function deleteHouseEntranceBlip(houseId) { function deleteHouseEntranceBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entranceBlip != null) { if(getHouseData(houseId).entranceBlip != null) {
//removeFromWorld(getHouseData(houseId).entranceBlip); //removeFromWorld(getHouseData(houseId).entranceBlip);
deleteGameElement(getHouseData(houseId).entranceBlip); deleteGameElement(getHouseData(houseId).entranceBlip);
@@ -1170,6 +1190,10 @@ function deleteHouseEntranceBlip(houseId) {
// =========================================================================== // ===========================================================================
function deleteHouseExitBlip(houseId) { function deleteHouseExitBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitBlip != null) { if(getHouseData(houseId).exitBlip != null) {
//removeFromWorld(getHouseData(houseId).exitBlip); //removeFromWorld(getHouseData(houseId).exitBlip);
deleteGameElement(getHouseData(houseId).exitBlip); deleteGameElement(getHouseData(houseId).exitBlip);
@@ -1265,19 +1289,19 @@ function getHouseIdFromDatabaseId(databaseId) {
// =========================================================================== // ===========================================================================
function sendPlayerHouseGameScripts(client, houseId) { //function sendPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) { // for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state); // sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
} // }
} //}
// =========================================================================== // ===========================================================================
function clearPlayerHouseGameScripts(client, houseId) { //function clearPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) { // for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY); // sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
} // }
} //}
// =========================================================================== // ===========================================================================
@@ -1411,6 +1435,10 @@ function getHouseFromParams(params) {
// =========================================================================== // ===========================================================================
function updateHousePickupLabelData(houseId) { function updateHousePickupLabelData(houseId) {
if(!areServerElementsSupported()) {
return false;
}
let houseData = getHouseData(houseId); let houseData = getHouseData(houseId);
if(houseData.entrancePickup != null) { if(houseData.entrancePickup != null) {

View File

@@ -1732,7 +1732,7 @@ function getItemValueDisplay(itemType, value) {
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_WALKIETALKIE) { } else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_WALKIETALKIE) {
return toString(toString(value).slice(0,-2)+"."+toString(value).slice(-1)+"MHz"); return toString(toString(value).slice(0,-2)+"."+toString(value).slice(-1)+"MHz");
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_VEHCOLOUR) { } else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_VEHCOLOUR) {
return `[${getGameData().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`; return `[${getGameConfig().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
} else { } else {
return value; return value;
} }

View File

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

View File

@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
let isEntrance = false; let isEntrance = false;
let isBusiness = false; let isBusiness = false;
if(!getPlayerData(client).currentPickup) { if(areServerElementsSupported()) {
return false; if(!getPlayerData(client).currentPickup) {
}
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; 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) { if(closestProperty == null) {
@@ -451,7 +481,7 @@ function gpsCommand(command, params, client) {
} else { } else {
let gameLocationId = getGameLocationFromParams(params); let gameLocationId = getGameLocationFromParams(params);
if(gameLocationId != false) { 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 { } else {
setPlayerDimension(client, 1); setPlayerDimension(client, 1);
setPlayerDimension(client, getGameData().mainWorldDimension[getGame()]); setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
setPlayerInterior(client, getGameData().mainWorldInterior[getGame()]); setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0)); setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
} }

View File

@@ -207,11 +207,11 @@ function removePlayerFromVehicle(client) {
// =========================================================================== // ===========================================================================
function setPlayerSkin(client, skinIndex) { 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]})`); 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) { if(getGame() == VRR_GAME_GTA_IV) {
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameData().skins[getGame()][skinIndex][0]); triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
} else { } else {
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0]; client.player.modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
} }
} }
@@ -429,7 +429,7 @@ function createGameObject(modelIndex, position) {
if(!isGameFeatureSupported("objects")) { if(!isGameFeatureSupported("objects")) {
return false; return false;
} }
return game.createObject(getGameData().objects[getGame()][modelIndex][0], position); return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
} }
// =========================================================================== // ===========================================================================
@@ -451,7 +451,7 @@ function destroyGameElement(element) {
// =========================================================================== // ===========================================================================
function isMeleeWeapon(weaponId, gameId = getServerGame()) { function isMeleeWeapon(weaponId, gameId = getServerGame()) {
return (getGameData().meleeWeapons[gameId].indexOf(weaponId) != -1); return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
} }
// =========================================================================== // ===========================================================================
@@ -539,7 +539,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
// =========================================================================== // ===========================================================================
function createGameVehicle(modelIndex, position, heading) { 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);
} }
// =========================================================================== // ===========================================================================
@@ -590,7 +590,7 @@ function setPlayerFightStyle(client, fightStyleId) {
return false; 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)); forcePlayerToSyncElementProperties(null, getPlayerElement(client));
} }

View File

@@ -46,7 +46,7 @@ function setStaffTitleCommand(command, params, client) {
return false; return false;
} }
let splitParams = params.split(""); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(getParam(params, " ", 1)); let targetClient = getPlayerFromParams(getParam(params, " ", 1));
let staffTitle = splitParams.slice(1).join(" "); let staffTitle = splitParams.slice(1).join(" ");
@@ -374,19 +374,19 @@ function gotoGameLocationCommand(command, params, client) {
} }
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0)); 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); setPlayerInterior(client, 0);
setPlayerDimension(client, 0); setPlayerDimension(client, 0);
updateInteriorLightsForPlayer(client, true); updateInteriorLightsForPlayer(client, true);
//setTimeout(function() { //setTimeout(function() {
// setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]); // setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
// setPlayerInterior(client, 0); // setPlayerInterior(client, 0);
// setPlayerDimension(client, 0); // setPlayerDimension(client, 0);
// updateInteriorLightsForPlayer(client, true); // updateInteriorLightsForPlayer(client, true);
//}, 500); //}, 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]}`);
} }
// =========================================================================== // ===========================================================================
@@ -999,7 +999,7 @@ function forcePlayerSkinCommand(command, params, client) {
// return false; // return false;
//} //}
let splitParams = params.split(""); let splitParams = params.split(" ");
let targetClient = getPlayerFromParams(splitParams[0]); let targetClient = getPlayerFromParams(splitParams[0]);
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame()); let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
@@ -1008,15 +1008,15 @@ function forcePlayerSkinCommand(command, params, client) {
return false; return false;
} }
if(skinIndex == false) { if(!skinIndex) {
messagePlayerError(client, "That skin is invalid!"); messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
return false; return false;
} }
getPlayerCurrentSubAccount(targetClient).skin = skinIndex; getPlayerCurrentSubAccount(targetClient).skin = skinIndex;
setPlayerSkin(targetClient, 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]}`);
} }
// =========================================================================== // ===========================================================================
@@ -1032,7 +1032,7 @@ function setPlayerHealthCommand(command, params, client) {
// return false; // return false;
//} //}
let splitParams = params.split(""); let splitParams = params.split(" ");
let targetClient = getParam(params, " ", 1); let targetClient = getParam(params, " ", 1);
let health = getParam(params, " ", 2); let health = getParam(params, " ", 2);
@@ -1112,7 +1112,7 @@ function forcePlayerWantedLevelCommand(command, params, client) {
forcePlayerWantedLevel(targetClient, wantedLevel); 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(); initLocaleScript();
initCommandScript(); initCommandScript();
initTimers();
serverStartTime = getCurrentUnixTimestamp(); serverStartTime = getCurrentUnixTimestamp();
initAllClients(); initAllClients();
initTimers();
} }
// =========================================================================== // ===========================================================================

View File

@@ -237,7 +237,7 @@ function showCharacterSelectToClient(client) {
let tempSubAccount = getPlayerData(client).subAccounts[0]; let tempSubAccount = getPlayerData(client).subAccounts[0];
let ClanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None"; let ClanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never"; 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); //spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
//setTimeout(function() { //setTimeout(function() {
@@ -321,7 +321,7 @@ function checkPreviousCharacter(client) {
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None"; let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never"; 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}`); 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 clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never"; 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}`); logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
} }
@@ -372,11 +372,16 @@ function selectCharacter(client, characterId = -1) {
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING; getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
if(getGame() < VRR_GAME_GTA_IV) { if(getGame() < VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension); spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
} else if(getGame() == VRR_GAME_GTA_IV) { } else if(getGame() == VRR_GAME_GTA_IV) {
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension); spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
//setPlayerSkin(client, skin);
//setPlayerPosition(client, spawnPosition);
//setPlayerHeading(client, spawnHeading);
//setPlayerInterior(client, spawnInterior);
//setPlayerDimension(client, spawnDimension);
} else if(getGame() >= VRR_GAME_MAFIA_ONE) { } else if(getGame() >= VRR_GAME_MAFIA_ONE) {
spawnPlayer(client, getGameData().skins[getGame()][skin][0], spawnPosition, spawnHeading); spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
} }
removePlayerKeyBind(client, getKeyIdFromParams("insert")); removePlayerKeyBind(client, getKeyIdFromParams("insert"));
@@ -481,6 +486,11 @@ function isPlayerCreatingCharacter(client) {
// =========================================================================== // ===========================================================================
/**
*
* @return {SubAccountData} - The player's current subaccount/character data
*
*/
function getPlayerCurrentSubAccount(client) { function getPlayerCurrentSubAccount(client) {
if(!getPlayerData(client)) { if(!getPlayerData(client)) {
return false; return false;
@@ -517,7 +527,7 @@ function setFightStyleCommand(command, params, client) {
if(!fightStyle) { if(!fightStyle) {
messagePlayerError(client, `That fight style doesn't exist!`); 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; return false;
} }
@@ -529,7 +539,7 @@ function setFightStyleCommand(command, params, client) {
} }
setPlayerFightStyle(client, fightStyleId); 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; return true;
} }
@@ -562,13 +572,13 @@ function forceFightStyleCommand(command, params, client) {
if(!fightStyleId) { if(!fightStyleId) {
messagePlayerError(client, `That fight style doesn't exist!`); 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; return false;
} }
getPlayerCurrentSubAccount(client).fightStyle = fightStyleId; getPlayerCurrentSubAccount(client).fightStyle = fightStyleId;
setPlayerFightStyle(client, 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; 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() { function saveAllServerDataToDatabase() {
if(getServerConfig().pauseSavingToDatabase) { if(getServerConfig().pauseSavingToDatabase) {
return false; return false;
@@ -136,14 +128,16 @@ function vehicleRentCheck() {
// Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected) // Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected)
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(getPlayerData(clients[i]) != false) { if(isClientInitialized(clients[i])) {
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) { if(getPlayerData(clients[i]) != false) {
if(getPlayerData(clients[i]).rentingVehicle != false) { if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) { if(getPlayerData(clients[i]).rentingVehicle != false) {
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`); if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
stopRentingVehicle(clients[i]); messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
} else { stopRentingVehicle(clients[i]);
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice); } else {
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
}
} }
} }
} }
@@ -176,10 +170,12 @@ function vehicleRentCheck() {
function updatePings() { function updatePings() {
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(!clients[i].console) { if(isClientInitialized(clients[i])) {
updatePlayerPing(clients[i]); if(!clients[i].console) {
if(isPlayerSpawned(clients[i])) { updatePlayerPing(clients[i]);
updatePlayerCash(clients[i]); if(isPlayerSpawned(clients[i])) {
updatePlayerCash(clients[i]);
}
} }
} }
} }
@@ -188,7 +184,7 @@ function updatePings() {
// =========================================================================== // ===========================================================================
function checkServerGameTime() { function checkServerGameTime() {
if(!getServerConfig().useRealTime) { //if(!getServerConfig().useRealTime) {
if(getServerConfig().minute >= 59) { if(getServerConfig().minute >= 59) {
getServerConfig().minute = 0; getServerConfig().minute = 0;
if(getServerConfig().hour >= 23) { if(getServerConfig().hour >= 23) {
@@ -199,11 +195,11 @@ function checkServerGameTime() {
} else { } else {
getServerConfig().minute = getServerConfig().minute + 1; getServerConfig().minute = getServerConfig().minute + 1;
} }
} else { //} else {
let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone); // let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
getServerConfig().hour = dateTime.getHours(); // getServerConfig().hour = dateTime.getHours();
getServerConfig().minute = dateTime.getMinutes(); // getServerConfig().minute = dateTime.getMinutes();
} //}
updateTimeRule(); updateTimeRule();
} }
@@ -213,14 +209,16 @@ function checkServerGameTime() {
function checkPayDays() { function checkPayDays() {
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) { if(isClientInitialized(clients[i])) {
getPlayerData(clients[i]).payDayStart = sdl.ticks; if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
playerPayDay(clients[i]); getPlayerData(clients[i]).payDayStart = sdl.ticks;
playerPayDay(clients[i]);
//if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) { //if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) {
// getPlayerData(clients[i]).payDayStart = sdl.ticks; // getPlayerData(clients[i]).payDayStart = sdl.ticks;
// playerPayDay(clients[i]); // playerPayDay(clients[i]);
//} //}
}
} }
} }
@@ -238,9 +236,11 @@ function showRandomTipToAllPlayers() {
let clients = getClients(); let clients = getClients();
for(let i in clients) { for(let i in clients) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) { if(isClientInitialized(clients[i])) {
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) { if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
messagePlayerTimedRandomTip(null, randomTips[tipId]); if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
messagePlayerTimedRandomTip(null, randomTips[tipId]);
}
} }
} }
} }

View File

@@ -52,7 +52,7 @@ function getAreaName(position) {
// =========================================================================== // ===========================================================================
function getGameAreas(gameId) { function getGameAreas(gameId) {
return getGameData().areas[gameId]; return getGameConfig().areas[gameId];
} }
// =========================================================================== // ===========================================================================
@@ -63,7 +63,9 @@ function getGameAreas(gameId) {
*/ */
function getPlayerData(client) { function getPlayerData(client) {
if(client != null) { if(client != null) {
return getServerData().clients[client.index]; if(isClientInitialized(client)) {
return getServerData().clients[client.index];
}
} }
return false; return false;
} }
@@ -79,30 +81,46 @@ function initAllClients() {
// =========================================================================== // ===========================================================================
function updateServerRules() { function updateServerRules() {
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
if(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()) { 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()) { 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) { function getWeatherFromParams(params) {
if(isNaN(params)) { if(isNaN(params)) {
for(let i in getGameData().weatherNames[getServerGame()]) { for(let i in getGameConfig().weatherNames[getServerGame()]) {
if(toLowerCase(getGameData().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(getGameConfig().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
return i; return i;
} }
} }
} else { } else {
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") { if(typeof getGameConfig().weatherNames[getServerGame()][params] != "undefined") {
return toInteger(params); return toInteger(params);
} }
} }
@@ -114,13 +132,13 @@ function getWeatherFromParams(params) {
function getFightStyleFromParams(params) { function getFightStyleFromParams(params) {
if(isNaN(params)) { if(isNaN(params)) {
for(let i in getGameData().fightStyles[getServerGame()]) { for(let i in getGameConfig().fightStyles[getServerGame()]) {
if(toLowerCase(getGameData().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(getGameConfig().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
return i; return i;
} }
} }
} else { } else {
if(typeof getGameData().fightStyles[getServerGame()][params] != "undefined") { if(typeof getGameConfig().fightStyles[getServerGame()][params] != "undefined") {
return toInteger(params); return toInteger(params);
} }
} }
@@ -132,26 +150,26 @@ function getFightStyleFromParams(params) {
function getClosestHospital(position) { function getClosestHospital(position) {
let closest = 0; let closest = 0;
for(let i in getGameData().hospitals[getServerGame()]) { for(let i in getGameConfig().hospitals[getServerGame()]) {
if(getDistance(getGameData().hospitals[getServerGame()][i].position, position) < getDistance(getGameData().hospitals[getServerGame()][closest].position, position)) { if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
closest = i; closest = i;
} }
} }
return getGameData().hospitals[getServerGame()][closest]; return getGameConfig().hospitals[getServerGame()][closest];
} }
// =========================================================================== // ===========================================================================
function getClosestPoliceStation(position) { function getClosestPoliceStation(position) {
let closest = 0; let closest = 0;
for(let i in getGameData().policeStations[getServerGame()]) { for(let i in getGameConfig().policeStations[getServerGame()]) {
if(getDistance(getGameData().policeStations[getServerGame()][i].position, position) < getDistance(getGameData().policeStations[getServerGame()][closest].position, position)) { if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
closest = i; closest = i;
} }
} }
return getGameData().policeStations[getServerGame()][closest]; return getGameConfig().policeStations[getServerGame()][closest];
} }
// =========================================================================== // ===========================================================================
@@ -190,8 +208,8 @@ function getPlayerIsland(client) {
// =========================================================================== // ===========================================================================
function isAtPayAndSpray(position) { function isAtPayAndSpray(position) {
for(let i in getGameData().payAndSprays[getServerGame()]) { for(let i in getGameConfig().payAndSprays[getServerGame()]) {
if(getDistance(position, getGameData().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) { if(getDistance(position, getGameConfig().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
return true; return true;
} }
} }
@@ -265,6 +283,7 @@ function showConnectCameraToPlayer(client) {
//setPlayerDimension(client, 0); //setPlayerDimension(client, 0);
setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt); setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
} }
setPlayer2DRendering(client, false, false, false, false, false, false);
} }
// =========================================================================== // ===========================================================================
@@ -429,4 +448,20 @@ function kickAllClients() {
getClients().forEach((client) => { getClients().forEach((client) => {
client.disconnect(); client.disconnect();
}) })
} }
// ===========================================================================
function updateTimeRule() {
if(isTimeSupported()) {
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
}
}
// ===========================================================================
function isClientInitialized(client) {
return (typeof getServerData().clients[client.index] != "undefined");
}
// ===========================================================================

View File

@@ -82,10 +82,10 @@ const VRR_MPMOD_GTAC = 1;
const VRR_MPMOD_MAFIAC = 2; const VRR_MPMOD_MAFIAC = 2;
// Business/House Game Script States // Business/House Game Script States
const VRR_GAMESCRIPT_NONE = 0; //const VRR_GAMESCRIPT_NONE = 0;
const VRR_GAMESCRIPT_DENY = 1; //const VRR_GAMESCRIPT_DENY = 1;
const VRR_GAMESCRIPT_ALLOW = 2; //const VRR_GAMESCRIPT_ALLOW = 2;
const VRR_GAMESCRIPT_FORCE = 3; //const VRR_GAMESCRIPT_FORCE = 3;
// Vehicle Purchase States // Vehicle Purchase States
const VRR_VEHBUYSTATE_NONE = 0; const VRR_VEHBUYSTATE_NONE = 0;

View File

@@ -2541,7 +2541,7 @@ let gameData = {
[594, "BeerCan"], [594, "BeerCan"],
[592, "BottleYellow"], [592, "BottleYellow"],
[500, "ArmourVest"], [500, "ArmourVest"],
[510, "PizzzBox"], [510, "PizzaBox"],
[597, "SodaBottle"], [597, "SodaBottle"],
[502, "GenericPackage2"] [502, "GenericPackage2"]
], ],
@@ -2603,7 +2603,9 @@ let gameData = {
[2601, "CanSoda"], [2601, "CanSoda"],
], ],
[], // GTA UG [], // GTA UG
[], // GTA IV [
// GTA IV
],
[], // GTA IV EFLC [], // GTA IV EFLC
[], // INVALID [], // INVALID
[], // INVALID [], // INVALID
@@ -2849,7 +2851,7 @@ let gameData = {
["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087, null], ["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], ["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], ["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], ["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], ["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], ["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200, null],
@@ -3318,10 +3320,18 @@ let gameData = {
], ],
meleeWeapons: [ meleeWeapons: [
[], [],
[1], [1], // III
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], // VC
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], // SA
[], [], // UG
[1, 3], // IV
[], // Invalid
[], // Invalid
[], // Invalid
[], // M1
[], // M2
[], // M3
[], // M1DE
], ],
blipSprites: [ blipSprites: [
false, false,
@@ -3405,15 +3415,25 @@ let gameData = {
Clothes: 50, Clothes: 50,
Pizza: 0, Pizza: 0,
Chicken: 22, Chicken: 22,
Burger: 10, Burger: 21,
Bar: 47, Bar: 47,
Club: 48, Club: 51,
Gym: 54, Gym: 54,
RepairGarage: 75, RepairGarage: 75,
Trophy: 81, Trophy: 81,
Race: 65, Race: 65,
Job: 80, Job: 80,
Misc: 0, Misc: 0,
ComedyClub: 70,
CabaretClub: 71,
Ransom: 72,
StripClub: 66,
Male: 63,
Female: 64,
TrainStation: 58,
Heart: 54,
Bowling: 49,
Internet: 24,
}, },
], ],
pickupModels: [ pickupModels: [
@@ -3488,6 +3508,24 @@ let gameData = {
{ {
// GTA Underground // 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: [ pickupTypes: [
{}, {},
@@ -3517,7 +3555,18 @@ let gameData = {
clothes: 1, clothes: 1,
info: 1, info: 1,
job: 1, job: 1,
} },
{
// GTA Underground
},
{ // GTA IV
business: -1,
house: -1,
bank: -1,
clothes: -1,
info: -1,
job: -1,
}
], ],
// THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD // THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD
@@ -3977,7 +4026,7 @@ let gameData = {
}, },
{}, // GTA UG {}, // GTA UG
{ // GTA IV { // GTA IV
clothingStore: [ ClothingStore: [
["Outfit", 500, 2] ["Outfit", 500, 2]
], ],
LegalGunStore: [ LegalGunStore: [
@@ -3997,8 +4046,8 @@ let gameData = {
["M4", 500, 2], ["M4", 500, 2],
["Beretta Shotgun", 500, 2], ["Beretta Shotgun", 500, 2],
["Sniper Rifle", 500, 2], ["Sniper Rifle", 500, 2],
["Micro Uzi Ammo", 500, 2],
["MP5 Ammo", 500, 2], ["MP5 Ammo", 500, 2],
["Micro Uzi Ammo", 500, 2],
["AK-47 Ammo", 500, 2], ["AK-47 Ammo", 500, 2],
["M4 Ammo", 500, 2], ["M4 Ammo", 500, 2],
["Beretta Shotgun Ammo", 500, 2], ["Beretta Shotgun Ammo", 500, 2],
@@ -4386,7 +4435,34 @@ let gameData = {
}, },
{ // GTA IV { // GTA IV
Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
House1: [toVector3(-426.16, 1466.52, 38.971), 0],
House2: [toVector3(-969.77, 883.27, 18.817), 0],
House3: [toVector3(95.75, 851.68, 45.051), 0],
House4: [toVector3(603.04, 1404.06, 17.479), 0],
House5: [toVector3(892.56, -502.13, 19.407), 0],
House6: [toVector3(-524.09, 830.54, 23.627), 0],
House7: [toVector3(806.36, 146.68, 29.243), 0],
House8: [toVector3(356.91, 1511.28, 21.432), 0],
House9: [toVector3(1319.40, -847.02, 8.872), 0],
House10: [toVector3(1331.40, 126.60, 36.558), 0],
House11: [toVector3(1387.81, 622.66, 35.857), 0],
House12: [toVector3(932.74, -189.29, 35.143), 0],
House13: [toVector3(-1397.85, 1473.89, 26.447), 0],
House14: [toVector3(806.36, 146.68, 29.243), 0],
House15: [toVector3(-526.49, 829.41, 23.627), 0],
Gym: [toVector3(403.31, 1480.32, 11.834), 0],
PoliceStation: [toVector3(-406.52, 286.57, 13.682), 0],
FancyRestaurant: [toVector3(-118.24, -259.06, 12.654), 0],
Basement: [toVector3(1304.38, -856.66, 5.490), 0],
Office1: [toVector3(-409.31, 285.49, 18.592), 0],
Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
Office3: [toVector3(817.64, -259.77, 15.343), 0],
Office4: [toVector3(-86.35, 56.70, 75.953), 0],
HospitalRoom: [toVector3(1240.00, 192.44, 33.553), 0],
Church: [toVector3(-286.72, -282.36, 15.632), 0],
Prison: [toVector3(-1082.69, -364.05, 7.404), 0],
Ship: [toVector3(-336.53, -1494.56, 9.945), 0],
}, },
{}, // GTA IV EFLC {}, // GTA IV EFLC
@@ -5353,5 +5429,21 @@ let gameData = {
0, // Mafia 3 0, // Mafia 3
0, // Mafia Definitive Edition 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) { function makeLargeNumberReadable(num) {
@@ -1537,13 +1541,7 @@ function isGameFeatureSupported(featureName) {
// =========================================================================== // ===========================================================================
function getAllowedSkins(gameId = getGame()) { function getAllowedSkins(gameId = getGame()) {
return getGameData().skins[gameId].filter(skin => skin[2] == true); return getGameConfig().skins[gameId].filter(skin => skin[2] == true);
}
// ===========================================================================
function getGameData() {
return gameData;
} }
// =========================================================================== // ===========================================================================
@@ -1561,7 +1559,7 @@ function getAllowedSkinIndexFromSkin(skin) {
// =========================================================================== // ===========================================================================
function getSkinIndexFromModel(model, gameId = getGame()) { function getSkinIndexFromModel(model, gameId = getGame()) {
let skins = getGameData().skins[gameId]; let skins = getGameConfig().skins[gameId];
for(let i in skins) { for(let i in skins) {
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) { if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
return i; return i;
@@ -1574,7 +1572,7 @@ function getSkinIndexFromModel(model, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getSkinIndexFromName(name, gameId = getGame()) { function getSkinIndexFromName(name, gameId = getGame()) {
let skins = getGameData().skins[gameId]; let skins = getGameConfig().skins[gameId];
for(let i in skins) { for(let i in skins) {
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) { if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
return i; return i;
@@ -1587,7 +1585,7 @@ function getSkinIndexFromName(name, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getObjectModelIndexFromModel(model, gameId = getGame()) { function getObjectModelIndexFromModel(model, gameId = getGame()) {
let objects = getGameData().objects[gameId]; let objects = getGameConfig().objects[gameId];
for(let i in objects) { for(let i in objects) {
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) { if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
return i; return i;
@@ -1600,7 +1598,7 @@ function getObjectModelIndexFromModel(model, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getGameName(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()) { function getVehicleModelIndexFromName(name, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId]; let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) { for(let i in vehicles) {
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) { if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
return i; return i;
@@ -1636,7 +1634,7 @@ function getVehicleModelIndexFromName(name, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getVehicleModelIndexFromModel(model, gameId = getGame()) { function getVehicleModelIndexFromModel(model, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId]; let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) { for(let i in vehicles) {
if(isNaN(model)) { if(isNaN(model)) {
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) { if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
@@ -1655,7 +1653,7 @@ function getVehicleModelIndexFromModel(model, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getVehicleModelFromName(name, gameId = getGame()) { function getVehicleModelFromName(name, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId]; let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) { for(let i in vehicles) {
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) { if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
return vehicles[i][0]; return vehicles[i][0];
@@ -1668,7 +1666,7 @@ function getVehicleModelFromName(name, gameId = getGame()) {
// =========================================================================== // ===========================================================================
function getVehicleNameFromModel(model, gameId = getGame()) { function getVehicleNameFromModel(model, gameId = getGame()) {
let vehicles = getGameData().vehicles[gameId]; let vehicles = getGameConfig().vehicles[gameId];
for(let i in vehicles) { for(let i in vehicles) {
if(isNaN(model)) { if(isNaN(model)) {
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) { 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 fromName = getSkinIndexFromName(params, gameId);
let fromModel = getSkinIndexFromModel(params, gameId); let fromModel = getSkinIndexFromModel(params, gameId);
@@ -1703,8 +1701,8 @@ function getSkinModelIndexFromParams(params, gameId = getServerGame()) {
// =========================================================================== // ===========================================================================
function getSkinNameFromModel(model, gameId = getServerGame()) { function getSkinNameFromModel(model, gameId = getGame()) {
let skins = getGameData().skins[gameId]; let skins = getGameConfig().skins[gameId];
for(let i in skins) { for(let i in skins) {
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) { if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
return skins[i][1]; return skins[i][1];
@@ -1716,8 +1714,8 @@ function getSkinNameFromModel(model, gameId = getServerGame()) {
// =========================================================================== // ===========================================================================
function getSkinModelFromName(name, gameId = getServerGame()) { function getSkinModelFromName(name, gameId = getGame()) {
let skins = getGameData().skins[gameId]; let skins = getGameConfig().skins[gameId];
for(let i in skins) { for(let i in skins) {
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) { if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
return skins[i][0]; 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 fromName = getObjectModelIndexFromName(params, gameId);
let fromModel = getObjectModelIndexFromModel(params, gameId); let fromModel = getObjectModelIndexFromModel(params, gameId);
@@ -1744,8 +1742,8 @@ function getObjectModelIndexFromParams(params, gameId = getServerGame()) {
// =========================================================================== // ===========================================================================
function getObjectNameFromModel(model, gameId = getServerGame()) { function getObjectNameFromModel(model, gameId = getGame()) {
let objects = getGameData().objects[gameId]; let objects = getGameConfig().objects[gameId];
for(let i in objects) { for(let i in objects) {
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) { if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
return objects[i][1]; return objects[i][1];
@@ -1757,8 +1755,8 @@ function getObjectNameFromModel(model, gameId = getServerGame()) {
// =========================================================================== // ===========================================================================
function getObjectModelFromName(name, gameId = getServerGame()) { function getObjectModelFromName(name, gameId = getGame()) {
let objects = getGameData().objects[gameId]; let objects = getGameConfig().objects[gameId];
for(let i in objects) { for(let i in objects) {
if(toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) { if(toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) {
return objects[i][0]; return objects[i][0];
@@ -2074,14 +2072,14 @@ async function waitUntil(condition) {
function getGameLocationFromParams(params) { function getGameLocationFromParams(params) {
if(isNaN(params)) { if(isNaN(params)) {
let locations = getGameData().locations[getGame()]; let locations = getGameConfig().locations[getGame()];
for(let i in locations) { for(let i in locations) {
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) { if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
return i; return i;
} }
} }
} else { } else {
if(typeof getGameData().locations[getGame()][params] != "undefined") { if(typeof getGameConfig().locations[getGame()][params] != "undefined") {
return toInteger(params); return toInteger(params);
} }
} }