removeip
0x001f04a0 · 851 bytes · __cdecl
_ZL8removeipRK8CCommand
Decompiled
undefined (1 param)
/* removeip(CCommand const&) */
void removeip(CCommand *param_1)
{
uint uVar1;
char cVar2;
int iVar3;
undefined1 *puVar4;
int *piVar5;
char *pcVar6;
int in_GS_OFFSET;
int local_50;
int local_4c;
char local_40 [32];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)param_1 < 1) {
ConMsg("Usage: removeip < slot | ipaddress >\n");
}
else {
pcVar6 = "";
if (*(int *)param_1 != 1) {
pcVar6 = *(char **)(param_1 + 0x40c);
}
iVar3 = _V_strstr(pcVar6,".");
pcVar6 = "";
if (iVar3 == 0) {
if (1 < *(int *)param_1) {
pcVar6 = *(char **)(param_1 + 0x40c);
}
iVar3 = V_atoi(pcVar6);
if ((iVar3 < 1) || (DAT_003b2460 < iVar3)) {
ConMsg("removeip: invalid slot %i\n",iVar3);
}
else {
uVar1 = g_IPFilters[(iVar3 + -1) * 4 + 1];
V_snprintf(local_40,0x20,"%3i.%3i.%3i.%3i",uVar1 & 0xff,uVar1 >> 8 & 0xff,
uVar1 >> 0x10 & 0xff,uVar1 >> 0x18);
CUtlVector<ipfilter_t,CUtlMemory<ipfilter_t,int>>::ShiftElementsLeft
((CUtlVector<ipfilter_t,CUtlMemory<ipfilter_t,int>> *)&g_IPFilters,iVar3 + -1,1);
puVar4 = &DAT_002c79d4;
DAT_003b2460 = DAT_003b2460 + -1;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("removeip: filter removed for %s, IP %s\n",puVar4,local_40);
piVar5 = (int *)(**(code **)(s_GameEventManager + 0x1c))
(&s_GameEventManager,"server_removeban",0,0);
if (piVar5 != (int *)0x0) {
(**(code **)(*piVar5 + 0x3c))(piVar5,"networkid",&DAT_002c79d4);
(**(code **)(*piVar5 + 0x3c))(piVar5,"ip",local_40);
pcVar6 = "Console";
if (cmd_source != 1) {
pcVar6 = (char *)(host_client + 0x3c);
}
(**(code **)(*piVar5 + 0x3c))(piVar5,"by",pcVar6);
(**(code **)(s_GameEventManager + 0x20))(&s_GameEventManager,piVar5,0);
}
}
}
else {
if (1 < *(int *)param_1) {
pcVar6 = *(char **)(param_1 + 0x40c);
}
cVar2 = Filter_ConvertString(pcVar6,(ipfilter_t *)&local_50);
if (cVar2 != '\0') {
if (0 < DAT_003b2460) {
iVar3 = 0;
piVar5 = g_IPFilters;
do {
if ((*piVar5 == local_50) && (piVar5[1] == local_4c)) {
CUtlVector<ipfilter_t,CUtlMemory<ipfilter_t,int>>::ShiftElementsLeft
((CUtlVector<ipfilter_t,CUtlMemory<ipfilter_t,int>> *)&g_IPFilters,iVar3,1);
puVar4 = &DAT_002c79d4;
DAT_003b2460 = DAT_003b2460 + -1;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("removeip: filter removed for %s\n",puVar4);
piVar5 = (int *)(**(code **)(s_GameEventManager + 0x1c))
(&s_GameEventManager,"server_removeban",0,0);
if (piVar5 != (int *)0x0) {
(**(code **)(*piVar5 + 0x3c))(piVar5,"networkid",&DAT_002c79d4);
puVar4 = &DAT_002c79d4;
if (1 < *(int *)param_1) {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
(**(code **)(*piVar5 + 0x3c))(piVar5,"ip",puVar4);
pcVar6 = "Console";
if (cmd_source != 1) {
pcVar6 = (char *)(host_client + 0x3c);
}
(**(code **)(*piVar5 + 0x3c))(piVar5,"by",pcVar6);
(**(code **)(s_GameEventManager + 0x20))(&s_GameEventManager,piVar5,0);
}
goto LAB_001f0630;
}
iVar3 = iVar3 + 1;
piVar5 = piVar5 + 4;
} while (iVar3 != DAT_003b2460);
}
if (*(int *)param_1 < 2) {
puVar4 = &DAT_002c79d4;
}
else {
puVar4 = *(undefined1 **)(param_1 + 0x40c);
}
ConMsg("removeip: couldn\'t find %s\n",puVar4);
}
}
}
LAB_001f0630:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.