Merge branch 'nightly'

This commit is contained in:
Vortrex
2022-03-08 10:31:29 -06:00
24 changed files with 497 additions and 531 deletions

View File

@@ -115,6 +115,7 @@
<!-- Client Scripts -->
<script src="scripts/client/afk.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" />

View File

@@ -0,0 +1,52 @@
// ===========================================================================
// 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(index, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
this.index = index;
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);
businesses.splice(getBusinessData(businessId).index, 1);
} else {
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 {
if(blipModel != -1) {
let blipId = natives.addBlipForCoord(entrancePosition);
if(blipId) {
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
tempBusinessData.blipId = blipId;
natives.changeBlipSprite(blipId, blipModel);
natives.setBlipMarkerLongDistance(blipId, true);
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
businesses.push(tempBusinessData);
}
}
}
}
}
// ===========================================================================

View File

@@ -249,6 +249,15 @@ function renderJobLabel(name, position, jobType) {
function processLabelRendering() {
if(renderLabels && areWorldLabelsSupported()) {
if(localPlayer != null) {
if(!areServerElementsSupported()) {
//for(let i in businesses) {
// if(pickups[i].getData("vrr.label.type") != null) {
// if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
// natives.getScreenViewportId
// natives.getGameViewportId
// natives.getViewportPositionOfCoord
} else {
let pickups = getElementsByType(ELEMENT_PICKUP);
for(let i in pickups) {
if(pickups[i].getData("vrr.label.type") != null) {
@@ -292,6 +301,7 @@ function processLabelRendering() {
}
}
}
}
}
// -------------------------------------------------------------------------

View File

@@ -69,4 +69,8 @@ let forceWantedLevel = 0;
// Pre-cache all allowed skins
let allowedSkins = getAllowedSkins(getGame());
let businesses = {};
let houses = {};
let jobs = {};
// ===========================================================================

View File

@@ -85,7 +85,6 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
@@ -101,6 +100,13 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.logLevel", setLogLevel);
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
}
// ===========================================================================
@@ -205,18 +211,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() {
sendServerClientInfo();
}
@@ -266,6 +260,9 @@ function setElementCollisionsEnabled(elementId, state) {
function setLocalPlayerPedPartsAndProps(parts, props) {
for(let i in parts) {
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
}
for(let i in props) {
localPlayer.changeBodyProp(props[0], props[1]);
}
}
@@ -312,3 +309,17 @@ function setLocalPlayerSkin(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

@@ -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(5.0);
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();
// ===========================================================================

View File

@@ -14,18 +14,6 @@ function processSync(event, deltaTime) {
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(!calledDeathEvent) {
logToConsole(LOG_DEBUG, `Local player died`);
@@ -391,17 +379,11 @@ function syncElementProperties(element) {
}
}
// ===========================================================================
function receiveBlipFromServer(model, position) {
if(getGame() == VRR_GAME_GTA_IV) {
}
}
// ===========================================================================
function receivePickupFromServer(model, position) {
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() {
if(localPlayer.vehicle == null) {
let tempVehicle = getClosestVehicle(localPlayer.position);
if(getGame() != VRR_GAME_GTA_IV) {
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);
}
}
}
}
}
@@ -404,7 +412,11 @@ function clearLocalPedState() {
// ===========================================================================
function getWeaponSlot(weaponId) {
return weaponSlots[game.game][weaponId];
if(getGame() == VRR_GAME_GTA_IV) {
return false;
}
return weaponSlots[getGame()][weaponId];
}
// ===========================================================================
@@ -501,6 +513,10 @@ function setLocalPlayerCash(amount) {
if(typeof localPlayer.money != "undefined") {
localPlayer.money = toInteger(amount);
}
if(getGame() == VRR_GAME_GTA_IV) {
natives.setMultiplayerHudCash(amount);
}
}
// ===========================================================================
@@ -618,12 +634,12 @@ function forceLocalPlayerEquippedWeaponItem() {
if(forceWeapon != 0) {
if(localPlayer.weapon != forceWeapon) {
localPlayer.weapon = forceWeapon;
if(getGame() <= VRR_GAME_GTA_IV) {
if(getGame() < VRR_GAME_GTA_IV) {
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
}
} else {
if(getGame() <= VRR_GAME_GTA_IV) {
if(getGame() < VRR_GAME_GTA_IV) {
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
}
@@ -748,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() {
if(game.game < VRR_GAME_GTA_IV) {
game.clearMessages();

View File

@@ -63,8 +63,7 @@ function listAccentsCommand(command, params, client) {
let chunkedList = splitArrayIntoChunks(accentList, 8);
messagePlayerInfo(client, `{clanOrange}== {jobYellow}Accents {clanOrange}==================================`);
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentList")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
@@ -112,7 +111,7 @@ function addAccentCommand(command, params, client) {
getGlobalConfig().accents.push(newAccentName);
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);
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;
//sendRemovedWorldObjectsToPlayer(client);
sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow"));

View File

@@ -9,57 +9,8 @@
function initAntiCheatScript() {
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
getServerData().antiCheat.whiteListedGameScripts = loadAntiCheatGameScriptWhiteListFromDatabase();
getServerData().antiCheat.blackListedGameScripts = loadAntiCheatGameScriptBlackListFromDatabase();
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) {
if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("ExemptFromAntiCheat"))) {
return true;

View File

@@ -58,7 +58,7 @@ function loadBusinessesFromDatabase() {
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
let tempBusinessData = new BusinessData(dbAssoc);
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
tempBusinesses.push(tempBusinessData);
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) {
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!`);
return tempBusinessGameScripts;
}
*/
// ===========================================================================
@@ -1336,10 +1338,6 @@ function createAllBusinessBlips() {
// ===========================================================================
function createBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(!getServerConfig().createBusinessPickups) {
return false;
}
@@ -1359,6 +1357,8 @@ function createBusinessEntrancePickup(businessId) {
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
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);
}
}
}
@@ -1388,6 +1388,8 @@ function createBusinessEntranceBlip(businessId) {
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
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);
}
}
}
@@ -1551,6 +1553,10 @@ function doesBusinessHaveInterior(businessId) {
// ===========================================================================
function deleteBusinessEntrancePickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup);
deleteGameElement(getBusinessData(businessId).entrancePickup);
@@ -1561,6 +1567,10 @@ function deleteBusinessEntrancePickup(businessId) {
// ===========================================================================
function deleteBusinessExitPickup(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup);
deleteGameElement(getBusinessData(businessId).exitPickup);
@@ -1571,6 +1581,10 @@ function deleteBusinessExitPickup(businessId) {
// ===========================================================================
function deleteBusinessEntranceBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).entranceBlip != null) {
//removeFromWorld(getBusinessData(businessId).entranceBlip);
deleteGameElement(getBusinessData(businessId).entranceBlip);
@@ -1581,6 +1595,10 @@ function deleteBusinessEntranceBlip(businessId) {
// ===========================================================================
function deleteBusinessExitBlip(businessId) {
if(!areServerElementsSupported()) {
return false;
}
if(getBusinessData(businessId).exitBlip != null) {
//removeFromWorld(getBusinessData(businessId).exitBlip);
deleteGameElement(getBusinessData(businessId).exitBlip);
@@ -2042,19 +2060,19 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
// ===========================================================================
function sendPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
}
}
//function sendPlayerBusinessGameScripts(client, businessId) {
// for(let i in getBusinessData(businessId).gameScripts) {
// sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
// }
//}
// ===========================================================================
function clearPlayerBusinessGameScripts(client, businessId) {
for(let i in getBusinessData(businessId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
}
}
//function clearPlayerBusinessGameScripts(client, businessId) {
// for(let i in getBusinessData(businessId).gameScripts) {
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
// }
//}
// ===========================================================================

View File

@@ -62,11 +62,11 @@ class ServerData {
this.antiCheat = {
enabled: false,
checkGameScripts: false,
gameScriptWhiteListEnabled: false,
gameScriptBlackListEnabled: false,
gameScriptWhiteList: [],
gameScriptBlackList: [],
//checkGameScripts: false,
//gameScriptWhiteListEnabled: false,
//gameScriptBlackListEnabled: false,
//gameScriptWhiteList: [],
//gameScriptBlackList: [],
};
this.discordBotToken = "";
@@ -113,38 +113,14 @@ class ServerData {
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
this.weather = toInteger(dbAssoc["svr_start_weather"]);
this.fallingSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("FallingSnow"));
this.groundSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("GroundSnow"));
this.useGUI = hasBitFlag(this.settings, getServerSettingsFlagValue("GUI"));
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
this.showLogo = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
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.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.useRealTime = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
this.discordConfig = {
@@ -263,6 +239,8 @@ class ClientData {
this.locale = 0;
this.enteringVehicle = null;
this.pedId = -1;
}
};
@@ -672,7 +650,7 @@ class HouseData {
this.itemCache = [];
this.locations = [];
this.gameScripts = [];
//this.gameScripts = [];
this.entrancePosition = false;
this.entranceRotation = 0.0;

View File

@@ -74,6 +74,7 @@ function addAllNetworkHandlers() {
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
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) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
let tempHotBarItems = [];
@@ -1053,12 +1031,6 @@ function setPlayerHeadLookPosition(client, position) {
// ===========================================================================
function sendPlayerGameScriptState(client, scriptName, state) {
sendNetworkEventToPlayer("vrr.gameScript", client, scriptName, state);
}
// ===========================================================================
function requestClientInfo(client) {
sendNetworkEventToPlayer("vrr.clientInfo", client);
}
@@ -1078,7 +1050,10 @@ function forcePlayerToSyncElementProperties(client, element) {
// ===========================================================================
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]);
}
// ===========================================================================
@@ -1147,3 +1122,43 @@ function sendHouseEntranceToPlayer(client, houseId, entrancePosition, blipModel,
}
// ==========================================================================
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"),
],
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("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
],

View File

@@ -131,6 +131,22 @@ function loadServerConfigFromId(tempServerId) {
if(dbQuery.numRows > 0) {
let dbAssoc = fetchQueryAssoc(dbQuery);
let tempServerConfigData = new ServerData(dbAssoc);
tempServerConfigData.fallingSnow = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("FallingSnow"));
tempServerConfigData.groundSnow = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("GroundSnow"));
tempServerConfigData.useGUI = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("GUI"));
tempServerConfigData.showLogo = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Logo"));
tempServerConfigData.testerOnly = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Testing"));
tempServerConfigData.discordEnabled = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("DiscordBot"));
tempServerConfigData.createJobPickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("JobPickups"));
tempServerConfigData.createBusinessPickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("BusinessPickups"));
tempServerConfigData.createHousePickups = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("HousePickups"));
tempServerConfigData.createJobBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("JobBlips"));
tempServerConfigData.createBusinessBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("BusinessBlips"));
tempServerConfigData.createHouseBlips = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("HouseBlips"));
tempServerConfigData.useRealTime = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("RealTime"));
tempServerConfigData.antiCheat.enabled = hasBitFlag(tempServerConfigData.settings, getServerSettingsFlagValue("Anticheat"));
freeDatabaseQuery(dbQuery);
return tempServerConfigData;
}

View File

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

View File

@@ -596,6 +596,14 @@ function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
updateAllPlayerNameTags();
if(!areServerElementsSupported()) {
sendAllBusinessEntrancesToPlayer(client);
sendAllHouseEntrancesToPlayer(client);
//sendAllJobLocationsToPlayer(client);
}
requestPlayerPedNetworkId(client);
getPlayerData(client).payDayTickStart = sdl.ticks;
//}
}

View File

@@ -1140,6 +1140,10 @@ function doesHouseHaveInterior(houseId) {
// ===========================================================================
function deleteHouseEntrancePickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entrancePickup != null) {
//removeFromWorld(getHouseData(houseId).entrancePickup);
deleteGameElement(getHouseData(houseId).entrancePickup);
@@ -1150,6 +1154,10 @@ function deleteHouseEntrancePickup(houseId) {
// ===========================================================================
function deleteHouseExitPickup(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitPickup != null) {
//removeFromWorld(getHouseData(houseId).exitPickup);
deleteGameElement(getHouseData(houseId).exitPickup);
@@ -1160,6 +1168,10 @@ function deleteHouseExitPickup(houseId) {
// ===========================================================================
function deleteHouseEntranceBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).entranceBlip != null) {
//removeFromWorld(getHouseData(houseId).entranceBlip);
deleteGameElement(getHouseData(houseId).entranceBlip);
@@ -1170,6 +1182,10 @@ function deleteHouseEntranceBlip(houseId) {
// ===========================================================================
function deleteHouseExitBlip(houseId) {
if(!areServerElementsSupported()) {
return false;
}
if(getHouseData(houseId).exitBlip != null) {
//removeFromWorld(getHouseData(houseId).exitBlip);
deleteGameElement(getHouseData(houseId).exitBlip);
@@ -1265,19 +1281,19 @@ function getHouseIdFromDatabaseId(databaseId) {
// ===========================================================================
function sendPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
}
}
//function sendPlayerHouseGameScripts(client, houseId) {
// for(let i in getHouseData(houseId).gameScripts) {
// sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
// }
//}
// ===========================================================================
function clearPlayerHouseGameScripts(client, houseId) {
for(let i in getHouseData(houseId).gameScripts) {
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
}
}
//function clearPlayerHouseGameScripts(client, houseId) {
// for(let i in getHouseData(houseId).gameScripts) {
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
// }
//}
// ===========================================================================

View File

@@ -481,6 +481,11 @@ function isPlayerCreatingCharacter(client) {
// ===========================================================================
/**
*
* @return {SubAccountData} - The player's current subaccount/character data
*
*/
function getPlayerCurrentSubAccount(client) {
if(!getPlayerData(client)) {
return false;

View File

@@ -128,6 +128,7 @@ function vehicleRentCheck() {
// Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected)
let clients = getClients();
for(let i in clients) {
if(isClientInitialized(clients[i])) {
if(getPlayerData(clients[i]) != false) {
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
if(getPlayerData(clients[i]).rentingVehicle != false) {
@@ -141,6 +142,7 @@ function vehicleRentCheck() {
}
}
}
}
/*
for(let i in getServerData().vehicles) {
@@ -168,6 +170,7 @@ function vehicleRentCheck() {
function updatePings() {
let clients = getClients();
for(let i in clients) {
if(isClientInitialized(clients[i])) {
if(!clients[i].console) {
updatePlayerPing(clients[i]);
if(isPlayerSpawned(clients[i])) {
@@ -175,6 +178,7 @@ function updatePings() {
}
}
}
}
}
// ===========================================================================
@@ -205,6 +209,7 @@ function checkServerGameTime() {
function checkPayDays() {
let clients = getClients();
for(let i in clients) {
if(isClientInitialized(clients[i])) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
getPlayerData(clients[i]).payDayStart = sdl.ticks;
playerPayDay(clients[i]);
@@ -215,6 +220,7 @@ function checkPayDays() {
//}
}
}
}
for(let i in getServerData().businesses) {
if(getBusinessData(i).ownerType != VRR_BIZOWNER_NONE && getBusinessData(i).ownerType != VRR_BIZOWNER_PUBLIC && getBusinessData(i).ownerType != VRR_BIZOWNER_FACTION) {
@@ -230,12 +236,14 @@ function showRandomTipToAllPlayers() {
let clients = getClients();
for(let i in clients) {
if(isClientInitialized(clients[i])) {
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
messagePlayerTimedRandomTip(null, randomTips[tipId]);
}
}
}
}
}
// ===========================================================================

View File

@@ -63,8 +63,10 @@ function getGameAreas(gameId) {
*/
function getPlayerData(client) {
if(client != null) {
if(isClientInitialized(client)) {
return getServerData().clients[client.index];
}
}
return false;
}
@@ -456,3 +458,9 @@ function updateTimeRule() {
}
// ===========================================================================
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;
// Business/House Game Script States
const VRR_GAMESCRIPT_NONE = 0;
const VRR_GAMESCRIPT_DENY = 1;
const VRR_GAMESCRIPT_ALLOW = 2;
const VRR_GAMESCRIPT_FORCE = 3;
//const VRR_GAMESCRIPT_NONE = 0;
//const VRR_GAMESCRIPT_DENY = 1;
//const VRR_GAMESCRIPT_ALLOW = 2;
//const VRR_GAMESCRIPT_FORCE = 3;
// Vehicle Purchase States
const VRR_VEHBUYSTATE_NONE = 0;

View File

@@ -2541,7 +2541,7 @@ let gameData = {
[594, "BeerCan"],
[592, "BottleYellow"],
[500, "ArmourVest"],
[510, "PizzzBox"],
[510, "PizzaBox"],
[597, "SodaBottle"],
[502, "GenericPackage2"]
],
@@ -2603,7 +2603,9 @@ let gameData = {
[2601, "CanSoda"],
],
[], // GTA UG
[], // GTA IV
[
// GTA IV
],
[], // GTA IV EFLC
[], // INVALID
[], // INVALID
@@ -3405,15 +3407,25 @@ let gameData = {
Clothes: 50,
Pizza: 0,
Chicken: 22,
Burger: 10,
Burger: 21,
Bar: 47,
Club: 48,
Club: 51,
Gym: 54,
RepairGarage: 75,
Trophy: 81,
Race: 65,
Job: 80,
Misc: 0,
ComedyClub: 70,
CabaretClub: 71,
Ransom: 72,
StripClub: 66,
Male: 63,
Female: 64,
TrainStation: 58,
Heart: 54,
Bowling: 49,
Internet: 24,
},
],
pickupModels: [