@arbytez/cod4-rcon-commands
Version:
A simple wrapper library to the rcon commands you can send to a cod4 server. Response data for commands '_status_', '_rconStatus_' and '_info_' is parsed into custom type object, so it is possible to easily manage the server status/info.
743 lines (640 loc) • 25 kB
JavaScript
import dgram from 'dgram';
import iconv from 'iconv-lite';
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function createCommand(command, rcon) {
if (rcon === void 0) {
rcon = '';
}
var cmd = '';
if (rcon) {
cmd = "rcon " + rcon + " " + command;
} else {
cmd = "" + command;
}
var bufferTemp = iconv.encode(cmd, 'ascii');
var bufferSend = new Uint8Array(bufferTemp.length + 5);
bufferSend[0] = iconv.encode('255', 'ascii');
bufferSend[1] = iconv.encode('255', 'ascii');
bufferSend[2] = iconv.encode('255', 'ascii');
bufferSend[3] = iconv.encode('255', 'ascii');
bufferSend[4] = iconv.encode('02', 'ascii');
var j = 4;
for (var i = 0; i < bufferTemp.length; i++) {
bufferSend[j++] = bufferTemp[i];
}
bufferSend[bufferSend.length - 1] = iconv.encode('00', 'ascii');
return bufferSend;
}
var sendUdpMessage = function sendUdpMessage(host, port, rcon, message, maxTimeOut) {
if (rcon === void 0) {
rcon = '';
}
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
return new Promise(function (resolve, reject) {
try {
var out = '';
var socket = dgram.createSocket('udp4');
socket.send(createCommand(message, rcon), port, host);
socket.on('message', function (incomingMessage, _rinfo) {
var res = Buffer.from(incomingMessage).toString().replace('����print', '').replace('����infoResponse', '').replace('����statusResponse', '').replace('\n', '');
out += res;
});
setTimeout(function () {
socket.close();
resolve(out);
}, maxTimeOut);
} catch (error) {
reject(error.message);
}
});
};
var executeRconCommand = function executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, command, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
try {
return Promise.resolve(sendUdpMessage(cod4ServerIp, cod4ServerPort, cod4ServerRcon, command, maxTimeOut));
} catch (e) {
return Promise.reject(e);
}
};
var executeCommand = function executeCommand(cod4ServerIp, cod4ServerPort, command, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
try {
return Promise.resolve(sendUdpMessage(cod4ServerIp, cod4ServerPort, '', command, maxTimeOut));
} catch (e) {
return Promise.reject(e);
}
};
var getOnlinePlayerFullInfo = function getOnlinePlayerFullInfo(cod4ServerIp, cod4ServerPort, cod4ServerRcon, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
try {
return Promise.resolve(executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'status', maxTimeOut)).then(function (resCommand) {
var lines = resCommand.split('\n');
var players = [];
lines.forEach(function (line, _i) {
var patternPl = /^\s*(\d+)\s+(-?\d+)\s+(\d+)\s+(\d+)\s+([a-fA-F0-9]{16,32}|\d+) (.+?)\s+(\d+) (\d+\.\d+\.\d+\.\d+):(\-?\d+)\s+(\-?\d+)\s+(\d+)$/;
var lineParsed = line.match(patternPl);
if (lineParsed) {
var playerParsed = {
num: parseInt(lineParsed[1]),
score: parseInt(lineParsed[2]),
ping: parseInt(lineParsed[3]),
id: lineParsed[4].trim(),
steamId: lineParsed[5].trim(),
name: lineParsed[6].trim(),
lastmsg: parseInt(lineParsed[7]),
ip: lineParsed[8].trim(),
port: parseInt(lineParsed[9]),
qport: parseInt(lineParsed[10]),
rate: parseInt(lineParsed[11])
};
if (playerParsed.name && playerParsed.name.endsWith('^7')) {
playerParsed.name = playerParsed.name.slice(0, playerParsed.name.length - 2);
}
players.push(playerParsed);
}
});
players = players.sort(function (a, b) {
return (b.score || 0) - (a.score || 0);
});
return players;
});
} catch (e) {
return Promise.reject(e);
}
};
var rconStatus = function rconStatus(cod4ServerIp, cod4ServerPort, cod4ServerRcon, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
try {
return Promise.resolve(Promise.all([getStatus(cod4ServerIp, cod4ServerPort, 200), getOnlinePlayerFullInfo(cod4ServerIp, cod4ServerPort, cod4ServerRcon, maxTimeOut)])).then(function (serverStatus) {
return _extends({}, serverStatus[0], {
onlinePlayers: serverStatus[1]
});
});
} catch (e) {
return Promise.reject(e);
}
};
var getInfo = function getInfo(cod4ServerIp, cod4ServerPort, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
try {
return Promise.resolve(executeCommand(cod4ServerIp, cod4ServerPort, 'getinfo', maxTimeOut)).then(function (getInfo) {
var infos = getInfo.split('\\');
var infoObj = {};
for (var i = 2; i < infos.length; i = i + 2) {
infoObj[infos[i - 1]] = infos[i];
}
var serverInfo = {
build: infoObj.build || '',
clients: Number(infoObj.clients || 0),
ff: Number(infoObj.ff || NaN),
g_humanplayers: Number(infoObj.g_humanplayers || 0),
game: infoObj.game || '',
gametype: infoObj.gametype || '',
hc: Number(infoObj.hc || NaN),
hostname: infoObj.hostname || '',
hw: Number(infoObj.hw || NaN),
ki: Number(infoObj.ki || NaN),
mapname: infoObj.mapname || '',
mod: Number(infoObj.mod || NaN),
od: Number(infoObj.od || NaN),
protocol: Number(infoObj.protocol || NaN),
pswrd: infoObj.pswrd || '',
pure: Number(infoObj.pure || NaN),
shortversion: infoObj.shortversion || '',
sv_maxclients: Number(infoObj.sv_maxclients || 0),
type: Number(infoObj.type || NaN),
voice: Number(infoObj.voice || NaN)
};
return serverInfo;
});
} catch (e) {
return Promise.reject(e);
}
};
var getStatus = function getStatus(cod4ServerIp, cod4ServerPort, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
try {
return Promise.resolve(executeCommand(cod4ServerIp, cod4ServerPort, 'getstatus', maxTimeOut)).then(function (getStatus) {
var lines = getStatus.split('\n');
var status = lines[0].split('\\');
var statusObj = {};
var onlinePlayers = [];
for (var i = 2; i < status.length; i = i + 2) {
statusObj[status[i - 1]] = status[i];
}
for (var _i2 = 1; _i2 < lines.length; _i2++) {
var line = lines[_i2];
var patternPlayerInfo = /^(-?\d+)\s+(-?\d+)\s+"(.*)"$/;
var lineParsed = line.match(patternPlayerInfo);
if (lineParsed) {
onlinePlayers.push({
score: Number(lineParsed[1]),
ping: lineParsed[2],
name: lineParsed[3].trim()
});
}
}
onlinePlayers = onlinePlayers.sort(function (a, b) {
return (b.score || 0) - (a.score || 0);
});
var mapStartDate;
var parsedDate = Date.parse(statusObj.g_mapStartTime);
if (!isNaN(parsedDate)) {
statusObj.g_mapStartTime = new Date(parsedDate);
}
if (Object.prototype.toString.call(statusObj.g_mapStartTime) === '[object Date]') {
mapStartDate = statusObj.g_mapStartTime;
}
var serverStatus = {
online: Boolean(statusObj.sv_hostname),
ip: String(cod4ServerIp),
port: String(cod4ServerPort),
sv_hostname: statusObj.sv_hostname || '',
g_gametype: statusObj.g_gametype || '',
sv_maxclients: Number(statusObj.sv_maxclients || 0),
uptime: statusObj.uptime || '',
g_mapStartTime: mapStartDate ? mapStartDate : new Date(),
sv_privateClients: Number(statusObj.sv_privateClients || 0),
fs_game: statusObj._Mod || statusObj.fs_game || '',
version: statusObj.version || '',
mapname: statusObj.mapname || '',
onlinePlayers: onlinePlayers || [],
branch: statusObj.branch || '',
build: statusObj.build || '',
g_compassShowEnemies: Number(statusObj.g_compassShowEnemies || NaN),
gamename: statusObj.gamename || '',
protocol: Number(statusObj.protocol || NaN),
revision: statusObj.revision || '',
shortversion: statusObj.shortversion || '',
sv_disableClientConsole: Number(statusObj.sv_disableClientConsole || NaN),
sv_floodprotect: Number(statusObj.sv_floodprotect || NaN),
sv_maxPing: Number(statusObj.sv_maxPing || NaN),
sv_maxRate: Number(statusObj.sv_maxRate || NaN),
sv_minPing: Number(statusObj.sv_minPing || NaN),
sv_pure: Number(statusObj.sv_pure || NaN),
sv_voice: Number(statusObj.sv_voice || NaN),
type: Number(statusObj.type || NaN)
};
return serverStatus;
});
} catch (e) {
return Promise.reject(e);
}
};
var createRconCommands = function createRconCommands(cod4ServerIp, cod4ServerPort, cod4ServerRcon) {
if (cod4ServerRcon === void 0) {
cod4ServerRcon = '';
}
return {
execRconCmd: function execRconCmd(rconCommand, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, rconCommand, maxTimeOut);
},
rconStatus: function rconStatus$1(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
return rconStatus(cod4ServerIp, cod4ServerPort, cod4ServerRcon, maxTimeOut);
},
info: function info(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return getInfo(cod4ServerIp, cod4ServerPort, maxTimeOut);
},
status: function status(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
return getStatus(cod4ServerIp, cod4ServerPort, maxTimeOut);
},
cmdlist: function cmdlist(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'cmdlist', maxTimeOut);
},
cvarlist: function cvarlist(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'cvarlist', maxTimeOut);
},
fast_restart: function fast_restart(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'fast_restart', maxTimeOut);
},
tell: function tell(user, message, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "tell " + user + " " + message, maxTimeOut);
},
say: function say(message, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "say " + message, maxTimeOut);
},
set: function set(variable, value, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "set " + variable + " " + value, maxTimeOut);
},
exec: function exec(filename, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "exec " + filename, maxTimeOut);
},
getss: function getss(user, filename, maxTimeOut) {
if (filename === void 0) {
filename = '';
}
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, filename ? "getss " + user + " " + filename : "getss " + user, maxTimeOut);
},
which: function which(file, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "which " + file, maxTimeOut);
},
path: function path(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'path', maxTimeOut);
},
map_rotate: function map_rotate(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'map_rotate', maxTimeOut);
},
kick: function kick(user, reason, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "kick " + user + " " + reason, maxTimeOut);
},
dumpbanlist: function dumpbanlist(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 1000;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'dumpbanlist', maxTimeOut);
},
loadPlugin: function loadPlugin(plugin, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "loadPlugin " + plugin, maxTimeOut);
},
unloadPlugin: function unloadPlugin(plugin, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "unloadPlugin " + plugin, maxTimeOut);
},
ministatus: function ministatus(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 500;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'ministatus', maxTimeOut);
},
tempban: function tempban(user, time, reason, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "tempban " + user + " " + time + " " + reason, maxTimeOut);
},
dumpuser: function dumpuser(user, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "dumpuser " + user, maxTimeOut);
},
map: function map(_map, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "map " + _map, maxTimeOut);
},
permban: function permban(user, reason, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "permban " + user + " " + reason, maxTimeOut);
},
record: function record(user, demoname, maxTimeOut) {
if (demoname === void 0) {
demoname = '';
}
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, demoname ? "record " + user + " " + demoname : "record " + user, maxTimeOut);
},
screentell: function screentell(user, message, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "screentell " + user + " " + message, maxTimeOut);
},
screensay: function screensay(message, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "screensay " + message, maxTimeOut);
},
map_restart: function map_restart(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'map_restart', maxTimeOut);
},
sets: function sets(variable, value, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "sets " + variable + " " + value, maxTimeOut);
},
unban: function unban(playerid, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "unban " + playerid, maxTimeOut);
},
getmodules: function getmodules(user, filename, maxTimeOut) {
if (filename === void 0) {
filename = '';
}
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, filename ? "getmodules " + user + " " + filename : "getmodules " + user, maxTimeOut);
},
systeminfo: function systeminfo(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'systeminfo', maxTimeOut);
},
serverinfo: function serverinfo(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'serverinfo', maxTimeOut);
},
undercover: function undercover(slot, onoff, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "undercover " + slot + " " + onoff, maxTimeOut);
},
AdminChangeCommandPower: function AdminChangeCommandPower(commmand, newMinPower, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "AdminChangeCommandPower " + commmand + " " + newMinPower, maxTimeOut);
},
addCommand: function addCommand(commandname, stringToExecute, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "addCommand " + commandname + " " + stringToExecute, maxTimeOut);
},
seta: function seta(variable, value, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "seta " + variable + " " + value, maxTimeOut);
},
XAssetUsage: function XAssetUsage(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'XAssetUsage', maxTimeOut);
},
stoprecord: function stoprecord(user, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "stoprecord " + user, maxTimeOut);
},
killserver: function killserver(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'killserver', maxTimeOut);
},
ChangePassword: function ChangePassword(oldpass, newpass, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "ChangePassword " + oldpass + " " + newpass, maxTimeOut);
},
AdminChangePassword: function AdminChangePassword(user, newpass, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "AdminChangePassword " + user + " " + newpass, maxTimeOut);
},
AdminListAdmins: function AdminListAdmins(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'AdminListAdmins', maxTimeOut);
},
AdminAddAdmin: function AdminAddAdmin(user, power, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "AdminAddAdmin " + user + " " + power, maxTimeOut);
},
AdminRemoveAdmin: function AdminRemoveAdmin(user, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "AdminRemoveAdmin " + user, maxTimeOut);
},
gametype: function gametype(gametypename, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "gametype " + gametypename, maxTimeOut);
},
writenvcfg: function writenvcfg(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'writenvcfg', maxTimeOut);
},
pluginInfo: function pluginInfo(plugin, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "pluginInfo " + plugin, maxTimeOut);
},
plugins: function plugins(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'plugins', maxTimeOut);
},
writeconfig: function writeconfig(filename, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "writeconfig " + filename, maxTimeOut);
},
quit: function quit(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'quit', maxTimeOut);
},
net_restart: function net_restart(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'net_restart', maxTimeOut);
},
zonememinfo: function zonememinfo(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'zonememinfo', maxTimeOut);
},
setu: function setu(variable, value, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "setu " + variable + " " + value, maxTimeOut);
},
reset: function reset(variable, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "reset " + variable, maxTimeOut);
},
setcvartotime: function setcvartotime(variable, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "setcvartotime " + variable, maxTimeOut);
},
setfromcvar: function setfromcvar(destcvar, sourcecvar, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "setfromcvar " + destcvar + " " + sourcecvar, maxTimeOut);
},
toggle: function toggle(variable, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "toggle " + variable, maxTimeOut);
},
echo: function echo(message, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "echo " + message, maxTimeOut);
},
vstr: function vstr(variable, maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 100;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, "vstr " + variable, maxTimeOut);
},
meminfo: function meminfo(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'meminfo', maxTimeOut);
},
AdminListCommands: function AdminListCommands(maxTimeOut) {
if (maxTimeOut === void 0) {
maxTimeOut = 200;
}
return executeRconCommand(cod4ServerIp, cod4ServerPort, cod4ServerRcon, 'AdminListCommands', maxTimeOut);
}
};
};
export { createRconCommands };
//# sourceMappingURL=cod4-rcon-commands.esm.js.map