was checking for the wrong team and also made autism bots use joinclass and zspawn

This commit is contained in:
jenz 2026-06-19 15:12:34 +02:00
parent bb7c7f8549
commit d476d8c8bd

View File

@ -372,6 +372,7 @@ public Action check_team(Handle timer, any data)
if (specific_bot_player[client] != -1 && GetClientTeam(client) <= CS_TEAM_SPECTATOR) if (specific_bot_player[client] != -1 && GetClientTeam(client) <= CS_TEAM_SPECTATOR)
{ {
ChangeClientTeam(client, CS_TEAM_T); ChangeClientTeam(client, CS_TEAM_T);
CreateTimer(1.0, zspawn, GetClientSerial(client));
continue; continue;
} }
if (specific_bot_player[client] != -1) if (specific_bot_player[client] != -1)
@ -386,7 +387,7 @@ public Action check_team(Handle timer, any data)
for (int client = 1; client <= MaxClients; client++) for (int client = 1; client <= MaxClients; client++)
{ {
if (!IsValidClient(client)) continue; if (!IsValidClient(client)) continue;
if (specific_bot_player[client] == -1 && GetClientTeam(client) > CS_TEAM_SPECTATOR && IsPlayerAlive(client)) if (specific_bot_player[client] == -1 && GetClientTeam(client) > CS_TEAM_T && IsPlayerAlive(client))
{ {
found_valid_ct = true; found_valid_ct = true;
break; break;
@ -406,6 +407,21 @@ public Action check_team(Handle timer, any data)
return Plugin_Continue; return Plugin_Continue;
} }
public Action zspawn(Handle hTimer, int Serial)
{
int client;
if ((client = GetClientFromSerial(Serial)) == 0)
{
return Plugin_Handled;
}
if (IsValidClient(client))
{
FakeClientCommandEx(client, "joinclass");
FakeClientCommandEx(client, "say /zspawn");
}
return Plugin_Handled;
}
stock bool IsValidClient(int client) stock bool IsValidClient(int client)
{ {
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client)) if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))