VGUI HTML Screen In Multiplayer/sv htmlview support.cpp
Jump to navigation
Jump to search
//========= 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);