Post: [C++]Proper way of getting Mapname and Gametype
06-23-2015, 05:04 AM #1
SC58
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({}); Hello NGU

Here is a script i use to get the mapname and gametype

You could normally do Dvar_GetString but that return tdm for team death match and map name returns mp_XX

But using these functions it will return the Asset of the names to be the correct thing instead of doing if gametype = tdm return Team Death Match or whatever

You must login or register to view this content.

You must login or register to view this content.

    
struct StringTableCell
{
const char *string;
int hash;
};

struct StringTable
{
const char *name;
int columnCount;
int rowCount;
StringTableCell *values;
short *cellIndex;
};

#define ui_mapname 0x1C4B120
#define ui_gametype 0x1C4B168

0x370D9C - const char * UI_SafeTranslateString(const char *reference);
0x3D31CC - void StringTable_GetAsset(const char *filename, StringTable **tablePtr);
0x3D2A40 - const char * StringTable_Lookup(StringTable *table, const int comparisonColumn, const char *value, const int valueColumn);
0x3D2AF4 - const char * StringTable_Lookup2(StringTable *table, const int comparisonColumn1, const char *value1, const int comparisonColumn2, const char *value2, const int valueColumn);
0x3E58B0 - int va(const char *format, ...);
0x31A080 - bool GetGameMode(); // i don't know the function name as it's not in any .pdb, anyways it detects whether your in mp or zm
0x3DAE50 - const char * Dvar_GetString(int dvarPointer); // all Dvar_X are int pointer on BOII no longer string like all other cods

StringTable *gameTypeTable;

const char * UI_GetGameTypeName()
{
const char * filename;
if (GetGameMode())
filename = "zm/gametypesTable.csv";
else
filename = "mp/gametypesTable.csv";
StringTable_GetAsset(filename, &gameTypeTable);
return UI_SafeTranslateString(StringTable_Lookup2(gameTypeTable, 0, (const char *)va("%d", 0), 1, Dvar_GetString(*(int*)ui_gametype), 2));
}

StringTable *mapTable;

const char * UI_GetMapName()
{
const char * filename;
if (GetGameMode())
filename = "zm/mapsTable.csv";
else
filename = "mp/mapsTable.csv";
StringTable_GetAsset(filename, &mapTable);
return UI_SafeTranslateString(StringTable_Lookup(mapTable, 0, Dvar_GetString(*(int*)ui_mapname), 3));
}


You must login or register to view this content.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 12 users say thank you to SC58 for this useful post:

Armyspy, Boliberrys, BullyWiiPlaza, Chris, HiddenHour, iLuiis, LaRip8, LBK, RGaming, thahitcrew
06-23-2015, 05:09 AM #2
Chris
Former Staff
Sick as fuck bro, as always. Hope to see more releases from you soon :p
06-23-2015, 06:25 AM #3
iLuiis
Who’s Jim Erased?
ayy ++c da best tho muy bueno tutorial
06-23-2015, 01:50 PM #4
Originally posted by SC58 View Post
Hello NGU

Here is a script i use to get the mapname and gametype

You could normally do Dvar_GetString but that return tdm for team death match and map name returns mp_XX

But using these functions it will return the Asset of the names to be the correct thing instead of doing if gametype = tdm return Team Death Match or whatever

You must login or register to view this content.

You must login or register to view this content.

    
struct StringTableCell
{
const char *string;
int hash;
};

struct StringTable
{
const char *name;
int columnCount;
int rowCount;
StringTableCell *values;
short *cellIndex;
};

#define ui_mapname 0x1C4B120
#define ui_gametype 0x1C4B168

0x370D9C - const char * UI_SafeTranslateString(const char *reference);
0x3D31CC - void StringTable_GetAsset(const char *filename, StringTable **tablePtr);
0x3D2A40 - const char * StringTable_Lookup(StringTable *table, const int comparisonColumn, const char *value, const int valueColumn);
0x3D2AF4 - const char * StringTable_Lookup2(StringTable *table, const int comparisonColumn1, const char *value1, const int comparisonColumn2, const char *value2, const int valueColumn);
0x3E58B0 - int va(const char *format, ...);
0x31A080 - bool GetGameMode(); // i don't know the function name as it's not in any .pdb, anyways it detects whether your in mp or zm
0x3DAE50 - const char * Dvar_GetString(int dvarPointer); // all Dvar_X are int pointer on BOII no longer string like all other cods

