mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 13:14:51 +00:00
Realtime cheats (#197)
* have cheats auto-update (send notif to client, use updated value in server) * cheats did not need to be registered here as it's registered by the engine * also not needed.
This commit is contained in:
parent
1737b8a878
commit
302e2d7a2a
@ -468,7 +468,7 @@ ClientCommand
|
||||
called each time a player uses a "cmd" command
|
||||
============
|
||||
*/
|
||||
extern float g_flWeaponCheat;
|
||||
extern cvar_t *g_enable_cheats;
|
||||
|
||||
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
|
||||
void ClientCommand( edict_t *pEntity )
|
||||
@ -496,7 +496,7 @@ void ClientCommand( edict_t *pEntity )
|
||||
}
|
||||
else if( FStrEq(pcmd, "give" ) )
|
||||
{
|
||||
if( g_flWeaponCheat != 0.0f )
|
||||
if( g_enable_cheats->value != 0 )
|
||||
{
|
||||
int iszItem = ALLOC_STRING( CMD_ARGV( 1 ) ); // Make a copy of the classname
|
||||
GetClassPtr( (CBasePlayer *)pev )->GiveNamedItem( STRING( iszItem ) );
|
||||
@ -504,7 +504,7 @@ void ClientCommand( edict_t *pEntity )
|
||||
}
|
||||
else if( FStrEq( pcmd, "fire" ) )
|
||||
{
|
||||
if( g_flWeaponCheat != 0.0f )
|
||||
if( g_enable_cheats->value != 0 )
|
||||
{
|
||||
CBaseEntity *pPlayer = CBaseEntity::Instance( pEntity );
|
||||
if( CMD_ARGC() > 1 )
|
||||
@ -540,7 +540,7 @@ void ClientCommand( edict_t *pEntity )
|
||||
}
|
||||
else if( FStrEq( pcmd, "fov" ) )
|
||||
{
|
||||
if( g_flWeaponCheat && CMD_ARGC() > 1 )
|
||||
if( g_enable_cheats->value != 0 && CMD_ARGC() > 1 )
|
||||
{
|
||||
GetClassPtr( (CBasePlayer *)pev )->m_iFOV = atoi( CMD_ARGV( 1 ) );
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER };
|
||||
cvar_t *g_psv_gravity = NULL;
|
||||
cvar_t *g_psv_aim = NULL;
|
||||
cvar_t *g_footsteps = NULL;
|
||||
cvar_t *g_enable_cheats = NULL;
|
||||
|
||||
cvar_t *g_psv_developer;
|
||||
|
||||
@ -467,6 +468,8 @@ void GameDLLInit( void )
|
||||
|
||||
g_psv_developer = CVAR_GET_POINTER( "developer" );
|
||||
|
||||
g_enable_cheats = CVAR_GET_POINTER( "sv_cheats" );
|
||||
|
||||
CVAR_REGISTER( &displaysoundlist );
|
||||
CVAR_REGISTER( &allow_spectators );
|
||||
|
||||
@ -497,6 +500,8 @@ void GameDLLInit( void )
|
||||
|
||||
CVAR_REGISTER( &mp_chattime );
|
||||
|
||||
|
||||
|
||||
// REGISTER CVARS FOR SKILL LEVEL STUFF
|
||||
// Agrunt
|
||||
CVAR_REGISTER( &sk_agrunt_health1 );// {"sk_agrunt_health1","0"};
|
||||
|
@ -44,6 +44,7 @@ extern cvar_t allowmonsters;
|
||||
extern cvar_t *g_psv_gravity;
|
||||
extern cvar_t *g_psv_aim;
|
||||
extern cvar_t *g_footsteps;
|
||||
extern cvar_t *g_enable_cheats;
|
||||
|
||||
extern cvar_t *g_psv_developer;
|
||||
#endif // GAME_H
|
||||
|
@ -3355,7 +3355,7 @@ void CBasePlayer::ForceClientDllUpdate( void )
|
||||
ImpulseCommands
|
||||
============
|
||||
*/
|
||||
extern float g_flWeaponCheat;
|
||||
extern cvar_t *g_enable_cheats;
|
||||
|
||||
void CBasePlayer::ImpulseCommands()
|
||||
{
|
||||
@ -3434,7 +3434,7 @@ void CBasePlayer::ImpulseCommands()
|
||||
void CBasePlayer::CheatImpulseCommands( int iImpulse )
|
||||
{
|
||||
#if !HLDEMO_BUILD
|
||||
if( g_flWeaponCheat == 0.0f )
|
||||
if( g_enable_cheats->value == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -449,7 +449,6 @@ LINK_ENTITY_TO_CLASS( worldspawn, CWorld )
|
||||
#define SF_WORLD_FORCETEAM 0x0004 // Force teams
|
||||
|
||||
extern DLL_GLOBAL BOOL g_fGameOver;
|
||||
float g_flWeaponCheat;
|
||||
|
||||
void CWorld::Spawn( void )
|
||||
{
|
||||
@ -652,9 +651,6 @@ void CWorld::Precache( void )
|
||||
{
|
||||
CVAR_SET_FLOAT( "mp_defaultteam", 0.0f );
|
||||
}
|
||||
|
||||
// g-cont. moved here so cheats will working on restore level
|
||||
g_flWeaponCheat = CVAR_GET_FLOAT( "sv_cheats" ); // Is the impulse 101 command allowed?
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user