Post: Get Host Index
08-21-2014, 08:42 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I made this function to get the host index so you can make your menus easier. It took me a while to get this because I had to find a strcmp function that would work for me. Thanks to BadLuckBrian for it! Anyways here you go.

You'll need the following:
    
opd_s Dvar_GetString_t = { 0x00276F60, 0x00724C38 };
const char*(*Dvar_GetString)(const char* Dvar) = (const char*(*)(const char*))&Awesome facevar_GetString_t;

int getPlayerState(int client, int mod)
{
return 0x14E2200 + (client * 0x3700) + mod;
}

int xstrCmp(const char* str1, const char* str2)
{
int diff = 0;

if (*(str1) == 0x00 || *(str2) == 0x00) { return -1; }

for (int i = 0; i < 0x600; i++)
{
if (*(str1 + i) == 0x00 || *(str2 + i) == 0x00) { break; }
if (*(str1 + i) != *(str2 + i)) { diff++; }
}

return diff;
}



And here is the function it's self
    
int GetHostIndex()
{
for (int i = 0; i<18; i++)
if (xstrCmp(Dvar_GetString("sv_hostname"), (char*)getPlayerState(i, 0x3290)) == 0)
return i;
}


Thanks to seb, badluckbrian
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to Black Panther for this useful post:

Ariel R., Zambie
08-22-2014, 10:52 AM #2
Nice Bro, The Mw2 TOC = 0x00724C38 Right?
08-22-2014, 01:15 PM #3
Originally posted by JonnyWalker View Post
Nice Bro, The Mw2 TOC = 0x00724C38 Right?


yeah.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo