Skip to content

Commit

Permalink
Update _northstar_cheatcommands.nut
Browse files Browse the repository at this point in the history
  • Loading branch information
NachosChipeados committed Jan 15, 2025
1 parent 92fc8e7 commit 61a1199
Showing 1 changed file with 30 additions and 10 deletions.
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
}

0 comments on commit 61a1199

Please sign in to comment.