Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
Thomas

Скрипт на ванильный замок

Ребята нужен скрипт, чтобы ванильный замок запоминал владельца и повторно не вводил пароль
А просто спокойно мог открывать воротину
По типу как кодлок модовый но без новой модели и без меню ввода 
Если что готов купить 

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0
2 часа назад, Thomas сказал:

@123new Мне уже стыдно второй раз кидать) image.png.504ea2ac99a920b2ec4e5d421868ea44.png

учитесь разбирать ошибки и скриптить, это в ваших интересах

modded class CombinationLock extends ItemBase
{
	ref array <string>  EnteredPassword = new ref array <string>;
	
	override void UnlockServer( EntityAI player, EntityAI parent )
	{
		super.UnlockServer( player, parent );
		if(player)
		{
			private PlayerBase player_b = PlayerBase.Cast(player);
			private PlayerIdentity p_identity = player_b.GetIdentity();
			if(p_identity)
			{
				private string Steam64ID_Player = p_identity.GetPlainId();
				if(!IsKnownUser(Steam64ID_Player))
				{
					EnteredPassword.Insert(Steam64ID_Player);
				}
			}
		}
	}
	bool IsKnownUser(string Steam64ID)
	{
		if(EnteredPassword.Find(Steam64ID) >= 0)
		{
			return true;
		} else
		{
			return false;
		}
	}
}

modded class ActionDialCombinationLockOnTarget
{

	override void OnFinishProgressServer( ActionData action_data )
	{	
		private bool used_custom = false;
		private string Steam64ID_Player = "uncnown";
		if(action_data.m_Player)
		{
			PlayerIdentity p_identity = action_data.m_Player.GetIdentity();
			if(p_identity)
			{
				Steam64ID_Player = p_identity.GetPlainId();
			}
		}
		if(Steam64ID_Player != "uncnown")
		{
			ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
			CombinationLock combination_lock =  construction_action_data.GetCombinationLock();
			if ( combination_lock )
			{
				if(combination_lock.IsKnownUser(Steam64ID_Player))
				{
					used_custom = true;
					combination_lock.DialNextNumber();
					EntityAI target_entity = EntityAI.Cast( action_data.m_Target.GetObject() );
					combination_lock.UnlockServer( action_data.m_Player, target_entity.GetHierarchyParent() );
				}
			}
		}
		if(!used_custom)
		{
			super.OnFinishProgressServer( action_data );
		}
	}
}

сервер запускается нормально. На сервере не тестил

Edited by 123new (see edit history)

Share this post


Link to post
Share on other sites







  • 0
modded class CombinationLock extends ItemBase
{
	ref array <string>  EnteredPassword = new ref array <string>;
	
	override void UnlockServer( EntityAI player, EntityAI parent )
	{
		super.UnlockServer( player, parent );
		if(player)
		{
			private PlayerIdentity p_identity = player.GetIdentity();
			if(p_identity)
			{
				private string Steam64ID_Player = p_identity.GetPlainId();
				if(!IsKnownUser(Steam64ID_Player))
				{
					EnteredPassword.insert(Steam64ID_Player);
				}
			}
		}
	}
	bool IsKnownUser(string Steam64ID)
	{
		if(EnteredPassword.Contains(Steam64ID))
		{
			return true;
		} else
		{
			return false;
		}
	}
}

+

modded class ActionDialCombinationLockOnTarget
{

	override void OnFinishProgressServer( ActionData action_data )
	{	
		private bool used_custom = false;
		private string Steam64ID_Player = "uncnown";
		if(action_data.m_Player)
		{
			PlayerIdentity p_identity = action_data.m_Player.GetIdentity();
			if(p_identity)
			{
				private string Steam64ID_Player = p_identity.GetPlainId();
			}
		}
		if(Steam64ID_Player != "uncnown")
		{
			ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
			CombinationLock combination_lock =  construction_action_data.GetCombinationLock();
			if ( combination_lock )
			{
				if(combination_lock.IsKnownUser(Steam64ID_Player))
				{
					used_custom = true;
					combination_lock.DialNextNumber();
					EntityAI target_entity = EntityAI.Cast( action_data.m_Target.GetObject() );
					combination_lock.UnlockServer( action_data.m_Player, target_entity.GetHierarchyParent() );
				}
			}
		}
		if(!used_custom)
		{
			super.OnFinishProgressServer( action_data );
		}
	}
}

В теории этого достаточно, не проверял код. Должен до рестарта введенные верные пароли запоминать.

Share this post


Link to post
Share on other sites
  • 0
3 минуты назад, Thomas сказал:
private string Steam64ID_Player = p_identity.GetPlainId();

на

Steam64ID_Player = p_identity.GetPlainId();

 

Share this post


Link to post
Share on other sites
  • 0

Интересный скрипт)А куда добавлять?На серверную или клиентскую часть?

 

Share this post


Link to post
Share on other sites
  • 0
2 часа назад, sabrinka30 сказал:

Интересный скрипт)А куда добавлять?На серверную или клиентскую часть?

 

серверной думается достаточно))

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.