VGUI HTML Screen In Multiplayer/sv htmlview support.cpp

From Valve Developer Community
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
//========= Public Domain 2007, Julian 'Daedalus' Thatcher. =====================//
//
// Purpose: HTMLView Server Entity Triggering implementation
//
// Ingame Usage Commands:
//  sv_ent_fire entity [action] [parameter]		Functions as ent_fire command
// 
// $Created: Thursday, 26 April 2007
// $LastUpdated: Monday, 21 May 2007
// $Author:  Julian 'Daedalus' Thatcher ([email protected])
// $NoKeywords: $
//=============================================================================//

#include "cbase.h"
#include "EventQueue.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

void CC_sv_ent_fire_f(void)
{
	// fires a command from the console
	CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );

	if(!pPlayer)
	{
		// If we can't get it, use this class
		pPlayer = NULL;
	}

	if ( engine->Cmd_Argc() < 2 )
	{
		ClientPrint( pPlayer, HUD_PRINTCONSOLE, "Usage:\n   ent_fire <target> [action] [value] [delay]\n" );
	}
	else
	{
		const char *target = "", *action = "Trigger";
		variant_t value;
		int delay = 0;

		target = STRING( AllocPooledString(engine->Cmd_Argv(1)) );
		if ( engine->Cmd_Argc() >= 3 )
		{
			action = STRING( AllocPooledString(engine->Cmd_Argv(2)) );
		}
		if ( engine->Cmd_Argc() >= 4 )
		{
			value.SetString( AllocPooledString(engine->Cmd_Argv(3)) );
		}
		if ( engine->Cmd_Argc() >= 5 )
		{
			delay = atoi( engine->Cmd_Argv(4) );
		}

		g_EventQueue.AddEvent( target, action, value, delay, pPlayer, pPlayer );
	}
}
static ConCommand sv_ent_fire("sv_ent_fire", CC_sv_ent_fire_f, "Fires an entity serverside", 0);