Skip to content

CanUnlock

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void CanUnlock( BasePlayer player, CodeLock instance )
{
    Puts( "CanUnlock works!" );
}
csharp
private void CanUnlock( BasePlayer player, KeyLock instance )
{
    Puts( "CanUnlock works!" );
}
csharp
private void CanUnlock( BasePlayer player, ModularCarCodeLock instance, string codeEntered )
{
    Puts( "CanUnlock works!" );
}

Location

  • CodeLock::TryUnlock(BaseEntity/RPCMessage rpc)
  • KeyLock::RPC_Unlock(BaseEntity/RPCMessage rpc)
  • ModularCarCodeLock::TryOpenWithCode(BasePlayer player, string codeEntered)
csharp
//---
	}
	if (!base.IsLocked())
	{
		return;
	}
	if (Interface.CallHook("CanUnlock", rpc.player, this) != null)
	{
		return;
	}
	if (this.IsCodeEntryBlocked())
	{
//---
csharp
//---
	}
	if (!base.IsLocked())
	{
		return;
	}
	if (Interface.CallHook("CanUnlock", rpc.player, this) != null)
	{
		return;
	}
	if (!this.HasLockPermission(rpc.player))
	{
//---
csharp
public bool TryOpenWithCode(BasePlayer player, string codeEntered)
{
	object returnvar = Interface.CallHook("CanUnlock", player, this, codeEntered);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	if (this.CodeEntryBlocked(player))
//---

Released under the MIT License.