本文整理汇总了C++中CBasePlayer::AddAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ CBasePlayer::AddAccount方法的具体用法?C++ CBasePlayer::AddAccount怎么用?C++ CBasePlayer::AddAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBasePlayer
的用法示例。
在下文中一共展示了CBasePlayer::AddAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TakeDamage
int CHostage::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
CBasePlayer *pAttacker = NULL;
flDamage = GetModifiedDamage(flDamage);
if (flDamage > pev->health)
flDamage = pev->health;
pev->health -= flDamage;
if (m_improv)
{
}
PlayPainSound();
if (pevAttacker)
{
CBaseEntity *pEntity = GetClassPtr((CBaseEntity *)pevAttacker);
if (pEntity->Classify() == CLASS_VEHICLE)
{
CBaseEntity *pDriver = ((CFuncVehicle *)pEntity)->m_pDriver;
if (pDriver)
pevAttacker = pDriver->pev;
}
if (pEntity->IsPlayer())
pAttacker = GetClassPtr((CBasePlayer *)pevAttacker);
}
if (pev->health <= 0)
{
pev->health = 0;
pev->movetype = MOVETYPE_TOSS;
ClearBits(pev->flags, FL_ONGROUND);
SetDeathActivity();
if (pAttacker)
{
pAttacker->AddAccount((-25 - flDamage) * 20);
AnnounceDeath(pAttacker);
ApplyHostagePenalty(pAttacker);
}
pev->takedamage = DAMAGE_NO;
pev->deadflag = DEAD_DEAD;
pev->solid = SOLID_NOT;
if (m_improv)
{
}
g_pGameRules->CheckWinConditions();
if (!g_pGameRules->m_fTeamCount)
SendHostageEventMsg();
pev->nextthink = gpGlobals->time + 3;
SetThink(&CHostage::Remove);
return 0;
}
m_flFlinchTime = gpGlobals->time + 0.75;
if (m_improv)
{
}
else
{
SetFlinchActivity();
if (pAttacker)
{
pAttacker->AddAccount((int)flDamage * -20);
ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Injured_Hostage");
if (!(pAttacker->m_flDisplayHistory & DHF_HOSTAGE_INJURED))
{
pAttacker->HintMessage("#Hint_careful_around_hostages");
pAttacker->m_flDisplayHistory |= DHF_HOSTAGE_INJURED;
}
return 1;
}
}
return 0;
}
示例2: IdleThink
void CHostage::IdleThink(void)
{
pev->nextthink = gpGlobals->time + (1.0 / 30);
DispatchAnimEvents(StudioFrameAdvance());
if (gpGlobals->time >= m_flNextFullThink)
{
m_flNextFullThink = gpGlobals->time + 0.1;
if (pev->deadflag == DEAD_DEAD)
{
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
return;
}
if (m_hTargetEnt != NULL)
{
if ((m_bStuck != FALSE && gpGlobals->time - m_flStuckTime > 5) || m_hTargetEnt->pev->deadflag != DEAD_NO)
{
m_State = STAND;
m_hTargetEnt = NULL;
m_bStuck = FALSE;
}
}
if (m_hTargetEnt != 0 || m_improv)
{
CBasePlayer *pPlayer;
if (m_improv)
{
}
else
pPlayer = GetClassPtr((CBasePlayer *)m_hTargetEnt->pev);
if (!pPlayer || pPlayer->m_iTeam == TEAM_CT)
{
if (!g_pGameRules->m_bMapHasRescueZone)
{
BOOL hasRescueZone = FALSE;
if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue"))
hasRescueZone = TRUE;
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "info_hostage_rescue")) != NULL)
{
if ((pEntity->pev->origin - pev->origin).Length() < 256)
{
m_bRescueMe = TRUE;
break;
}
}
if (!hasRescueZone)
{
pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "info_player_start")) != NULL)
{
if ((pEntity->pev->origin - pev->origin).Length() < 256)
{
m_bRescueMe = TRUE;
break;
}
}
}
}
if (m_bRescueMe)
{
if (g_pGameRules->IsCareer() && pPlayer && !pPlayer->IsBot())
{
}
if (pPlayer)
{
pev->deadflag = DEAD_RESPAWNABLE;
pPlayer->AddAccount(1000);
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Rescued_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()));
}
SendHostageEventMsg();
MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);
WRITE_BYTE(9);
WRITE_BYTE(DRC_CMD_EVENT);
WRITE_SHORT(pPlayer ? ENTINDEX(pPlayer->edict()) : 0);
WRITE_SHORT(ENTINDEX(edict()));
WRITE_LONG(15);
MESSAGE_END();
pev->effects |= EF_NODRAW;
Remove();
g_pGameRules->m_iHostagesRescued++;
g_pGameRules->CheckWinConditions();
if (pPlayer)
//.........这里部分代码省略.........