Skip to content

Fix bms_bot console spam #299

@MyGamepedia

Description

@MyGamepedia

They are very useful for debugging. The only major issue with the bots is heavy console spam (?every tick?). I tried to fix it myself, but I still don't get why my hook don't want to work.
The method that causes this issue is char * __thiscall CBaseClient::GetUserSetting(CBaseClient *this,char *param_1), you can find it by string "GetUserSetting: cvar'". The only thing we need is to check the second (charprt) param for strings "cl_defaultweapon", "cl_weapon_autoswitch" and "cl_toggle_duck". If one of these appears, just return empty string.
Image

Here is stuff I already did.

Confing:

			"CBaseClient::GetUserSetting" //find by string ''GetUserSetting: cvar''
			{
				"windows"	"\x55\x8B\xEC\x56\x57\x8B\xF9\x8B\x8F\x84\x00\x00\x00\x85\xC9\x74\x2A\x8B\x75\x08\x85\xF6\x74\x2A\x80\x3E\x00\x74\x2A\x53\x68\x2A\x2A\x2A\x2A\x56\xE8\x2A\x2A\x2A\x2A"
				"linux"		"_ZNK11CBaseClient14GetUserSettingEPKc"
			}

			"CBaseClient::GetUserSetting"
			{
				"signature"	"CBaseClient::GetUserSetting"
				"callconv"	"thiscall"
				"return"	"charptr"
				"this"		"entity"
				"arguments"
				{
					"pchCvar"
					{
						"type" "charptr"
					}
				}
			}

SourcePawn:

public MRESReturn Hook_GetUserSettings(int _this, DHookReturn hReturn, DHookParam hParams)
{
    char szCvar[MAX_FORMAT];
    DHookGetParamString(hParams, 1, szCvar, sizeof(szCvar));

    int iClient = _this;

    if(IsFakeClient(iClient) && StrEqual(szCvar, "cl_toggle_duck"))
    {
        DHookSetReturnString(hReturn, "");
        return MRES_Supercede;
    }

    return MRES_Ignored;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions