VGUI HTML Screen In Multiplayer/sv htmlview support.cpp: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (→‎top: clean up, added deadend tag)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Dead end|date=January 2024}}
<pre>//========= Public Domain 2007, Julian 'Daedalus' Thatcher. =====================//
<pre>//========= Public Domain 2007, Julian 'Daedalus' Thatcher. =====================//
//
//
Line 28: Line 30:
pPlayer = NULL;
pPlayer = NULL;
}
}


if ( engine->Cmd_Argc() < 2 )
if ( engine->Cmd_Argc() < 2 )
Line 59: Line 60:
static ConCommand sv_ent_fire("sv_ent_fire", CC_sv_ent_fire_f, "Fires an entity serverside", 0);
static ConCommand sv_ent_fire("sv_ent_fire", CC_sv_ent_fire_f, "Fires an entity serverside", 0);
</pre>
</pre>
[[Category:VGUI]]
[[Category:Programming]]

Latest revision as of 10:18, 21 January 2024

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 (daedalus.raistlin@gmail.com)
// $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);