Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly improved Northstar cheatcommands #916

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,39 @@ void function NorthstarCheatCommands_Init()
AddClientCommandCallback( "noclip", ClientCommandCallbackToggleNoclip )
AddClientCommandCallback( "notarget", ClientCommandCallbackToggleNotarget )
AddClientCommandCallback( "demigod", ClientCommandCallbackToggleDemigod )
AddClientCommandCallback( "god", ClientCommandCallbackToggleDemigod )
AddClientCommandCallback( "kill", ClientCommandCallbackKill )
AddClientCommandCallback( "explode", ClientCommandCallbackExplode )

AddClientCommandCallback( "NOCLIP", ClientCommandCallbackToggleNoclip )
AddClientCommandCallback( "NOTARGET", ClientCommandCallbackToggleNotarget )
AddClientCommandCallback( "DEMIGOD", ClientCommandCallbackToggleDemigod )
AddClientCommandCallback( "GOD", ClientCommandCallbackToggleDemigod )
AddClientCommandCallback( "KILL", ClientCommandCallbackKill )
AddClientCommandCallback( "EXPLODE", ClientCommandCallbackExplode )
}

bool function ClientCommandCallbackToggleNoclip( entity player, array<string> args )
{
if ( !GetConVarBool( "sv_cheats" ) )
return true
if( player.GetParent() ) // change movetype while setparented will crash the server
if ( player.GetParent() ) // change movetype while setparented will crash the server
{
print( player + " failed noclipping because the entity is parented" )
return true
}

print( player + " TOGGLED NOCLIP" )

if ( player.IsNoclipping() )
{
player.SetPhysics( MOVETYPE_WALK )
print( player + " TOGGLED NOCLIP OFF" )
}
else
{
player.SetPhysics( MOVETYPE_NOCLIP )

print( player + " TOGGLED NOCLIP ON" )
}

return true
}

Expand All @@ -35,10 +47,14 @@ bool function ClientCommandCallbackToggleNotarget( entity player, array<string>
if ( !GetConVarBool( "sv_cheats" ) )
return true

print( player + " TOGGLED NOTARGET" )
if ( player.GetNoTarget() )
print( player + " TOGGLED NOTARGET OFF" )
else
print( player + " TOGGLED NOTARGET ON" )

player.SetNoTarget( !player.GetNoTarget() )
player.SetNoTargetSmartAmmo( player.GetNoTarget() )

return true
}

Expand All @@ -47,28 +63,32 @@ bool function ClientCommandCallbackToggleDemigod( entity player, array<string> a
if ( !GetConVarBool( "sv_cheats" ) )
return true

print( player + " TOGGLED DEMIGOD" )

if ( IsDemigod( player ) )
{
DisableDemigod( player )
print( player + " TOGGLED DEMIGOD OFF" )
}
else
{
EnableDemigod( player )

print( player + " TOGGLED DEMIGOD ON" )
}

return true
}

bool function ClientCommandCallbackKill( entity player, array<string> args )
{
if ( IsAlive( player ) && ( GetConVarBool( "sv_cheats" ) || GetConVarBool( "ns_allow_kill_commands" ) ) )
player.Die()

return true
}

bool function ClientCommandCallbackExplode( entity player, array<string> args )
{
if ( IsAlive( player ) && ( GetConVarBool( "sv_cheats" ) || GetConVarBool( "ns_allow_kill_commands" ) ) )
player.Die( null, null, { scriptType = DF_GIB } )

return true
}
Loading