Code:
CON_COMMAND(xtra_tablelist, "display network string tables")
{
char *tablename;
//int stringcnt;
bool save = engine->LockNetworkStringTables(false);
int NumberOfTables = networkstringtable->GetNumTables();
int theTable = 0;
INetworkStringTable *elTable = NULL;
Msg("\nName\tStrings\n");
while (theTable < NumberOfTables)
{
elTable = networkstringtable->GetTable(theTable);
tablename = (char *)elTable->GetTableName();
//stringcnt = elTable->GetNumStrings();
if (tablename) {
Msg(tablename);
//Msg("\t");
//Msg((char *)stringcnt);
Msg("\n");
}
theTable++;
}
engine->LockNetworkStringTables(save);
Msg("End of table names...\n");
}
CON_COMMAND(xtra_tablestrings, "display strings in specified table")
{
const char *tablename = engine->Cmd_Argv(1);
if (tablename) {
bool save = engine->LockNetworkStringTables(false);
INetworkStringTable *elTable = networkstringtable->FindTable(tablename);
int NumberOfStrings = elTable->GetNumStrings();
int theString = 0;
char *buffa;
sprintf(buffa,"All Strings for table \'%s\':\n",tablename);
Msg(buffa);
while (theString < NumberOfStrings) {
Msg(elTable->GetString(theString));
Msg("\n");
theString++;
}
engine->LockNetworkStringTables(save);
Msg("End of table names...\n");
}
else { Msg("No table specified. Use xtra_tablelist to get a list of string tables,\n"); }
}
Above are two commands I am using to view the INetworkStringTables and their strings. The xtra_tablelist command works fine, but when I use xtra_tablestrings on a table, it prints the strings then srcds crashes a few seconds afterwards. I have no clue why this happens, but I've been able to reproduce this error multiple times.
__________________