PDA

View Full Version : Changing bot pings.



filthy_freak_
1st June 2015, 01:19
Credits to IzNoGoD for walking me through this <3

Put these functions in libcod.cpp


int gsc_libcod_getAddressType(int id) {
extern int playerinfo_base;
extern int playerinfo_size;

#if COD_VERSION == COD2_1_0
int info_addresstype_offset = 0x6E5C4;
#elif COD_VERSION == COD2_1_2
int info_addresstype_offset = 0x6E6D4;
#elif COD_VERSION == COD2_1_3
int info_addresstype_offset = 0x6E6D4;
#else
#warning getAddressType() got no working addresses
int info_addresstype_offset = 0x0;
#endif

int addrtype = *(int*)(*(int*)playerinfo_base + id * playerinfo_size + info_addresstype_offset);
}

cHook *hook_set_bot_pings;
void set_bot_pings()
{
hook_set_bot_pings->unhook();
int (*sig)();
*(int *)&sig = hook_set_bot_pings->from;
int ret = sig();
hook_set_bot_pings->hook();

extern int playerinfo_base;
extern int playerinfo_size;
int addrtype;
int i;

#if COD_VERSION == COD2_1_0
int offset = 0x0848B1CC;
int p = 113001;
#elif COD_VERSION == COD2_1_2
int offset = 0x0849E6CC;
int p = 113069;
#elif COD_VERSION == COD2_1_3
int offset = 0x0849F74C;
int p = 113069;
#else
#warning set_bot_pings() got no working addresses
int offset = 0x0;
int p = 0;
#endif

for (i = 0; i < *(int*)(*(int*)(offset) + 8); i++)
{
if(*(int*)(*(int*)playerinfo_base + i * playerinfo_size) == 4)
{
addrtype = gsc_libcod_getAddressType(i);
if(addrtype == 0)
*(int*)(*(int*)playerinfo_base + i * playerinfo_size + (p*4)) = 0;
}
}
}


Then search for


cracking_hook_function(0x08092D5C, (int)SV_AddServerCommand);

in libcod.cpp and add the following to your versions;


#if COD_VERSION == COD2_1_0
hook_set_bot_pings = new cHook(0x0809443E, (int)set_bot_pings);
hook_set_bot_pings->hook();
#elif COD_VERSION == COD2_1_2
hook_set_bot_pings = new cHook(0x0809630E, (int)set_bot_pings);
hook_set_bot_pings->hook();
#elif COD_VERSION == COD2_1_3
hook_set_bot_pings = new cHook(0x080963C8, (int)set_bot_pings);
hook_set_bot_pings->hook();



This will change bot pings from 999 to 0 or whatever you set


*(int*)(*(int*)playerinfo_base + i * playerinfo_size + (p*4)) = 0;

to.

857

kung foo man
1st June 2015, 03:23
Nice work :D

IzNoGoD
1st June 2015, 09:08
Some background info on this:
This script basically hooks the setpings() method and afterwards loops through all slots, checks if there's a connected player (status 4) in said slot, and sets its ping to 0 if its a bot. Normal players and not-fully-connected bots remain unaffected.