StringTable *gameTypeTable;

const char * UI_GetGameTypeName()
{
const char * filename;
if (GetGameMode())
filename = "zm/gametypesTable.csv";
else
filename = "mp/gametypesTable.csv";
StringTable_GetAsset(filename, &gameTypeTable);
return UI_SafeTranslateString(StringTable_Lookup2(gameTypeTable, 0, (const char *)va("%d", 0), 1, Dvar_GetString(*(int*)ui_gametype), 2));
}

StringTable *mapTable;

const char * UI_GetMapName()
{
const char * filename;
if (GetGameMode())
filename = "zm/mapsTable.csv";
else
filename = "mp/mapsTable.csv";
StringTable_GetAsset(filename, &mapTable);
return UI_SafeTranslateString(StringTable_Lookup(mapTable, 0, Dvar_GetString(*(int*)ui_mapname), 3));
}


You must login or register to view this content.


There's no "proper" way to get the mapname, it's basically a other way you can do it.
Although would I use this than using the other method? Absolutely Winky Winky
06-23-2015, 03:13 PM #5
SC58
Former Staff
Originally posted by EyeX32 View Post
There's no "proper" way to get the mapname, it's basically a other way you can do it.
Although would I use this than using the other method? Absolutely Winky Winky


true, but i would use this instead of having my code like as thats the only other way of doing it pretty much to return ur own name if u would like then the game set name for it but i suppose whatever anyone want to use

const char * getgametype()
{
if(gametype == tdm)
{
return team death match
}
etc
}
06-23-2015, 08:08 PM #6
Originally posted by SC58 View Post
Hello NGU

Here is a script i use to get the mapname and gametype

You could normally do Dvar_GetString but that return tdm for team death match and map name returns mp_XX

But using these functions it will return the Asset of the names to be the correct thing instead of doing if gametype = tdm return Team Death Match or whatever

You must login or register to view this content.

You must login or register to view this content.

    
struct StringTableCell
{
const char *string;
int hash;
};

struct StringTable
{
const char *name;
int columnCount;
int rowCount;
StringTableCell *values;
short *cellIndex;
};

#define ui_mapname 0x1C4B120
#define ui_gametype 0x1C4B168

0x370D9C - const char * UI_SafeTranslateString(const char *reference);
0x3D31CC - void StringTable_GetAsset(const char *filename, StringTable **tablePtr);
0x3D2A40 - const char * StringTable_Lookup(StringTable *table, const int comparisonColumn, const char *value, const int valueColumn);
0x3D2AF4 - const char * StringTable_Lookup2(StringTable *table, const int comparisonColumn1, const char *value1, const int comparisonColumn2, const char *value2, const int valueColumn);
0x3E58B0 - int va(const char *format, ...);
0x31A080 - bool GetGameMode(); // i don't know the function name as it's not in any .pdb, anyways it detects whether your in mp or zm
0x3DAE50 - const char * Dvar_GetString(int dvarPointer); // all Dvar_X are int pointer on BOII no longer string like all other cods

StringTable *gameTypeTable;

const char * UI_GetGameTypeName()
{
const char * filename;
if (GetGameMode())
filename = "zm/gametypesTable.csv";
else
filename = "mp/gametypesTable.csv";
StringTable_GetAsset(filename, &gameTypeTable);
return UI_SafeTranslateString(StringTable_Lookup2(gameTypeTable, 0, (const char *)va("%d", 0), 1, Dvar_GetString(*(int*)ui_gametype), 2));
}

StringTable *mapTable;

const char * UI_GetMapName()
{
const char * filename;
if (GetGameMode())
filename = "zm/mapsTable.csv";
else
filename = "mp/mapsTable.csv";
StringTable_GetAsset(filename, &mapTable);
return UI_SafeTranslateString(StringTable_Lookup(mapTable, 0, Dvar_GetString(*(int*)ui_mapname), 3));
}


You must login or register to view this content.


It's nice to se you still releasing stuff like this :p
06-23-2015, 09:56 PM #7
SC58
Former Staff
Originally posted by Panther View Post
It's nice to se you still releasing stuff like this :p


Yeah haha, thanks Smile

The following user thanked SC58 for this useful post:

06-26-2015, 01:32 PM #8
LBK
Little One
It's very nice job sc :p keep it up !!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo