Remove game script control (will use another resource)
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -2058,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);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -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),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
let scriptVersion = "1.0";
|
let scriptVersion = "1.0";
|
||||||
let serverStartTime = 0;
|
let serverStartTime = 0;
|
||||||
let logLevel = LOG_DEBUG;
|
let logLevel = LOG_INFO;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -25,8 +25,8 @@ let serverData = {
|
|||||||
itemTypes: [],
|
itemTypes: [],
|
||||||
clans: [],
|
clans: [],
|
||||||
antiCheat: {
|
antiCheat: {
|
||||||
whiteListedGameScripts: [],
|
//whiteListedGameScripts: [],
|
||||||
blackListedGameScripts: [],
|
//blackListedGameScripts: [],
|
||||||
},
|
},
|
||||||
localeStrings: {},
|
localeStrings: {},
|
||||||
cachedTranslations: [],
|
cachedTranslations: [],
|
||||||
|
|||||||
@@ -1281,19 +1281,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);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user