bool CHudFlagCarrier::ShouldDraw()
{
	C_HL2MP_Player *pPlayer = C_HL2MP_Player::GetLocalHL2MPPlayer();
	if ( !pPlayer )
		return false;

	if ( GameRules()->GetGameMode() == GAMEMODE_CLASSIC )
	{
		if ( ClassicGameRules()->GetCurrentPhaseID() == PHASE_BUILD )
		{
			return false;
		}
		else
		{
			return m_FlagState[ TEAM_RED ] != HFLG_BASE ||
				m_FlagState[ TEAM_BLUE ] != HFLG_BASE;
		}
	}
	else if ( GameRules()->GetGameMode() == GAMEMODE_DOM )
	{
		return false;
	}

	return CModHudElement::ShouldDraw();
}
Beispiel #2
0
void MapCycleFileChangedCallback( IConVar *var, const char *pOldString, float flOldValue )
{
	if ( Q_stricmp( pOldString, mapcyclefile.GetString() ) != 0 )
	{
		if ( GameRules() )
		{
			// For multiplayer games, forces the mapcyclefile to be reloaded
			GameRules()->ResetMapCycleTimeStamp();
		}
	}
}
Beispiel #3
0
int C_BaseCombatWeapon::GetWorldModelIndex( void )
{
	if ( GameRules() )
	{
		const char *pBaseName = modelinfo->GetModelName( modelinfo->GetModel( m_iWorldModelIndex ) );
		const char *pTranslatedName = GameRules()->TranslateEffectForVisionFilter( "weapons", pBaseName );

		if ( pTranslatedName != pBaseName )
		{
			return modelinfo->GetModelIndex( pTranslatedName );
		}
	}

	return m_iWorldModelIndex;
}
CNewParticleEffect *CParticleProperty::Create( const char *pszParticleName, ParticleAttachment_t iAttachType, int iAttachmentPoint, Vector vecOriginOffset )
{
	if ( GameRules() )
	{
		pszParticleName = GameRules()->TranslateEffectForVisionFilter( "particles", pszParticleName );
	}

	int nBatchMode = cl_particle_batch_mode.GetInt();
	CParticleSystemDefinition *pDef = g_pParticleSystemMgr->FindParticleSystem( pszParticleName );
	bool bRequestedBatch = ( nBatchMode == 2 ) || ( ( nBatchMode == 1 ) && pDef && pDef->ShouldBatch() ); 
	if ( ( iAttachType == PATTACH_CUSTOMORIGIN ) && bRequestedBatch )
	{
		int iIndex = FindEffect( pszParticleName );
		if ( iIndex >= 0 )
		{
			CNewParticleEffect *pEffect = m_ParticleEffects[iIndex].pParticleEffect.GetObject();
			pEffect->Restart();
			return pEffect;
		}
	}

	if ( !pDef )
	{
		AssertMsg( 0, "Attempting to create unknown particle system" );
		Warning( "Attempting to create unknown particle system '%s' \n", pszParticleName );
		return NULL;
	}

	int iIndex = m_ParticleEffects.AddToTail();
	ParticleEffectList_t *newEffect = &m_ParticleEffects[iIndex];
	newEffect->pParticleEffect = CNewParticleEffect::Create( m_pOuter, pDef );

	if ( !newEffect->pParticleEffect->IsValid() )
	{
		// Caused by trying to spawn an unregistered particle effect. Remove it.
		ParticleMgr()->RemoveEffect( newEffect->pParticleEffect.GetObject() );
		return NULL;
	}

	AddControlPoint( iIndex, 0, GetOuter(), iAttachType, iAttachmentPoint, vecOriginOffset );

	if ( m_pOuter )
	{
		m_pOuter->OnNewParticleEffect( pszParticleName, newEffect->pParticleEffect.GetObject() );
	}
	
	return newEffect->pParticleEffect.GetObject();
}
Beispiel #5
0
static cell_t GameRules_GetPropVector(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int element = params[3];
	int offset;
	int bit_count;

	void *pGameRules = GameRules();

	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	FIND_PROP_SEND(DPT_Vector, "vector");

	Vector *v = (Vector *)((intptr_t)pGameRules + offset);

	cell_t *vec;
	pContext->LocalToPhysAddr(params[2], &vec);

	vec[0] = sp_ftoc(v->x);
	vec[1] = sp_ftoc(v->y);
	vec[2] = sp_ftoc(v->z);

	return 1;
Beispiel #6
0
static cell_t GameRules_GetPropEnt(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int element = params[2];
	int offset;
	int bit_count;

	void *pGameRules = GameRules();

	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	FIND_PROP_SEND(DPT_Int, "Integer");

	CBaseHandle &hndl = *(CBaseHandle *)((intptr_t)pGameRules + offset);
	CBaseEntity *pEntity = gamehelpers->ReferenceToEntity(hndl.GetEntryIndex());

	if (!pEntity || ((IServerEntity *)pEntity)->GetRefEHandle() != hndl)
	{
		return -1;
	}

	return gamehelpers->EntityToBCompatRef(pEntity);
bool CModHudElement::ShouldDraw()
{
	C_HL2MP_Player *player = C_HL2MP_Player::GetLocalHL2MPPlayer();
	if ( !player )
		return false;

	if ( m_bLevelStarted )
	{
		if ( GameRules()->GetGameModeMask() & m_iGamemodes )
		{
			return BaseClass::ShouldDraw();
		}
		else
		{
			return false;
		}
	}
	else if ( !( g_ModHudManager.GetEnabledHudElementMask() & GetElementMask() ) &&
		g_ModHudManager.GetEnabledHudElementMask() != HUDELEM_ALL )
	{
		return false;
	}
	else if ( g_ModHudManager.GetEnabledHudElementMask() & GetElementMask() &&
		g_ModHudManager.GetEnabledHudElementMask() != HUDELEM_ALL )
	{
		return true;
	}

	return BaseClass::ShouldDraw();
}
Beispiel #8
0
char * CheckChatText( CBasePlayer *pPlayer, char *text )
{
	char *p = text;

	// invalid if NULL or empty
	if ( !text || !text[0] )
		return NULL;

	int length = Q_strlen( text );

	// remove quotes (leading & trailing) if present
	if (*p == '"')
	{
		p++;
		length -=2;
		p[length] = 0;
	}

	// cut off after 127 chars
	if ( length > 127 )
		text[127] = 0;

	GameRules()->CheckChatText( pPlayer, p );

	return p;
}
//=========================================================
//=========================================================
bool CDirectorBatterySpawn::MaySpawn()
{
	CDirector *pDirector = Director();

	switch ( GameRules()->GetSkillLevel() )
	{
		// Fácil
		case SKILL_EASY:
			if ( UTIL_GetPlayersBattery() < MINHEALTH_EASY )
				return true;
		break;

		// Normal
		case SKILL_MEDIUM:
			if ( UTIL_GetPlayersBattery() < MINHEALTH_MEDIUM )
				return true;
		break;

		// Dificil
		case SKILL_HARD:
			if ( UTIL_GetPlayersBattery() < MINHEALTH_HARD )
				return true;
		break;
	}

	return false;
}
void CC_PrintCurrentPhase( const CCommand& args )
{
	if ( GameRules()->GetGameModeMask() != GAMEMODE_CLASSIC )
	{
		Msg( "Not in classic gamemode\n" );
		return;
	}

	int phase = ClassicGameRules()->GetCurrentPhaseID();
	
	Msg( "Client: " );

	if ( phase == PHASE_BUILD )
	{
		Msg( "It is the Build Phase\n" );
	}
	else if ( phase == PHASE_COMBAT )
	{
		Msg( "It is the Combat Phase\n" );
	}
	else
	{
		Msg( "Bad Phase %d\n", phase );
	}
}
Beispiel #11
0
void CBaseHudChat::MsgFunc_VoiceSubtitle( bf_read &msg )
{
	// Got message during connection
	if ( !g_PR )
		return;

	if ( !cl_showtextmsg.GetInt() )
		return;

	char szString[2048];
	char szPrefix[64];	//(Voice)
	wchar_t szBuf[128];

	int client = msg.ReadByte();
	int iMenu = msg.ReadByte();
	int iItem = msg.ReadByte();

	const char *pszSubtitle = "";

	CGameRules *pGameRules = GameRules();

	CMultiplayRules *pMultiRules = dynamic_cast< CMultiplayRules * >( pGameRules );

	Assert( pMultiRules );

	if ( pMultiRules )
	{
		pszSubtitle = pMultiRules->GetVoiceCommandSubtitle( iMenu, iItem );
	}

	SetVoiceSubtitleState( true );

	const wchar_t *pBuf = g_pVGuiLocalize->Find( pszSubtitle );
	if ( pBuf )
	{
		// Copy pBuf into szBuf[i].
		int nMaxChars = sizeof( szBuf ) / sizeof( wchar_t );
		wcsncpy( szBuf, pBuf, nMaxChars );
		szBuf[nMaxChars-1] = 0;
	}
	else
	{
		g_pVGuiLocalize->ConvertANSIToUnicode( pszSubtitle, szBuf, sizeof(szBuf) );
	}

	int len;
	g_pVGuiLocalize->ConvertUnicodeToANSI( szBuf, szString, sizeof(szString) );
	len = strlen( szString );
	if ( len && szString[len-1] != '\n' && szString[len-1] != '\r' )
	{
		Q_strncat( szString, "\n", sizeof(szString), 1 );
	}

	const wchar_t *pVoicePrefix = g_pVGuiLocalize->Find( "#Voice" );
	g_pVGuiLocalize->ConvertUnicodeToANSI( pVoicePrefix, szPrefix, sizeof(szPrefix) );
	
	ChatPrintf( client, CHAT_FILTER_NONE, "%c(%s) %s%c: %s", COLOR_PLAYERNAME, szPrefix, GetDisplayedSubtitlePlayerName( client ), COLOR_NORMAL, ConvertCRtoNL( szString ) );

	SetVoiceSubtitleState( false );
}
void CHealthRechargerClassic::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
    if (!pActivator || !pActivator->IsPlayer())
    {
        return;
    }
    else if (GameRules()->GetGameMode() == GAMEMODE_CLASSIC)
    {
        if (ClassicGameRules()->GetCurrentPhaseID() == PHASE_BUILD)
        {
            if (m_flSoundTime <= gpGlobals->curtime)
            {
                m_flSoundTime = gpGlobals->curtime + 0.62;
                EmitSound( "WallHealth.Deny" );
            }
            return;
        }
        else if (GetTeamNumber() != pActivator->GetTeamNumber() &&
                 GetTeamNumber() != TEAM_SPECTATOR)
        {
            if (m_flSoundTime <= gpGlobals->curtime)
            {
                CBasePlayer *pPlayer = ToBasePlayer( pActivator );
                Assert( pPlayer );
                ClientPrint( pPlayer, HUD_PRINTTALK, "#lf_health_charger_deny" );

                m_flSoundTime = gpGlobals->curtime + 0.62;
                EmitSound( "WallHealth.Deny" );
            }
            return;
        }
    }

    BaseClass::Use( pActivator, pCaller, useType, value );
}
CCustomManagerGameRules::CCustomManagerGameRules()
{
	if ( GameRules()->GetGameMode() != GAMEMODE_CUSTOM )
	{
		m_bEnabled = false;
	}
}
//=========================================================
//=========================================================
const char *CDirectorHealthSpawn::SelectClass()
{
	CDirector *pDirector = Director();

	switch ( GameRules()->GetSkillLevel() )
	{
		// Fácil
		case SKILL_EASY:
			if ( random->RandomInt(1, UTIL_GetPlayersHealth()) > 50 )
				return "item_healthvial";
			else
				return "item_healthkit";
		break;

		// Normal
		case SKILL_MEDIUM:
			if ( random->RandomInt(1, UTIL_GetPlayersHealth()) > 40 )
				return "item_healthvial";
			else
				return "item_healthkit";
		break;

		// Dificil
		case SKILL_HARD:
			if ( random->RandomInt(1, UTIL_GetPlayersHealth()) > 30 )
				return "item_healthvial";
			else
				return "item_healthkit";
		break;
	}
	
	// Susupone que jamas llegaría hasta aquí, pero por si acaso...
	return "item_healthvial";
}
//=========================================================
// Añade salud del personaje.
//=========================================================
void CDirectorSpawn::AddHealth(CAI_BaseNPC *pNPC)
{
	// Aumentamos la salud dependiendo del nivel de dificultad.
	int MoreHealth = 3;

	// Normal: 5 más de salud.
	if ( GameRules()->IsSkillLevel(SKILL_MEDIUM) ) 
		MoreHealth = 5;

	// Dificil: 8 más de salud.
	if ( GameRules()->IsSkillLevel(SKILL_HARD) )
		MoreHealth = 8;

	// Establecemos la nueva salud.
	pNPC->SetMaxHealth(pNPC->GetMaxHealth() + MoreHealth);
	pNPC->SetHealth(pNPC->GetMaxHealth());
}
bool CHudDomScore::ShouldDraw()
{
	C_HL2MP_Player *pPlayer = C_HL2MP_Player::GetLocalHL2MPPlayer();
	if ( !pPlayer )
		return false;

	if ( GameRules()->GetGameMode() == GAMEMODE_CLASSIC )
	{
		return false;
	}
	if ( GameRules()->GetGameMode() == GAMEMODE_DOM &&
		DomGameRules()->GetCurrentPhaseID() != PHASE_BUILD )
	{
		return true;
	}

	return CModHudElement::ShouldDraw();
}
Beispiel #17
0
static cell_t GameRules_SetPropString(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int offset;
	int maxlen;

	bool sendChange = true;
	if (params[3] == 0)
		sendChange = false;

	void *pGameRules = GameRules();

	CBaseEntity *pProxy = NULL;
	if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
		return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
	
	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	sm_sendprop_info_t info;
	if (!gamehelpers->FindSendPropInfo(g_szGameRulesProxy, prop, &info))
	{
		return pContext->ThrowNativeError("Property \"%s\" not found on the gamerules proxy", prop);
	}
	
	offset = info.actual_offset;
	
	if (info.prop->GetType() != DPT_String)
	{
		return pContext->ThrowNativeError("SendProp %s type is not a string (%d != %d)",
				prop,
				info.prop->GetType(),
				DPT_String);
	}

	maxlen = DT_MAX_STRING_BUFFERSIZE;

	char *src;
	char *dest = (char *)((intptr_t)pGameRules + offset);

	pContext->LocalToString(params[2], &src);
	size_t len = strncopy(dest, src, maxlen);

	if (sendChange)
	{
		dest = (char *)((intptr_t)pProxy + offset);
		strncopy(dest, src, maxlen);
		gamehelpers->SetEdictStateChanged(gamehelpers->EdictOfIndex(gamehelpers->EntityToBCompatRef(pProxy)), offset);
	}

	return len;
Beispiel #18
0
bool IsLocalPlayerUsingVisionFilterFlags( int nFlags, bool bWeaponsCheck /* = false */ )
{
	int nLocalPlayerFlags = GetLocalPlayerVisionFilterFlags( bWeaponsCheck );

	if ( !bWeaponsCheck )
	{
		// We can only modify the RJ flags with normal checks that won't take the forced kill cam flags that can happen in weapon checks
		int nRJShaderFlags = nLocalPlayerFlags;
		if ( nRJShaderFlags != 0 && GameRules() && !GameRules()->AllowMapVisionFilterShaders() )
		{
			nRJShaderFlags = 0;
		}

		if ( nRJShaderFlags != localplayer_visionflags.GetInt() )
		{
			localplayer_visionflags.SetValue( nRJShaderFlags );
		}
	}

	return ( nLocalPlayerFlags & nFlags ) == nFlags;
}
void CWeaponPortalgun::OnPickedUp( CBaseCombatCharacter *pNewOwner )
{
	if( GameRules()->IsMultiplayer() )
	{
		if( pNewOwner && pNewOwner->IsPlayer() )
			m_iPortalLinkageGroupID = pNewOwner->entindex();

		Assert( (m_iPortalLinkageGroupID >= 0) && (m_iPortalLinkageGroupID < 256) );
	}

	BaseClass::OnPickedUp( pNewOwner );		
}
	void LevelInitPostEntity()
	{
		if ( GameRules()->GetGameMode() == GAMEMODE_CLASSIC && 
				lf_reverse_flags.GetBool() )
		{
			AddTag( REVERSE_CTF_TAG );
		}
		else
		{
			RemoveTag( REVERSE_CTF_TAG );
		}
	}
Beispiel #21
0
void OpenVoiceMenu( int index )
{
	// do not show the menu if the player is dead or is an observer
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	if ( !pPlayer->IsAlive() || pPlayer->IsObserver() )
		return;

	CHudMenu *pMenu = (CHudMenu *) gHUD.FindElement( "CHudMenu" );
	if ( !pMenu )
		return;

	// if they hit the key again, close the menu
	if ( g_ActiveVoiceMenu == index )
	{
		if ( pMenu->IsMenuOpen() )
		{
			pMenu->HideMenu();
			g_ActiveVoiceMenu = 0;
			return;
		}
	}

	if ( index > 0 && index < 9 )
	{
		KeyValues *pKV = new KeyValues( "MenuItems" );

		CMultiplayRules *pRules = dynamic_cast< CMultiplayRules * >( GameRules() );
		if ( pRules )
		{			
			if ( !pRules->GetVoiceMenuLabels( index-1, pKV ) )
			{ 
				pKV->deleteThis();
				return;
			}
		}

		pMenu->ShowMenu_KeyValueItems( pKV );

		pKV->deleteThis();

		g_ActiveVoiceMenu = index;
	}
	else
	{
		g_ActiveVoiceMenu = 0;
	}
}
int AddTimeSeconds( int seconds )
{
	if ( GameRules()->GetGameModeMask() & GAMEMODE_CLASSIC )
	{
		int DiffTime = seconds;
		ClassicGameRules()->SetPhaseTime( ClassicGameRules()->GetPhaseTimeLeft() + DiffTime );
	}
	else
	{
		return 0;
		ClientPrint( UTIL_GetCommandClient(), HUD_PRINTCONSOLE, "Cannot Execute command. Not in Classic GameRules.\n");
	}

	return 1;
}
void CC_ReturnToSpawn( const CCommand& args )
{
	if ( GameRules()->GetGameModeMask() & GAMEMODE_CLASSIC )
	{
		if ( ClassicGameRules()->GetCurrentPhaseID() == PHASE_BUILD )
		{
			CBasePlayer *pPlayer = UTIL_GetCommandClient();
			if ( !pPlayer )
			{
				return;
			}

			pPlayer->ForceRespawn();
		}
	}
}
void CArmorRechargerClassic::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
    // if it's not a player, ignore
    if ( !pActivator || !pActivator->IsPlayer())
    {
        return;
    }
    else if (GameRules()->GetGameMode() == GAMEMODE_CLASSIC)
    {
        if (ClassicGameRules()->GetCurrentPhaseID() == PHASE_BUILD)
        {
            if (m_flSoundTime <= gpGlobals->curtime)
            {
                m_flSoundTime = gpGlobals->curtime + 0.62;
                EmitSound( "SuitRecharge.Deny" );
            }

            return;
        }
        else if (GetTeamNumber() != pActivator->GetTeamNumber() &&
                 GetTeamNumber() != TEAM_SPECTATOR)
        {
            if (m_flSoundTime <= gpGlobals->curtime)
            {
                CBasePlayer *pPlayer = ToBasePlayer( pActivator );
                Assert( pPlayer );
                ClientPrint( pPlayer, HUD_PRINTTALK, "#lf_armor_charger_deny" );

                m_flSoundTime = gpGlobals->curtime + 0.62;
                EmitSound( "SuitRecharge.Deny" );
            }

            return;
        }
    }

    CSDKPlayer *pPlayer = ToSDKPlayer( pCaller );
    AssertMsg( pPlayer, "Failure SDKPlayer Armor charger\n" );
    CSDKTeam *pTeam = GetGlobalSDKTeam( pPlayer->GetTeamNumber() );
    const CSDKPlayerClassInfo &pClassInfo = pTeam->GetPlayerClassInfo( pPlayer->m_Shared.PlayerClass() );

    SetMaxArmor( pClassInfo.m_iArmor );

    BaseClass::Use( pActivator, pCaller, useType, value );
}
Beispiel #25
0
static cell_t GameRules_SetPropVector(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int element = params[3];
	int offset;
	int bit_count;

	bool sendChange = true;
	if (params[4] == 0)
		sendChange = false;

	void *pGameRules = GameRules();

	CBaseEntity *pProxy = NULL;
	if (sendChange && ((pProxy = GetGameRulesProxyEnt()) == NULL))
		return pContext->ThrowNativeError("Couldn't find gamerules proxy entity.");
	
	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	FIND_PROP_SEND(DPT_Vector, "vector");

	Vector *v = (Vector *)((intptr_t)pGameRules + offset);

	cell_t *vec;
	pContext->LocalToPhysAddr(params[2], &vec);

	v->x = sp_ctof(vec[0]);
	v->y = sp_ctof(vec[1]);
	v->z = sp_ctof(vec[2]);

	if (sendChange)
	{
		v = (Vector *)((intptr_t)pProxy + offset);
		v->x = sp_ctof(vec[0]);
		v->y = sp_ctof(vec[1]);
		v->z = sp_ctof(vec[2]);

		gamehelpers->SetEdictStateChanged(gamehelpers->EdictOfIndex(gamehelpers->EntityToBCompatRef(pProxy)), offset);
	}

	return 1;
void CWeaponPortalgun::Spawn( void )
{
	Precache();

	BaseClass::Spawn();

	SetThink( &CWeaponPortalgun::Think );
	SetNextThink( gpGlobals->curtime + 0.1 );

	if( GameRules()->IsMultiplayer() )
	{
		CBaseEntity *pOwner = GetOwner();
		if( pOwner && pOwner->IsPlayer() )
			m_iPortalLinkageGroupID = pOwner->entindex();

		Assert( (m_iPortalLinkageGroupID >= 0) && (m_iPortalLinkageGroupID < 256) );
	}	
}
Beispiel #27
0
static cell_t GameRules_GetPropFloat(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int element = params[2];
	int offset;
	int bit_count;

	void *pGameRules = GameRules();

	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	FIND_PROP_SEND(DPT_Float, "float");

	float val = *(float *)((intptr_t)pGameRules + offset);

	return sp_ftoc(val);
Beispiel #28
0
//-----------------------------------------------------------------------------
// helper method for trace hull as used by physics...
//-----------------------------------------------------------------------------
static void Physics_TraceHull( C_BaseEntity* pBaseEntity, const Vector &vecStart,
	const Vector &vecEnd, const Vector &hullMin, const Vector &hullMax,	
	unsigned int mask, trace_t *ptr )
{
	// FIXME: I really am not sure the best way of doing this
	// The TraceHull code below for shots will make sure the object passes
	// through shields which do not block that damage type. It will also 
	// send messages to the shields that they've been hit.
#if 0
	if (pBaseEntity->GetDamageType() != DMG_GENERIC)
	{
		GameRules()->WeaponTraceHull( vecStart, vecEnd, hullMin, hullMax, 
			mask, pBaseEntity, pBaseEntity->GetCollisionGroup(), 
			pBaseEntity, ptr );
	}
	else
#endif
	{
		UTIL_TraceHull( vecStart, vecEnd, hullMin, hullMax, mask, 
			pBaseEntity, pBaseEntity->GetCollisionGroup(), ptr );
	}
}
// Toggle phase console command
void CC_TogglePhase( const CCommand& args )
{
	if ( !UTIL_IsCommandIssuedByServerAdmin() )
		return;

	// Needs to be classic or a child of the classic gamerules
	if ( GameRules()->GetGameModeMask() & GAMEMODE_CLASSIC )
	{
		bool BuildPhase = ClassicGameRules()->IsBuildPhase();
		if (BuildPhase)
		{
			ClassicGameRules()->SwitchToPhase( "CombatPhase" );
		}
		else
		{
			ClassicGameRules()->SwitchToPhase( "BuildPhase" );
		}
	}
	else
	{
		ClientPrint( UTIL_GetCommandClient(), HUD_PRINTCONSOLE, "Cannot Execute command. Not in Classic GameRules.\n");
	}
}
Beispiel #30
0
static cell_t GameRules_GetPropString(IPluginContext *pContext, const cell_t *params)
{
	char *prop;
	int offset;

	void *pGameRules = GameRules();

	if (!pGameRules || !g_szGameRulesProxy || !strcmp(g_szGameRulesProxy, ""))
		return pContext->ThrowNativeError("Gamerules lookup failed.");

	pContext->LocalToString(params[1], &prop);

	sm_sendprop_info_t info;
	if (!gamehelpers->FindSendPropInfo(g_szGameRulesProxy, prop, &info))
	{
		return pContext->ThrowNativeError("Property \"%s\" not found on the gamerules proxy", prop);
	}
	
	offset = info.actual_offset;
	
	if (info.prop->GetType() != DPT_String)
	{
		return pContext->ThrowNativeError("SendProp %s type is not a string (%d != %d)",
				prop,
				info.prop->GetType(),
				DPT_String);
	}

	size_t len;
	const char *src;

	src = (char *)((intptr_t)pGameRules + offset);

	pContext->StringToLocalUTF8(params[2], params[3], src, &len);

	return len;