NoClip Fix - Removed NoClipOff - Toggle Hide (#263)

* Usage of Hide is now consistent with NoClip; toggleable
Removed obsolete !NoClipOff
This commit is contained in:
Amos 2022-09-11 17:51:10 +01:00 committed by GitHub
parent 1e1e8bbe7b
commit d5cf4451a2
2 changed files with 59 additions and 116 deletions

View File

@ -57,13 +57,11 @@ RegisterClientCommands()
scripts\_integration_base::AddClientCommand( "TakeWeapons", true, ::TakeWeaponsImpl ); scripts\_integration_base::AddClientCommand( "TakeWeapons", true, ::TakeWeaponsImpl );
scripts\_integration_base::AddClientCommand( "SwitchTeams", true, ::TeamSwitchImpl ); scripts\_integration_base::AddClientCommand( "SwitchTeams", true, ::TeamSwitchImpl );
scripts\_integration_base::AddClientCommand( "Hide", false, ::HideImpl ); scripts\_integration_base::AddClientCommand( "Hide", false, ::HideImpl );
scripts\_integration_base::AddClientCommand( "Unhide", false, ::UnhideImpl );
scripts\_integration_base::AddClientCommand( "Alert", true, ::AlertImpl ); scripts\_integration_base::AddClientCommand( "Alert", true, ::AlertImpl );
scripts\_integration_base::AddClientCommand( "Goto", false, ::GotoImpl ); scripts\_integration_base::AddClientCommand( "Goto", false, ::GotoImpl );
scripts\_integration_base::AddClientCommand( "Kill", true, ::KillImpl ); scripts\_integration_base::AddClientCommand( "Kill", true, ::KillImpl );
scripts\_integration_base::AddClientCommand( "SetSpectator", true, ::SetSpectatorImpl ); scripts\_integration_base::AddClientCommand( "SetSpectator", true, ::SetSpectatorImpl );
scripts\_integration_base::AddClientCommand( "LockControls", true, ::LockControlsImpl ); scripts\_integration_base::AddClientCommand( "LockControls", true, ::LockControlsImpl );
scripts\_integration_base::AddClientCommand( "UnlockControls", true, ::UnlockControlsImpl );
scripts\_integration_base::AddClientCommand( "PlayerToMe", true, ::PlayerToMeImpl ); scripts\_integration_base::AddClientCommand( "PlayerToMe", true, ::PlayerToMeImpl );
scripts\_integration_base::AddClientCommand( "NoClip", false, ::NoClipImpl ); scripts\_integration_base::AddClientCommand( "NoClip", false, ::NoClipImpl );
} }
@ -300,7 +298,13 @@ LockControlsImpl()
return self.name + "^7 is not alive"; return self.name + "^7 is not alive";
} }
if ( !IsDefined ( self.isControlLocked ) )
{
self.isControlLocked = false;
}
if ( !self.isControlLocked )
{
self freezeControls( true ); self freezeControls( true );
self God(); self God();
self Hide(); self Hide();
@ -311,21 +315,20 @@ LockControlsImpl()
self AlertImpl( undefined, info ); self AlertImpl( undefined, info );
self.isControlLocked = true;
return self.name + "\'s controls are locked"; return self.name + "\'s controls are locked";
}
UnlockControlsImpl()
{
if ( !IsAlive( self ) )
{
return self.name + "^7 is not alive";
} }
else
{
self freezeControls( false ); self freezeControls( false );
self God(); self God();
self Show(); self Show();
self.isControlLocked = false;
return self.name + "\'s controls are unlocked"; return self.name + "\'s controls are unlocked";
}
} }
NoClipImpl() NoClipImpl()
@ -333,6 +336,7 @@ NoClipImpl()
if ( !IsAlive( self ) ) if ( !IsAlive( self ) )
{ {
self IPrintLnBold( "You are not alive" ); self IPrintLnBold( "You are not alive" );
return;
} }
if ( !IsDefined ( self.isNoClipped ) ) if ( !IsDefined ( self.isNoClipped ) )
@ -357,19 +361,17 @@ NoClipImpl()
else else
{ {
self SetClientDvar( "sv_cheats", 1 ); self SetClientDvar( "sv_cheats", 1 );
self SetClientDvar( "cg_thirdperson", 1 ); self SetClientDvar( "cg_thirdperson", 0 );
self SetClientDvar( "sv_cheats", 0 ); self SetClientDvar( "sv_cheats", 0 );
self God(); self God();
self Noclip(); self Noclip();
self Hide(); self Show();
self.isNoClipped = false; self.isNoClipped = false;
self IPrintLnBold( "NoClip disabled" ); self IPrintLnBold( "NoClip disabled" );
} }
self IPrintLnBold( "NoClip enabled" );
} }
HideImpl() HideImpl()
@ -380,38 +382,26 @@ HideImpl()
return; return;
} }
if ( !IsDefined ( self.isHidden ) )
{
self.isHidden = false;
}
if ( !self.isHidden )
{
self SetClientDvar( "sv_cheats", 1 ); self SetClientDvar( "sv_cheats", 1 );
self SetClientDvar( "cg_thirdperson", 1 ); self SetClientDvar( "cg_thirdperson", 1 );
self SetClientDvar( "sv_cheats", 0 ); self SetClientDvar( "sv_cheats", 0 );
if ( !IsDefined( self.savedHealth ) || self.health < 1000 )
{
self.savedHealth = self.health;
self.savedMaxHealth = self.maxhealth;
}
self God(); self God();
self Hide(); self Hide();
self.isHidden = true; self.isHidden = true;
self IPrintLnBold( "You are now ^5hidden ^7from other players" ); self IPrintLnBold( "Hide enabled" );
}
UnhideImpl()
{
if ( !IsAlive( self ) )
{
self IPrintLnBold( "You are not alive" );
return;
} }
else
if ( !IsDefined( self.isHidden ) || !self.isHidden )
{ {
self IPrintLnBold( "You are not hidden" );
return;
}
self SetClientDvar( "sv_cheats", 1 ); self SetClientDvar( "sv_cheats", 1 );
self SetClientDvar( "cg_thirdperson", 0 ); self SetClientDvar( "cg_thirdperson", 0 );
self SetClientDvar( "sv_cheats", 0 ); self SetClientDvar( "sv_cheats", 0 );
@ -421,7 +411,8 @@ UnhideImpl()
self.isHidden = false; self.isHidden = false;
self IPrintLnBold( "You are now ^5visible ^7to other players" ); self IPrintLnBold( "Hide disabled" );
}
} }
AlertImpl( event, data ) AlertImpl( event, data )

