1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 07:13:58 -05:00

more integration tweaks

add configurable flood protect interval for rcon
This commit is contained in:
RaidMax
2022-02-08 12:03:55 -06:00
parent 8989b5b987
commit cf2245a874
13 changed files with 388 additions and 288 deletions

View File

@ -26,7 +26,7 @@ let plugin = {
switch (eventType) {
case 'start':
const enabled = initialize(server);
if (!enabled) {
return;
}
@ -189,7 +189,11 @@ let commands = [{
targetRequired: true,
// optional
arguments: [{
name: 'alert message',
name: 'player',
required: true
},
{
name: 'message',
required: true
}],
supportedGames: ['IW4'],
@ -203,9 +207,11 @@ let commands = [{
}];
const sendScriptCommand = (server, command, target, data) => {
if (plugin.enabled) {
sendEvent(server, false, 'ExecuteCommandRequested', command, target, data);
const state = servers[server.EndPoint];
if (state === undefined || !state.enabled) {
return;
}
sendEvent(server, false, 'ExecuteCommandRequested', command, target, data);
}
const sendEvent = (server, responseExpected, event, subtype, client, data) => {
@ -272,7 +278,7 @@ const initialize = (server) => {
logger.WriteError(`Could not get integration status of ${server.EndPoint} - ${error}`);
}
logger.WriteDebug(`GSC Integration enabledGSC Integration enabled = ${enabled}`);
logger.WriteInfo(`GSC Integration enabled = ${enabled}`);
if (!enabled) {
servers[server.EndPoint] = {
@ -320,13 +326,13 @@ const pollForEvents = server => {
const event = parseEvent(input)
logger.WriteInfo(`Processing input... ${event.eventType}`);
logger.WriteDebug(`Processing input... ${event.eventType} ${event.subType} ${event.data} ${event.clientNumber}`);
if (event.eventType === 'ClientDataRequested') {
const client = server.GetClientByNumber(event.clientNumber);
if (client != null) {
logger.WriteInfo(`Found client ${client.Name}`);
logger.WriteDebug(`Found client ${client.Name}`);
let data = [];
@ -342,9 +348,9 @@ const pollForEvents = server => {
}
sendEvent(server, false, 'ClientDataReceived', event.subType, client, data);
} else {
logger.WriteWarning(`Could not find client slot ${event.clientNumber} when processing ${event.eventType}`);
}
logger.WriteWarning(`Could not find client slot ${event.clientNumber} when processing ${event.eventType}`);
}
try {

View File

@ -3,7 +3,7 @@ var eventParser;
var plugin = {
author: 'RaidMax',
version: 0.5,
version: 0.6,
name: 'IW4x Parser',
isParser: true,
@ -20,10 +20,11 @@ var plugin = {
rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0} "{1}"';
rconParser.Configuration.CommandPrefixes.TempBan = 'tempbanclient {0} "{1}"';
rconParser.Configuration.DefaultRConPort = 28960;
rconParser.Configuration.DefaultInstallationDirectoryHint = 'HKEY_CURRENT_USER\\Software\\Classes\\iw4x\\shell\\open\\command';
rconParser.Configuration.DefaultRConPort = 28960;
rconParser.Configuration.DefaultInstallationDirectoryHint = 'HKEY_CURRENT_USER\\Software\\Classes\\iw4x\\shell\\open\\command';
rconParser.Configuration.FloodProtectInterval = 50;
eventParser.Configuration.GameDirectory = 'userraw';
eventParser.Configuration.GameDirectory = 'userraw';
rconParser.Version = 'IW4x (v0.6.0)';
rconParser.GameName = 2; // IW4x
@ -37,4 +38,4 @@ var plugin = {
onTickAsync: function (server) {
}
};
};