void NFCTeamModule::OnJoinTeamProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckJoinTeam); if (JoinTeam(nPlayerID, NFINetModule::PBToNF(xMsg.team_id()))) { NFMsg::ReqAckJoinTeam xAck; *xAck.mutable_team_id() = xMsg.team_id(); NFGUID xTeam = NFINetModule::PBToNF(xMsg.team_id()); NFMsg::TeamInfo xTeamInfo; if (!GetTeamInfo(nPlayerID, xTeam, xTeamInfo)) { xAck.mutable_xteaminfo()->CopyFrom(xTeamInfo); } BroadcastMsgToTeam(nPlayerID, xTeam, NFMsg::EGMI_ACK_JOIN_TEAM, xAck); } else { NFMsg::ReqAckJoinTeam xAck; *xAck.mutable_team_id() = NFINetModule::NFToPB(NFGUID()); m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_JOIN_TEAM, xAck, nSockIndex, nPlayerID); } }
/* TNG:Freud Cmd_Ghost_f Person gets frags/kills/damage/weapon/item/team/stats back if he disconnected */ void Cmd_Ghost_f(edict_t * ent) { int x, frames_since; qboolean found = false; if (!use_ghosts->value) { gi.cprintf(ent, PRINT_HIGH, "Ghosting is not enabled on this server\n"); return; } if (num_ghost_players == 0) { gi.cprintf(ent, PRINT_HIGH, "No ghost match found\n"); return; } for (x = 0; x < num_ghost_players; x++) { if (found == true) { ghost_players[x - 1] = ghost_players[x]; } else if (strcmp(ghost_players[x].ipaddr, ent->client->ipaddr) == 0 && strcmp(ghost_players[x].netname, ent->client->pers.netname) == 0) { found = true; gi.cprintf(ent, PRINT_HIGH, "Welcome back %s\n", ent->client->pers.netname); frames_since = level.framenum - ghost_players[x].disconnect_frame; ent->client->resp.enterframe = ghost_players[x].enterframe + frames_since; ent->client->resp.score = ghost_players[x].score; ent->client->resp.kills = ghost_players[x].kills; ent->client->resp.damage_dealt = ghost_players[x].damage_dealt; if (teamplay->value) { if (ghost_players[x].team && ghost_players[x].team != NOTEAM) JoinTeam(ent, ghost_players[x].team, 1); ent->client->resp.weapon = ghost_players[x].weapon; ent->client->resp.item = ghost_players[x].item; } ent->client->resp.stats_shots_t = ghost_players[x].stats_shots_t; ent->client->resp.stats_shots_h = ghost_players[x].stats_shots_h; memcpy(ent->client->resp.stats_locations, ghost_players[x].stats_locations, sizeof(ghost_players[x].stats_locations)); memcpy(ent->client->resp.stats_shots, ghost_players[x].stats_shots, sizeof(ghost_players[x].stats_shots)); memcpy(ent->client->resp.stats_hits, ghost_players[x].stats_hits, sizeof(ghost_players[x].stats_hits)); memcpy(ent->client->resp.stats_headshot, ghost_players[x].stats_headshot, sizeof(ghost_players[x].stats_headshot)); } } if (found == true) { num_ghost_players--; } else { gi.cprintf(ent, PRINT_HIGH, "No ghost match found\n"); } }
void CSDKBot::Initialize() { // set bot skills m_flSkill[BOT_SKILL_YAW_RATE] = 10; m_flSkill[BOT_SKILL_SPEED] = SDK_DEFAULT_PLAYER_SPRINTSPEED; m_flSkill[BOT_SKILL_STRAFE] = 5; JoinTeam(0); ClearLoadout(); BuyRandom(); PickRandomCharacter(); PickRandomSkill(); State_Transition( STATE_ACTIVE ); }
void CPlayer::TryRespawn() { vec2 SpawnPos; /* if (m_WantedTeam != m_Team && m_WantedTeam != TEAM_SPECTATORS && GameServer()->m_pController->CanCharacterSpawn(GetCID())) { m_Team = m_WantedTeam; }*/ if(!GameServer()->m_pController->CanCharacterSpawn(GetCID())) return; if(str_comp(g_Config.m_SvGametype, "cstt") == 0) JoinTeam(); if(!GameServer()->m_pController->CanSpawn(m_Team, &SpawnPos)) return; /* m_ForceToSpectators = false; char aBuf[512]; str_format(aBuf, sizeof(aBuf), "joining the %s", GameServer()->m_pController->GetTeamName(m_WantedTeam)); GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "cstt", aBuf); */ m_Spawning = false; m_pCharacter = new(m_ClientID) CCharacter(&GameServer()->m_World); m_pCharacter->Spawn(this, SpawnPos); GameServer()->CreatePlayerSpawn(SpawnPos); GiveSavedWeapons(); //GameServer()->ResetVotes(); }