Skip to content

CanUseLockedEntity

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void CanUseLockedEntity( BasePlayer player, CodeLock instance )
{
    Puts( "CanUseLockedEntity works!" );
}
csharp
private void CanUseLockedEntity( BasePlayer player, KeyLock instance )
{
    Puts( "CanUseLockedEntity works!" );
}

Location

  • CodeLock::OnTryToClose(BasePlayer player)
  • CodeLock::OnTryToOpen(BasePlayer player)
  • KeyLock::OnTryToClose(BasePlayer player)
  • KeyLock::OnTryToOpen(BasePlayer player)
csharp
public override bool OnTryToClose(BasePlayer player)
{
	object returnvar = Interface.CallHook("CanUseLockedEntity", player, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	if (!base.IsLocked())
//---
csharp
public override bool OnTryToOpen(BasePlayer player)
{
	object returnvar = Interface.CallHook("CanUseLockedEntity", player, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	if (!base.IsLocked())
//---
csharp
public override bool OnTryToClose(BasePlayer player)
{
	object returnvar = Interface.CallHook("CanUseLockedEntity", player, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return this.HasLockPermission(player) || !base.IsLocked();
//---
csharp
public override bool OnTryToOpen(BasePlayer player)
{
	object returnvar = Interface.CallHook("CanUseLockedEntity", player, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return this.HasLockPermission(player) || !base.IsLocked();
//---

Released under the MIT License.