Only 1 of the 2 c4 should have a player as owner (if pev_owner doesn't work, try m_pPlayer offset).
@Doc-Holiday
Player spawn is called many times, and it's too early to detect c4 ( c4 is given the same frame but after spawn, so, index you get is old c4, by chance new c4 had same index but it is not sure.
Code:
void CHalfLifeMultiplay::RestartRound()
{
// [ .. ]
@@ // HLTV Event ( New Round )
MESSAGE_BEGIN( MSG_SPEC, gmsgHLTV );
WRITE_BYTE( 0 ); // 0 = all players
WRITE_BYTE( 100 | 128 ); // 100 health + msg flag
MESSAGE_END();
MESSAGE_BEGIN( MSG_SPEC, gmsgHLTV );
WRITE_BYTE( 0 ); // all players
WRITE_BYTE( 0 ); // to default FOV value
MESSAGE_END();
// [ .. ]
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = CBasePlayer::Instance( i );
if ( pPlayer && !FNullEnt( pPlayer->edict() ) )
{
pPlayer->m_iNumSpawns = 0;
pPlayer->m_bTeamChanged = false;
if ( !unknowCall168() )
{
pPlayer->SyncRoundTimer();
}
switch ( m_iTeam )
{
case TEAM_CT :
{
if ( !playerOffset222 )
{
pPlayer->AddAccount( m_iAccountCT, 1 );
}
}
case TEAM_TERRORIST :
{
m_iNumEscapers++;
if ( !playerOffset222 )
{
pPlayer->AddAccount( m_iAccountTerrorist, 1 );
}
if ( m_bMapHasEscapeZone )
{
pPlayer->m_bNotKilled = false;
}
}
}
if ( m_iTeam != TEAM_UNASSIGNED && m_iTeam != TEAM_SPECTATOR )
{
if ( m_bHasC4 )
{
@@ pPlayer->DropPlayerItem( "weapon_c4" );
}
@@ pPlayer->RoundRespawn(); // spawns
}
}
}
CleanUpMap();
if ( m_bMapHasBombTarget )
{
@@ GiveC4(); // after spawns
}
__________________