dlls/client.cpp
9101112131415
===== client.cpp ========================================================
client/server game specific stuff
*/
9101112131415
===== client.cpp ========================================================
client/server game specific stuff
*/
323334353637
#include "globals.h"
#include "nav_mesh.h"
#include "team.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
323334353637383940
#include "globals.h"
#include "nav_mesh.h"
#include "team.h"
#include "ff_player.h"
#include "ff_scriptman.h"
#include "ff_luacontext.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
424344454647
extern CBaseEntity* FindPickerEntity( CBasePlayer* pPlayer );
ConVar *sv_cheats = NULL;
/*
============
ClientKill
45464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
extern CBaseEntity* FindPickerEntity( CBasePlayer* pPlayer );
ConVar *sv_cheats = NULL;
// Parse out % commands.
// return the number of command chars used, 1 or 2
inline int FF_ParsePercentCommand( edict_t *pEdict, const char *cCommand, char *pszText, int iDestLen )
{
// Current % Commands:
// %h = health
// %a = armor
// %c = class
// %l = location
// %d = disguised team class
// %i = if you add this do it clientside to use the hud_crosshairinfo stuff so it's consistant
// %sh - sentry health
// %sa - sentry ammo
// %sl - sentry location
// %sv - sentry level
// %dh - dispenser health
// %da - dispenser ammo
// %dl - dispenser location
// %df - detpack fuse time
CFFPlayer *pPlayer = ToFFPlayer( ( ( CBasePlayer * )CBaseEntity::Instance( pEdict ) ) );
if( !pPlayer )
return false;
switch( cCommand[0] )
{
case 'h':
case 'H':
{
if ( pPlayer->IsGassed() ) // Jiggles: Don't want players finding out their true health when gassed
{
V_strncpy( pszText, "LOL", sizeof(pszText) );
return 1;
}
else
{
Q_snprintf( pszText, iDestLen, "%i", pPlayer->GetHealth() );
return 1;
}
}
break;
case 'a':
case 'A':
{
if ( pPlayer->IsGassed() ) // Jiggles: Don't want players finding out their true armor when gassed
{
V_strncpy( pszText, "LOL", sizeof(pszText) );
return 1;
}
else
{
Q_snprintf( pszText, iDestLen, "%i", pPlayer->GetArmor() );
return 1;
}
}
break;
case 'c':
case 'C':
{
Q_snprintf( pszText, iDestLen, "%s", pPlayer->GetFFClassData().m_szPrintName );
return 1;
}
break;
case 'l':
case 'L':
{
Q_snprintf( pszText, iDestLen, "%s", g_pGameRules->GetChatLocation( true, pPlayer ) );
return 1;
}
break;
case 'd':
case 'D':
{
//////////////////////////////////////////////////////////////////////////
// Dispenser info
switch(cCommand[1])
{
case 'h':
case 'H':
{
CFFDispenser *pDispenser = pPlayer->GetDispenser();
if(pDispenser)
{
if(pDispenser->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", pDispenser->GetHealthPercent());
else
Q_snprintf( pszText, iDestLen, "0");
}
return 2;
}
case 'a':
case 'A':
{
CFFDispenser *pDispenser = pPlayer->GetDispenser();
if(pDispenser)
{
if(pDispenser->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", (int)pDispenser->m_iAmmoPercent);
else
Q_snprintf( pszText, iDestLen, "0");
}
return 2;
}
case 'l':
case 'L':
{
CFFDispenser *pDispenser = pPlayer->GetDispenser();
if(pDispenser)
{
Q_snprintf( pszText, iDestLen, "%s", pDispenser->GetLocation());
}
return 2;
}
default:
break;
}
//////////////////////////////////////////////////////////////////////////
int iDisguiseClass = pPlayer->GetClassSlot();
int iDisguiseTeam = pPlayer->GetTeamNumber();
if(pPlayer->IsDisguised())
{
iDisguiseTeam = pPlayer->GetDisguisedTeam();
iDisguiseClass = pPlayer->GetDisguisedClass();
}
const char *pClassName = "Spy";
const char *pTeamName = "";
const char COLOR_CHAR = '^';
const bool bInColor = (cCommand[1] == COLOR_CHAR);
switch(iDisguiseTeam)
{
case TEAM_BLUE:
pTeamName = bInColor ? "^1Blue" : "Blue";
break;
case TEAM_RED:
pTeamName = bInColor ? "^2Red" : "Red";
break;
case TEAM_YELLOW:
pTeamName = bInColor ? "^3Yellow" : "Yellow";
break;
case TEAM_GREEN:
pTeamName = bInColor ? "^4Green" : "Green";
break;
default:
pTeamName = "LOL";
break;
}
switch(iDisguiseClass)
{
case 1: pClassName = "Scout"; break;
case 2: pClassName = "Sniper"; break;
case 3: pClassName = "Soldier"; break;
case 4: pClassName = "Demoman"; break;
case 5: pClassName = "Medic"; break;
case 6: pClassName = "Hwguy"; break;
case 7: pClassName = "Pyro"; break;
case 8: pClassName = "Spy"; break;
case 9: pClassName = "Engineer"; break;
case 10: pClassName = "Civilian"; break;
default: pClassName = "LOL"; break;
}
Q_snprintf( pszText, iDestLen, "%s %s", pTeamName, pClassName );
return 1;
}
break;
case 's':
case 'S':
{
//////////////////////////////////////////////////////////////////////////
switch(cCommand[1])
{
case 'h':
case 'H':
{
CFFSentryGun *pSentry = pPlayer->GetSentryGun();
if(pSentry)
{
if(pSentry->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", pSentry->GetHealthPercent());
else
Q_snprintf( pszText, iDestLen, "0");
}
return 2;
}
case 'a':
case 'A':
{
CFFSentryGun *pSentry = pPlayer->GetSentryGun();
if(pSentry)
{
if(pSentry->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", (int)pSentry->m_iAmmoPercent);
else
Q_snprintf( pszText, iDestLen, "0");
}
return 2;
}
case 'v':
case 'V':
{
CFFSentryGun *pSentry = pPlayer->GetSentryGun();
if(pSentry)
{
if(pSentry->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", pSentry->GetLevel());
else
Q_snprintf( pszText, iDestLen, "1");
}
return 2;
}
case 'l':
case 'L':
{
CFFSentryGun *pSentry = pPlayer->GetSentryGun();
if(pSentry)
{
Q_snprintf( pszText, iDestLen, "%s", pSentry->GetLocation());
}
return 2;
}
default:
break;
}
//////////////////////////////////////////////////////////////////////////
break;
}
case 'p':
case 'P':
{
switch(cCommand[1])
{
case 'f':
case 'F':
{
CFFDetpack *pDetpack = pPlayer->GetDetpack();
if(pDetpack)
{
if (pDetpack->IsBuilt())
Q_snprintf( pszText, iDestLen, "%d", (int)(pDetpack->m_flDetonateTime - gpGlobals->curtime + 0.5f) );
else
{
float flBuildTimeLeft = pPlayer->GetBuildTime() - gpGlobals->curtime;
Q_snprintf( pszText, iDestLen, "%d", (int)(pDetpack->m_iFuseTime + flBuildTimeLeft + 0.5f) );
}
}
else
{
Q_snprintf( pszText, iDestLen, "-" );
}
return 2;
}
case 's':
case 'S':
{
CFFDetpack *pDetpack = pPlayer->GetDetpack();
if(pDetpack)
{
Q_snprintf( pszText, iDestLen, "%d", pDetpack->m_iFuseTime);
}
else
{
Q_snprintf( pszText, iDestLen, "-" );
}
return 2;
}
case 'l':
case 'L':
{
CFFDetpack *pDetpack = pPlayer->GetDetpack();
if(pDetpack)
{
Q_snprintf( pszText, iDestLen, "%s", pDetpack->GetLocation());
}
return 2;
}
}
break;
}
}
return 0;
}
/*
============
ClientKill
135136137138139140
if ( !p )
return;
CBasePlayer *pPlayer = NULL;
if ( pEdict )
{
433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
if ( !p )
return;
// Parse out % commands. Doing it here so it will
// get sent out to clients correctly especially
// if the location is a resource a resource string
// since that localization is done client side in
// ff_hud_chat.cpp
// Current % Commands:
// %h = health
// %a = armor
// %c = class
// %l = location
// Want to look in buf for any localized strings
// and convert them to resource strings if possible
char *pBeg = p;
int iAdjust = 1;
char szBuffer[ 4096 ], szText[ 4096 ];
bool bAddChar = true;
Q_strcpy( szBuffer, "\0" );
Q_strcpy( szText, "\0" );
int iPos = 0;
while( pBeg[ 0 ] )
{
iAdjust = 1;
bAddChar = true;
// Found a possible % command
if( ( pBeg[ 0 ] == '%' ) && pBeg[ 1 ] )
{
// If there's stuff in our buffer, dump it first
if( iPos )
{
// Copy buffer to text
Q_strncat( szText, szBuffer, sizeof(szText) );
// Clear buffer
Q_strncpy( szBuffer, "\0", sizeof(szBuffer) );
// Reset
iPos = 0;
}
// Parse the % command and get what
// should be in its place
char szTempText[ 1024 + 1 ] = {0}; // for location + \0
int iChars = FF_ParsePercentCommand( pEdict, &pBeg[1], szTempText, 1025 );
if(iChars > 0)
{
// Add to text
Q_strncat( szText, szTempText, sizeof(szText) );
// % commands are 2 characters long (for now)
iAdjust = 1+iChars;
// Don't add char as per normal
bAddChar = false;
}
}
// Add this character to the buffer
if( bAddChar )
{
// Add a character to our buffer
char ch = pBeg[ 0 ];
szBuffer[ iPos++ ] = ch;
if( iPos == 4096 )
szBuffer[ --iPos ] = '\0';
else
szBuffer[ iPos ] = '\0';
}
pBeg += iAdjust;
}
// If there's stuff in our buffer, dump it
if( iPos )
{
// Copy buffer to text
Q_strncat( szText, szBuffer, sizeof(szText) );
// Clear buffer
Q_strncpy( szBuffer, "\0", sizeof(szBuffer) );
// Reset
iPos = 0;
}
// Point p to our modified text
p = szText;
// Check again (will truncate if string too long)
p = CheckChatText( p );
if( !p )
return;
CBasePlayer *pPlayer = NULL;
if ( pEdict )
{
147148149150151152153
// See if the player wants to modify of check the text
pPlayer->CheckChatText( p, 127 ); // though the buffer szTemp that p points to is 256,
// chat text is capped to 127 in CheckChatText above
Assert( strlen( pPlayer->GetPlayerName() ) > 0 );
540541542543544545546
// See if the player wants to modify of check the text
pPlayer->CheckChatText( p, 127 ); // though the buffer szTemp that p points to is 256,
// chat text is capped to 127 in CheckChatText above
Assert( strlen( pPlayer->GetPlayerName() ) > 0 );
172173174175176177178179180181182183184185
if ( pszPrefix && strlen( pszPrefix ) > 0 )
{
if ( pszLocation && strlen( pszLocation ) )
{
Q_snprintf( text, sizeof(text), "%s %s @ %s: ", pszPrefix, pszPlayerName, pszLocation );
}
else
{
Q_snprintf( text, sizeof(text), "%s %s: ", pszPrefix, pszPlayerName );
}
}
else
{
565566567568569570571572573574575576577578579
if ( pszPrefix && strlen( pszPrefix ) > 0 )
{
// Mulch: don't do CS:S style locations
//if ( pszLocation && strlen( pszLocation ) )
//{
// Q_snprintf( text, sizeof(text), "%s %s @ %s: ", pszPrefix, pszPlayerName, pszLocation );
//}
//else
//{
Q_snprintf( text, sizeof(text), "%s %s: ", pszPrefix, pszPlayerName );
//}
}
else
{
193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
Q_strncat( text, p, sizeof( text ), COPY_ALL_CHARACTERS );
Q_strncat( text, "\n", sizeof( text ), COPY_ALL_CHARACTERS );
// loop through all players
// Start with the first player.
// This may return the world in single player if the client types something between levels or during spawn
// so check it, or it will infinite loop
client = NULL;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
client = UTIL_PlayerByIndex( i );
if ( !client || !client->edict() )
continue;
if ( client->edict() == pEdict )
continue;
if ( !(client->IsNetClient()) ) // Not a client ? (should never be true)
continue;
if ( teamonly && g_pGameRules->PlayerCanHearChat( client, pPlayer ) != GR_TEAMMATE )
continue;
if ( !client->CanHearChatFrom( pPlayer ) )
continue;
CSingleUserRecipientFilter user( client );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}
}
if ( pPlayer )
{
// print to the sending client
CSingleUserRecipientFilter user( pPlayer );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}
}
// echo to server console
// Adrian: Only do this if we're running a dedicated server since we already print to console on the client.
if ( engine->IsDedicatedServer() )
Msg( "%s", text );
Assert( p );
int userid = 0;
const char *networkID = "Console";
const char *playerName = "Console";
const char *playerTeam = "Console";
if ( pPlayer )
{
userid = pPlayer->GetUserID();
networkID = pPlayer->GetNetworkIDString();
playerName = pPlayer->GetPlayerName();
CTeam *team = pPlayer->GetTeam();
if ( team )
{
playerTeam = team->GetName();
}
}
if ( teamonly )
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" say_team \"%s\"\n", playerName, userid, networkID, playerTeam, p );
else
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" say \"%s\"\n", playerName, userid, networkID, playerTeam, p );
IGameEvent * event = gameeventmanager->CreateEvent( "player_say" );
if ( event ) // will be null if there are no listeners!
{
event->SetInt("userid", userid );
event->SetString("text", p );
event->SetInt("priority", 1 ); // HLTV event priority, not transmitted
gameeventmanager->FireEvent( event );
}
}
587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
Q_strncat( text, p, sizeof( text ), COPY_ALL_CHARACTERS );
Q_strncat( text, "\n", sizeof( text ), COPY_ALL_CHARACTERS );
// if lua doesn't have a player_onchat function, always allow the message
bool bMessageAllowed = true;
// send to lua
CFFLuaSC hContext( 0 );
hContext.Push( pPlayer );
hContext.Push( text );
// let lua decide if the message should go through, if a player_onchat function exists
if ( _scriptman.RunPredicates_LUA( NULL, &hContext, "player_onchat" ) )
{
bMessageAllowed = hContext.GetBool();
}
// if the message is allowed
if (bMessageAllowed)
{
// loop through all players
// Start with the first player.
// This may return the world in single player if the client types something between levels or during spawn
// so check it, or it will infinite loop
client = NULL;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
client = UTIL_PlayerByIndex( i );
if ( !client || !client->edict() )
continue;
if ( client->edict() == pEdict )
continue;
if ( !(client->IsNetClient()) ) // Not a client ? (should never be true)
continue;
if ( teamonly && g_pGameRules->PlayerCanHearChat( client, pPlayer ) != GR_TEAMMATE )
continue;
if ( !client->CanHearChatFrom( pPlayer ) )
continue;
CSingleUserRecipientFilter user( client );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}
}
if ( pPlayer )
{
// print to the sending client
CSingleUserRecipientFilter user( pPlayer );
user.MakeReliable();
if ( pszFormat )
{
UTIL_SayText2Filter( user, pPlayer, true, pszFormat, pszPlayerName, p, pszLocation );
}
else
{
UTIL_SayTextFilter( user, text, pPlayer, true );
}
}
// echo to server console
// Adrian: Only do this if we're running a dedicated server since we already print to console on the client.
if ( engine->IsDedicatedServer() )
Msg( "%s", text );
Assert( p );
int userid = 0;
const char *networkID = "Console";
const char *playerName = "Console";
const char *playerTeam = "Console";
if ( pPlayer )
{
userid = pPlayer->GetUserID();
networkID = pPlayer->GetNetworkIDString();
playerName = pPlayer->GetPlayerName();
CTeam *team = pPlayer->GetTeam();
if ( team )
{
playerTeam = team->GetName();
}
}
if ( teamonly )
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" say_team \"%s\"\n", playerName, userid, networkID, playerTeam, p );
else
UTIL_LogPrintf( "\"%s<%i><%s><%s>\" say \"%s\"\n", playerName, userid, networkID, playerTeam, p );
IGameEvent *event = gameeventmanager->CreateEvent( teamonly ? "player_sayteam" : "player_say" );
if ( event ) // will be null if there are no listeners!
{
event->SetInt("userid", userid );
event->SetString("text", p );
event->SetInt("priority", 1 ); // HLTV event priority, not transmitted
gameeventmanager->FireEvent( event );
}
}
}
296297298299300301302
CBaseEntity::PrecacheModel( "sprites/blueglow1.vmt" );
CBaseEntity::PrecacheModel( "sprites/purpleglow1.vmt" );
CBaseEntity::PrecacheModel( "sprites/purplelaser1.vmt" );
CBaseEntity::PrecacheScriptSound( "Player.FallDamage" );
CBaseEntity::PrecacheScriptSound( "Player.Swim" );
706707708709710711712
CBaseEntity::PrecacheModel( "sprites/blueglow1.vmt" );
CBaseEntity::PrecacheModel( "sprites/purpleglow1.vmt" );
CBaseEntity::PrecacheModel( "sprites/purplelaser1.vmt" );
CBaseEntity::PrecacheScriptSound( "Player.FallDamage" );
CBaseEntity::PrecacheScriptSound( "Player.Swim" );
323324325326327328329
CON_COMMAND_F( cast_ray, "Tests collision detection", FCVAR_CHEAT )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
Vector forward;
trace_t tr;
733734735736737738739
CON_COMMAND_F( cast_ray, "Tests collision detection", FCVAR_CHEAT )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
Vector forward;
trace_t tr;
345346347348349350351
CON_COMMAND_F( cast_hull, "Tests hull collision detection", FCVAR_CHEAT )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
Vector forward;
trace_t tr;
755756757758759760761
CON_COMMAND_F( cast_hull, "Tests hull collision detection", FCVAR_CHEAT )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
Vector forward;
trace_t tr;
397398399400401402403404405406407408
return CBaseEntity::Instance( index );
}
// Loop through all entities matching, starting from the specified previous
while ( (ent = gEntList.NextEnt(ent)) != NULL )
{
if ( (ent->GetEntityName() != NULL_STRING && ent->NameMatches(name)) ||
(ent->m_iClassname != NULL_STRING && ent->ClassMatches(name)) )
{
return ent;
}
807808809810811812813814815816817818
return CBaseEntity::Instance( index );
}
// Loop through all entities matching, starting from the specified previous
while ( (ent = gEntList.NextEnt(ent)) != NULL )
{
if ( (ent->GetEntityName() != NULL_STRING && ent->NameMatches(name)) ||
(ent->m_iClassname != NULL_STRING && ent->ClassMatches(name)) )
{
return ent;
}
512513514515516517518
}
BEGIN_DATADESC( CPointClientCommand )
DEFINE_INPUTFUNC( FIELD_STRING, "Command", InputCommand ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( point_clientcommand, CPointClientCommand );
922923924925926927928
}
BEGIN_DATADESC( CPointClientCommand )
DEFINE_INPUTFUNC( FIELD_STRING, "Command", InputCommand ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( point_clientcommand, CPointClientCommand );
541542543544545546547
}
BEGIN_DATADESC( CPointServerCommand )
DEFINE_INPUTFUNC( FIELD_STRING, "Command", InputCommand ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( point_servercommand, CPointServerCommand );
951952953954955956957
}
BEGIN_DATADESC( CPointServerCommand )
DEFINE_INPUTFUNC( FIELD_STRING, "Command", InputCommand ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( point_servercommand, CPointServerCommand );
602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
}
static ConCommand drawcross("drawcross", CC_DrawCross, "Draws a cross at the given location\n\tArguments: x y z", FCVAR_CHEAT);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CC_Player_Kill( void )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
if (pPlayer)
{
#ifdef _DEBUG
if ( engine->Cmd_Argc() > 1 )
#else
if ( engine->Cmd_Argc() > 1 && !g_pGameRules->IsMultiplayer() )
#endif
{
// Find the matching netname
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_PlayerByIndex(i) );
if ( pPlayer )
{
if ( Q_strstr( pPlayer->GetPlayerName(), engine->Cmd_Argv(1)) )
{
ClientKill( pPlayer->edict() );
}
}
}
}
else
{
ClientKill( pPlayer->edict() );
}
}
}
static ConCommand kill("kill", CC_Player_Kill, "kills the player");
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059
}
static ConCommand drawcross("drawcross", CC_DrawCross, "Draws a cross at the given location\n\tArguments: x y z", FCVAR_CHEAT);
/*
// Mulch: moving to ff_player.cpp
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CC_Player_Kill( void )
{
CBasePlayer *pPlayer = UTIL_GetCommandClient();
if (pPlayer)
{
#ifdef _DEBUG
if ( engine->Cmd_Argc() > 1 )
#else
if ( engine->Cmd_Argc() > 1 && !g_pGameRules->IsMultiplayer() )
#endif
{
// Find the matching netname
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_PlayerByIndex(i) );
if ( pPlayer )
{
if ( Q_strstr( pPlayer->GetPlayerName(), engine->Cmd_Argv(1)) )
{
// Bug #0000578: Suiciding using /kill doesn't cause a respawn delay
if( pPlayer->IsAlive() )
pPlayer->m_flNextSpawnDelay = 5.0f;
ClientKill( pPlayer->edict() );
}
}
}
}
else
{
// Bug #0000578: Suiciding using /kill doesn't cause a respawn delay
if( pPlayer->IsAlive() )
pPlayer->m_flNextSpawnDelay = 5.0f;
ClientKill( pPlayer->edict() );
}
}
}
static ConCommand kill("kill", CC_Player_Kill, "kills the player");
*/
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
723724725726727728729730731732733734735736737738
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CC_Player_FOV( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer && sv_cheats->GetBool() )
{
if ( engine->Cmd_Argc() > 1)
{
int FOV = atoi( engine->Cmd_Argv(1) );
pPlayer->SetDefaultFOV( FOV );
}
else
{
1141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Bug #0000310: fov doesn't reset |-- Mulch
void CC_Player_FOV( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer /* && sv_cheats->GetBool() */ )
{
if ( engine->Cmd_Argc() > 1)
{
int FOV = atoi( engine->Cmd_Argv(1) );
// Bug #0000310: fov doesn't reset |-- Mulch
if (FOV != 0) // |-- Mirv: Allow for 0 too in order to reset.
FOV = clamp( FOV, 80, 120 );
//pPlayer->SetDefaultFOV( FOV );
pPlayer->SetFOV( pPlayer, FOV );
}
else
{
768769770771772773774
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( !pPlayer)
return;
if ( engine->Cmd_Argc() < 2 )
{
Msg(" Usage: test_dispatcheffect \n " );
1192119311941195119611971198
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( !pPlayer)
return;
if ( engine->Cmd_Argc() < 2 )
{
Msg(" Usage: test_dispatcheffect \n " );
844845846847848849850
void CC_Player_PhysSwap( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
1268126912701271127212731274
void CC_Player_PhysSwap( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
875876877878879880881
void CC_Player_BugBaitSwap( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
1299130013011302130313041305
void CC_Player_BugBaitSwap( void )
{
CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() );
if ( pPlayer )
{
CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
982983984985986987988
Vector forward, right, up;
AngleVectors ( pl->v_angle, &forward, &right, &up);
// Try to move into the world
if ( !FindPassableSpace( pPlayer, forward, 1, oldorigin ) )
{
1406140714081409141014111412
Vector forward, right, up;
AngleVectors ( pl->v_angle, &forward, &right, &up);
// Try to move into the world
if ( !FindPassableSpace( pPlayer, forward, 1, oldorigin ) )
{
126312641265126612671268126912701271127212731274127512761277127812791280
if (((pstr = strstr(pcmd, "weapon_")) != NULL) && (pstr == pcmd))
{
// Subtype may be specified
if ( engine->Cmd_Argc() == 2 )
{
pPlayer->SelectItem( pcmd, atoi( engine->Cmd_Argv( 1 ) ) );
}
else
{
pPlayer->SelectItem(pcmd);
}
}
*/
if ( FStrEq( pcmd, "killtarget" ) )
{
if ( g_pDeveloper->GetBool() && sv_cheats->GetBool() && UTIL_IsCommandIssuedByServerAdmin() )
168716881689169016911692169316941695169616971698169917001701170217031704
if (((pstr = strstr(pcmd, "weapon_")) != NULL) && (pstr == pcmd))
{
// Subtype may be specified
if ( engine->Cmd_Argc() == 2 )
{
pPlayer->SelectItem( pcmd, atoi( engine->Cmd_Argv( 1 ) ) );
}
else
{
pPlayer->SelectItem(pcmd);
}
}
*/
if ( FStrEq( pcmd, "killtarget" ) )
{
if ( g_pDeveloper->GetBool() && sv_cheats->GetBool() && UTIL_IsCommandIssuedByServerAdmin() )