void CStrikeBot::Join() { if (this->start_action == MSG_CS_TEAM_SELECT) { this->start_action = MSG_CS_IDLE; // switch back to idle if ((this->bot_team != 1) && (this->bot_team != 2) && (this->bot_team != 5)) this->bot_team = -1; if (this->bot_team == -1) this->bot_team = RANDOM_LONG(1, 2); // select the team the bot wishes to join... if( this->bot_team != 1 && this->bot_team != 2 ) this->bot_team = 5; FakeClientCommand(pEdict, "menuselect %d", this->bot_team); return; } if (this->start_action == MSG_CS_CT_SELECT) // counter terrorist { this->start_action = MSG_CS_IDLE; // switch back to idle if ((this->bot_class < 1) || (this->bot_class > 4)) this->bot_class = -1; // use random if invalid if (this->bot_class == -1) this->bot_class = RANDOM_LONG(1, 4); FakeClientCommand(pEdict, "menuselect %d", this->bot_class); // bot has now joined the game (doesn't need to be started) this->not_started = 0; return; } if (this->start_action == MSG_CS_T_SELECT) // terrorist select { this->start_action = MSG_CS_IDLE; // switch back to idle if ((this->bot_class < 1) || (this->bot_class > 4)) this->bot_class = -1; // use random if invalid if (this->bot_class == -1) this->bot_class = RANDOM_LONG(1, 4); FakeClientCommand(pEdict, "menuselect %d", this->bot_class); // bot has now joined the game (doesn't need to be started) this->not_started = 0; return; } }
void Bot::StartGame (void) { // this function handles the selection of teams & class // handle counter-strike stuff here... if (m_startAction == CMENU_TEAM) { m_startAction = CMENU_IDLE; // switch back to idle if (yb_forceteam.GetString ()[0] == 'C' || yb_forceteam.GetString ()[0] == 'c') m_wantedTeam = 2; else if (yb_forceteam.GetString ()[0] == 'T' || yb_forceteam.GetString ()[0] == 't') m_wantedTeam = 1; if (m_wantedTeam != 1 && m_wantedTeam != 2) m_wantedTeam = 5; // select the team the bot wishes to join... FakeClientCommand (GetEntity (), "menuselect %d", m_wantedTeam); } else if (m_startAction == CMENU_CLASS) { m_startAction = CMENU_IDLE; // switch back to idle if (g_gameVersion == CSVER_CZERO) // czero has spetsnaz and militia skins { if (m_wantedClass < 1 || m_wantedClass > 5) m_wantedClass = engine->RandomInt (1, 5); // use random if invalid } else { if (m_wantedClass < 1 || m_wantedClass > 4) m_wantedClass = engine->RandomInt (1, 4); // use random if invalid } // select the class the bot wishes to use... FakeClientCommand (GetEntity (), "menuselect %d", m_wantedClass); // bot has now joined the game (doesn't need to be started) m_notStarted = false; // check for greeting other players, since we connected if (engine->RandomInt (0, 100) < 20) ChatMessage (CHAT_HELLO); } }
void Bot::SelectWeaponbyNumber (int num) { FakeClientCommand (GetEntity (), g_weaponSelect[num].weaponName); }
void Bot::SelectWeaponByName (const char *name) { FakeClientCommand (GetEntity (), name); }
void UTIL_SelectItem(edict_t *pEdict, char *item_name) { FakeClientCommand(pEdict, item_name, NULL, NULL); }
void ShipBot::PickUpItem() { FakeClientCommand( this->pEdict, "pickup" ); }