OK yesterday some hours I had making a tests with the "TeamInfo" CS message to get the teams without using a models. Here what I got.
Code:
// This message is sent whenever information for the teams is sended.
void BotClient_CS_TeamInfo (void *p, int index)
{
if (strcmp((char *) p, "UNASSIGNED") == 0)
{
ThreatTab[index].iTeam = TEAM_UNASSIGNED;
}
else if (strcmp((char *) p, "TERRORIST") == 0)
{
ThreatTab[index].iTeam = TEAM_T;
}
else if (strcmp((char *) p, "CT") == 0)
{
ThreatTab[index ].iTeam = TEAM_CT;
}
else if (strcmp((char *) p, "SPECTATOR") == 0)
{
ThreatTab[index].iTeam = TEAM_SPECTATOR;
}
state++;
}
The message is hooked fine in engine.cpp like all others clients messages but it seems to not work propertie.
I tryed to debug it. So I putted this line at the start of the function:
Code:
{ fp=fopen("EPB.txt","a"); fprintf(fp,"BotClient_CS_TeamInfo: %s\n",p); fclose(fp); }
and now the function looks like this:
Code:
// This message is sent whenever information for the teams is sended.
void BotClient_CS_TeamInfo (void *p, int index)
{
{ fp=fopen("EPB.txt","a"); fprintf(fp,"BotClient_CS_TeamInfo: %s\n",p); fclose(fp); }
if (strcmp((char *) p, "UNASSIGNED") == 0)
{
ThreatTab[index].iTeam = TEAM_UNASSIGNED;
}
else if (strcmp((char *) p, "TERRORIST") == 0)
{
ThreatTab[index].iTeam = TEAM_T;
}
else if (strcmp((char *) p, "CT") == 0)
{
ThreatTab[index ].iTeam = TEAM_CT;
}
else if (strcmp((char *) p, "SPECTATOR") == 0)
{
ThreatTab[index].iTeam = TEAM_SPECTATOR;
}
state++;
}
and after I opened the EPB.txt file I got this:
Code:
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: TERRORIST
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: CT
BotClient_CS_TeamInfo:
BotClient_CS_TeamInfo: UNASSIGNED
This message is called when a player or bot change a team and on each round start.
I moved the debug info in to the if {} else {} to see if my checks for the messages are ok and it seems that all is work just fine but when I try to get the teams of the players it's just not work. I can't get the players and bots teams. The message is sended correct and I get it correct but it seems that this lines are not working correct:
Code:
ThreatTab[index].iTeam = TEAM_UNASSIGNED;
ThreatTab[index].iTeam = TEAM_T;
ThreatTab[index].iTeam = TEAM_SPECTATOR;
If someone can tell me where I wrong I will be very happy.