View File

@ -147,24 +147,6 @@ let commands = [{
sendScriptCommand(gameEvent.Owner, 'LockControls', gameEvent.Origin, gameEvent.Target, undefined); sendScriptCommand(gameEvent.Owner, 'LockControls', gameEvent.Origin, gameEvent.Target, undefined);
} }
}, },
{
name: 'unlockcontrols',
description: 'unlocks target player\'s controls',
alias: 'ulc',
permission: 'Administrator',
targetRequired: true,
arguments: [{
name: 'player',
required: true
}],
supportedGames: ['IW4', 'IW5'],
execute: (gameEvent) => {
if (!validateEnabled(gameEvent.Owner, gameEvent.Origin)) {
return;
}
sendScriptCommand(gameEvent.Owner, 'UnlockControls', gameEvent.Origin, gameEvent.Target, undefined);
}
},
{ {
name: 'noclip', name: 'noclip',
description: 'enable noclip on yourself ingame', description: 'enable noclip on yourself ingame',
@ -180,21 +162,6 @@ let commands = [{
sendScriptCommand(gameEvent.Owner, 'NoClip', gameEvent.Origin, gameEvent.Origin, undefined); sendScriptCommand(gameEvent.Owner, 'NoClip', gameEvent.Origin, gameEvent.Origin, undefined);
} }
}, },
{
name: 'noclipoff',
description: 'disable noclip on yourself ingame',
alias: 'nco',
permission: 'SeniorAdmin',
targetRequired: false,
arguments: [],
supportedGames: ['IW4', 'IW5'],
execute: (gameEvent) => {
if (!validateEnabled(gameEvent.Owner, gameEvent.Origin)) {
return;
}
sendScriptCommand(gameEvent.Owner, 'NoClipOff', gameEvent.Origin, gameEvent.Origin, undefined);
}
},
{ {
name: 'hide', name: 'hide',
description: 'hide yourself ingame', description: 'hide yourself ingame',
@ -210,21 +177,6 @@ let commands = [{
sendScriptCommand(gameEvent.Owner, 'Hide', gameEvent.Origin, gameEvent.Origin, undefined); sendScriptCommand(gameEvent.Owner, 'Hide', gameEvent.Origin, gameEvent.Origin, undefined);
} }
}, },
{
name: 'unhide',
description: 'unhide yourself ingame',
alias: 'unh',
permission: 'SeniorAdmin',
targetRequired: false,
arguments: [],
supportedGames: ['IW4', 'IW5'],
execute: (gameEvent) => {
if (!validateEnabled(gameEvent.Owner, gameEvent.Origin)) {
return;
}
sendScriptCommand(gameEvent.Owner, 'Unhide', gameEvent.Origin, gameEvent.Origin, undefined);
}
},
{ {
name: 'alert', name: 'alert',
description: 'alert a player', description: 'alert a player',