View Single Post
Author Message
GlowingTree
New Member
Join Date: Dec 2021
Location: Guangdong-China
Old 01-31-2022 , 00:58   [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
Reply With Quote #1

Hello everyone, I am a newbie in signature scanning and SDKCall using.

I am trying to make a function in coop mode that when special infecteds all dead and there is only a bot tank in the spot, the bot tank will evade to find a cover instead of continuing approaching to survivors and taking damage.

I have tried to use BossZombiePlayerBot::ShouldRetreatToCover signature

PHP Code:
_DWORD __cdecl BossZombiePlayerBot::ShouldRetreatToCover(BossZombiePlayerBot *__hidden this
because i could not found any function like ChargerEvade::ChargerEvade(void) or BoomerRetreatToCover::BoomerRetreatToCover(Bo omerRetreatToCover *__hidden this, TerrorNavArea *) on tank.

In linux, the call sequence is probably like this:

PHP Code:
BossZombiePlayerBot::ShouldRetreatToCover -> CDirector::SpecialsShouldRetreatToCover -> CDirectorChallengeMode::SpecialsShouldRetreatToCover 
there is a string "cm_SpecialsRetreatToCover" in "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" so we can scan the string to find BossZombiePlayerBot::ShouldRetreatToCover signature.

But in server.dll binary i have tried to find string "cm_SpecialsRetreatToCover" an go to it's xref "sub_1025ADB0", i think it is "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" function but there is no an "Up" xref to "sub_1025ADB0" which mean i couldn't find "CDirector::SpecialsShouldRetreatToCover" signature.

So i am confused in how to find "BossZombiePlayerBot::ShouldRetreatToCove r" signature in windowsT^T

I also have tried to use SDKCall to call "CDirector::SpecialsShouldRetreatToCover" directly in linux server, the code is like this
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

#define GAMEDATA "test"

Handle g_hRetreatToCover;

public 
void OnPluginStart()
{
    
Handle g_hGameConf LoadGameConfigFile("test");
    if (
g_hGameConf == INVALID_HANDLE)
    {
        
SetFailState("can't read test in gamedata folder");
    }
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(g_hGameConfSDKConf_Signature"BossZombiePlayerBot::ShouldRetreatToCover");
    
g_hRetreatToCover EndPrepSDKCall();
    if (
g_hRetreatToCover == INVALID_HANDLE)
    {
        
SetFailState("can't read signature BossZombiePlayerBot::ShouldRetreatToCover");
    }
    
RegConsoleCmd("sm_ret"Cmd_Retreat);
}

public 
Action Cmd_Retreat(int clientint args)
{
    if (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == && !IsFakeClient(client))
    {
        
int iTank;
        for (
int i 1MaxClientsi++)
        {
            if (
IsValidEntity(i))
            {
                if (
GetEntProp(iProp_Send"m_zombieClass") == 8)
                {
                    
iTank i;
                }
            }
        }
        
SDKCall(g_hRetreatToCoveriTank);
        
PrintToChatAll("\x03info:SDKCall finished");
    }

The test.txt in gamedata folder is like this
PHP Code:
"Games"
{
    
"left4dead2"
    
{
        
"Signatures"
        
{
            
/*
            *  BossZombiePlayerBot::ShouldRetreatToCover(BossZombiePlayerBot *__hidden this)
            */
            
"BossZombiePlayerBot::ShouldRetreatToCover"
            
{
                
"library"    "server"
                "linux"    "@_ZNK19BossZombiePlayerBot20ShouldRetreatToCoverEv"
            
}
        }
    }

The code has no effect when i spawned a tank and type !ret in the chat, there may be some mistakes in the code because i couldn't use SDKCall proficientlyT^T
May be we could use another method to achieve this function

Last edited by GlowingTree; 01-31-2022 at 01:00.
GlowingTree is offline