/** * SV_RemoveIP_f. */ private static void SVCmd_RemoveIP_f() { ipfilter_t f = new(); int i, j; if (GameBase.gi.argc() < 3) { GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "Usage: sv removeip <ip-mask>\n"); return; } if (!GameSVCmds.StringToFilter(GameBase.gi.argv(2), f)) { return; } for (i = 0; i < GameSVCmds.numipfilters; i++) { if (GameSVCmds.ipfilters[i].mask == f.mask && GameSVCmds.ipfilters[i].compare == f.compare) { for (j = i + 1; j < GameSVCmds.numipfilters; j++) { GameSVCmds.ipfilters[j - 1] = GameSVCmds.ipfilters[j]; } GameSVCmds.numipfilters--; GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "Removed.\n"); return; } } GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "Didn't find " + GameBase.gi.argv(2) + ".\n"); }
/** * SV_AddIP_f. */ private static void SVCmd_AddIP_f() { int i; if (GameBase.gi.argc() < 3) { GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "Usage: addip <ip-mask>\n"); return; } for (i = 0; i < GameSVCmds.numipfilters; i++) { if ((uint)GameSVCmds.ipfilters[i].compare == 0xffffffff) { break; // free spot } } if (i == GameSVCmds.numipfilters) { if (GameSVCmds.numipfilters == GameSVCmds.MAX_IPFILTERS) { GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "IP filter list is full\n"); return; } GameSVCmds.numipfilters++; } if (!GameSVCmds.StringToFilter(GameBase.gi.argv(2), GameSVCmds.ipfilters[i])) { GameSVCmds.ipfilters[i].compare = unchecked ((int)0xffffffff); } }