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
DSID

Логирование Drop item

Есть вопрос, есть ли сейчас вариант сохранить действия персонажа такие как выбрасывание на землю, или подбор с земли в инвентарь ?  был вариант в 1.3 работал отлично,  с переходом на 1.4 сломалось.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts










  • 0

BorizzK твой скрипт сломался ) мне нужно разобраться с багоюзерами и для этого мне нужно снова эти лог файлы )  не застал то время когда этот скрипт работал на серве, мне досталось только это ) 

//MOD AUTHOR: BORIZZ.K s-platoon.ru
//02.05.2019.2257

modded class HandActionDrop extends HandActionBase
{
	override void Action (HandEventBase e)
	{
		Man player 						= 	e.m_Player;
		EntityAI item 					= 	e.GetSrcEntity();

		super.Action(e);
	
		//Getss_DropItem_FNC().Place_item_with_fixed_pos_new(item, player);
		Getss_DropItem_FNC().Add_log_action("ItemInHands",item, player);
	}
}




class ZoS_DropItem_FNC
{
	float meters_for_check_position = 1.0;
	
	void Place_item_with_fixed_pos_new (EntityAI item, Man player)
	{
		private string myDebugString = "[ActionDropItems]: ";
		private PlayerIdentity p_identity;	private string Name_P;
		private string UID_P;	private string Game_UID_P;
		private string Game_ID_P;	private string coords_player;	
		private string message_log;	 private string TEMP_info_player;
		Man player_casted; 		
		player_casted = Man.Cast(player);
		if (player_casted)
		{
			p_identity = player.GetIdentity();
		}
		if (p_identity)
		{
			Name_P = p_identity.GetName();
			UID_P = p_identity.GetPlainId();
			Game_UID_P = p_identity.GetId();
			Game_ID_P = p_identity.GetPlayerId().ToString();
			coords_player = player.GetPosition().ToString();
			TEMP_info_player = "[ID:" + Game_ID_P + " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P + " Coords: " + coords_player + "] ";
		}
		if ((item) && (p_identity))
		{
			dBodyEnableGravity(item,true); //works with ItemBase/EntityAI items?			
			
			vector dropPosition = item.GetPosition();
			Object item_casted = Object.Cast(item);
			bool mCorrectDropPos = false;
			array<Object> nearest_objects = new array<Object>;
			array<CargoBase> proxy_cargos = new array<CargoBase>;
			GetGame().GetObjectsAtPosition3D(Vector(dropPosition[0],dropPosition[1] - 0.10,dropPosition[2]),1.1,nearest_objects,proxy_cargos);
			if (nearest_objects.Count() > 2)
			{
				for ( int i = 0; i < nearest_objects.Count(); i++ )
				{				
				//	message_log = myDebugString + TEMP_info_player + "Scan objects around position(" + dropPosition.ToString() + "): Found object: " + nearest_objects[i].GetType() + " in position:  " +  nearest_objects[i].GetPosition();
				//	Write_Log(message_log);					
					dropPosition[1] = nearest_objects[1].GetPosition()[1];
				//	message_log = myDebugString + TEMP_info_player + "For item " + item_casted.GetType() + " corrected dropposition, get a correct position from " + nearest_objects[1].GetType();
				//	Write_Log(message_log);
					mCorrectDropPos = true;
				}
				if (mCorrectDropPos)
				{
					dropPosition[1] = 	dropPosition[1] + 0.01;
					dropPosition[0]	=	dropPosition[0] + Math.RandomFloatInclusive(-0.050,0.050);
					dropPosition[1] =	dropPosition[1] + Math.RandomFloatInclusive(-0.001,0.020);
					dropPosition[2]	=	dropPosition[2] + Math.RandomFloatInclusive(-0.050,0.050);
					item.SetPosition(dropPosition);
					item.SetOrientation(item.GetOrientation());
					//message_log = myDebugString + TEMP_info_player + "For item " + item_casted.GetType() + " Finally correct dropposition: " + dropPosition.ToString();
					message_log = myDebugString + TEMP_info_player + "Dropped item " + item_casted.GetType() + " in position: " + dropPosition.ToString();
					Write_Log(message_log);
					//GetZoS_GlobalFunctions().WriteCustomLog("DropItemsLogs", "DropItemsLog.txt", message_log);
				}
			}
		}
	}
	
	void Add_log_action (string action_type, EntityAI item, Man player)
	{
		private string myDebugString = "[DropItem]: "; private string action_name = "[" + action_type + "]"; 
		private PlayerIdentity p_identity;	private string Name_P;
		private string UID_P;	private string Game_UID_P;
		private string Game_ID_P;	private string coords_player;	
		private string message_log;	 private string TEMP_info_player;
		Man player_casted; 		
		player_casted = Man.Cast(player);
		if (player_casted)
		{
			p_identity = player.GetIdentity();
		}
		if (p_identity)
		{
			Name_P = p_identity.GetName();
			UID_P = p_identity.GetPlainId();
			Game_UID_P = p_identity.GetId();
			Game_ID_P = p_identity.GetPlayerId().ToString();
			coords_player = player.GetPosition().ToString();
			TEMP_info_player = "[ID:" + Game_ID_P + " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P + " Coords: " + coords_player + "] ";
		}
		if ((item) && (p_identity))
		{			
			vector dropPosition = item.GetPosition();
			Object item_casted = Object.Cast(item);
			if(item_casted)
			{
				message_log = action_name + myDebugString + TEMP_info_player + "Drop item " + item_casted.GetType() + " in position: " + dropPosition.ToString();
				Write_Log(message_log);
			}
		}
	}
	
	void Place_item_with_fixed_pos (EntityAI item, Man player)
	{
		if (item)
		{			
			item.SetPosition(Found_SURF_obj_position(player));
			item.SetOrientation(item.GetOrientation());
		}	
	}
	
	private vector Found_SURF_obj_position(Man player)
	{
		vector dropPosition_item	=	player.GetPosition();
		
		while (!Check_another_obj_in_position(dropPosition_item, meters_for_check_position,player))
		{
			dropPosition_item[0]	=	dropPosition_item[0] + Math.RandomFloatInclusive(-0.5, 0.5);
			dropPosition_item[1] 	=	dropPosition_item[1] + Math.RandomFloatInclusive(-0.02, 0.02);
			dropPosition_item[2]	=	dropPosition_item[2] + Math.RandomFloatInclusive(-0.5, 0.5);
		}
		Print("::: SERVER: [HandActionDrop 111]: generated unicue dropPosition = " + dropPosition_item.ToString());
		return dropPosition_item;
	}	
	private bool Check_another_obj_in_position(vector pos_check, float distance_check,Man player_check)
	{
		bool return_val = true;
		Object player = Object.Cast(player_check);
		array<Object> nearest_objects = new array<Object>;
		array<CargoBase> proxy_cargos = new array<CargoBase>;
		GetGame().GetObjectsAtPosition(pos_check, distance_check, nearest_objects, proxy_cargos);
		if (nearest_objects.Count() > 0) 
		{
			for ( int i = 0; i < nearest_objects.Count(); i++ )
			{
				if(player != nearest_objects[i])
				{				
					Print("::: SERVER: [HandActionDrop DEBUG]: Found neared object: nearest_objects[i] " + nearest_objects[i].GetType() + ", nearest_objects[i].GetPosition() =  " +  nearest_objects[i].GetPosition());
					return_val = false;
				} else
				{
					Print("::: SERVER: [HandActionDrop DEBUG]: Found player object: nearest_objects[i] " + nearest_objects[i].GetType() + ", nearest_objects[i].GetPosition() =  " +  nearest_objects[i].GetPosition());
				}
			}
		}
		return return_val;
	}
	
	private void Write_Log(string message) 
	{
		//Print(message);
		//Print(String(message));
		//PrintFormat("%1", message);
		//Getss_GlobalFunctions().WritePrintLog(message);
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Getss_GlobalFunctions().WritePrintLog, (1 * 1000), false,message); 
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Getss_GlobalFunctions().WriteCustomLog, (1 * 1000), false,"DropItemsLogs", "DropItemsLog.txt", message); 
		//Getss_GlobalFunctions().WritePrintLog(message);
		//Getss_GlobalFunctions().WriteCustomLog("DropItemsLogs", "DropItemsLog.txt", message_log);
	}
}

static ref ss_DropItem_FNC g_ss_DropItem_FNC;
static ref ss_DropItem_FNC Getss_DropItem_FNC()
{
    if ( !g_ss_DropItem_FNC )
    {
         g_ss_DropItem_FNC = new ref ZoS_DropItem_FNC();
    }
    
    return g_ss_DropItem_FNC;
}


есть альтернатива этому, или есть вариант как этот скрипт исправить ? я только учусь скриптингу так что могу глупости говорит) и вообще я не уверен что это скрипт, а не мод  ) 

 

Share this post


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

BorizzK твой скрипт сломался ) мне нужно разобраться с багоюзерами и для этого мне нужно снова эти лог файлы )  не застал то время когда этот скрипт работал на серве, мне досталось только это ) 


//MOD AUTHOR: BORIZZ.K s-platoon.ru
//02.05.2019.2257

modded class HandActionDrop extends HandActionBase
{
	override void Action (HandEventBase e)
	{
		Man player 						= 	e.m_Player;
		EntityAI item 					= 	e.GetSrcEntity();

		super.Action(e);
	
		//Getss_DropItem_FNC().Place_item_with_fixed_pos_new(item, player);
		Getss_DropItem_FNC().Add_log_action("ItemInHands",item, player);
	}
}




class ZoS_DropItem_FNC
{
	float meters_for_check_position = 1.0;
	
	void Place_item_with_fixed_pos_new (EntityAI item, Man player)
	{
		private string myDebugString = "[ActionDropItems]: ";
		private PlayerIdentity p_identity;	private string Name_P;
		private string UID_P;	private string Game_UID_P;
		private string Game_ID_P;	private string coords_player;	
		private string message_log;	 private string TEMP_info_player;
		Man player_casted; 		
		player_casted = Man.Cast(player);
		if (player_casted)
		{
			p_identity = player.GetIdentity();
		}
		if (p_identity)
		{
			Name_P = p_identity.GetName();
			UID_P = p_identity.GetPlainId();
			Game_UID_P = p_identity.GetId();
			Game_ID_P = p_identity.GetPlayerId().ToString();
			coords_player = player.GetPosition().ToString();
			TEMP_info_player = "[ID:" + Game_ID_P + " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P + " Coords: " + coords_player + "] ";
		}
		if ((item) && (p_identity))
		{
			dBodyEnableGravity(item,true); //works with ItemBase/EntityAI items?			
			
			vector dropPosition = item.GetPosition();
			Object item_casted = Object.Cast(item);
			bool mCorrectDropPos = false;
			array<Object> nearest_objects = new array<Object>;
			array<CargoBase> proxy_cargos = new array<CargoBase>;
			GetGame().GetObjectsAtPosition3D(Vector(dropPosition[0],dropPosition[1] - 0.10,dropPosition[2]),1.1,nearest_objects,proxy_cargos);
			if (nearest_objects.Count() > 2)
			{
				for ( int i = 0; i < nearest_objects.Count(); i++ )
				{				
				//	message_log = myDebugString + TEMP_info_player + "Scan objects around position(" + dropPosition.ToString() + "): Found object: " + nearest_objects[i].GetType() + " in position:  " +  nearest_objects[i].GetPosition();
				//	Write_Log(message_log);					
					dropPosition[1] = nearest_objects[1].GetPosition()[1];
				//	message_log = myDebugString + TEMP_info_player + "For item " + item_casted.GetType() + " corrected dropposition, get a correct position from " + nearest_objects[1].GetType();
				//	Write_Log(message_log);
					mCorrectDropPos = true;
				}
				if (mCorrectDropPos)
				{
					dropPosition[1] = 	dropPosition[1] + 0.01;
					dropPosition[0]	=	dropPosition[0] + Math.RandomFloatInclusive(-0.050,0.050);
					dropPosition[1] =	dropPosition[1] + Math.RandomFloatInclusive(-0.001,0.020);
					dropPosition[2]	=	dropPosition[2] + Math.RandomFloatInclusive(-0.050,0.050);
					item.SetPosition(dropPosition);
					item.SetOrientation(item.GetOrientation());
					//message_log = myDebugString + TEMP_info_player + "For item " + item_casted.GetType() + " Finally correct dropposition: " + dropPosition.ToString();
					message_log = myDebugString + TEMP_info_player + "Dropped item " + item_casted.GetType() + " in position: " + dropPosition.ToString();
					Write_Log(message_log);
					//GetZoS_GlobalFunctions().WriteCustomLog("DropItemsLogs", "DropItemsLog.txt", message_log);
				}
			}
		}
	}
	
	void Add_log_action (string action_type, EntityAI item, Man player)
	{
		private string myDebugString = "[DropItem]: "; private string action_name = "[" + action_type + "]"; 
		private PlayerIdentity p_identity;	private string Name_P;
		private string UID_P;	private string Game_UID_P;
		private string Game_ID_P;	private string coords_player;	
		private string message_log;	 private string TEMP_info_player;
		Man player_casted; 		
		player_casted = Man.Cast(player);
		if (player_casted)
		{
			p_identity = player.GetIdentity();
		}
		if (p_identity)
		{
			Name_P = p_identity.GetName();
			UID_P = p_identity.GetPlainId();
			Game_UID_P = p_identity.GetId();
			Game_ID_P = p_identity.GetPlayerId().ToString();
			coords_player = player.GetPosition().ToString();
			TEMP_info_player = "[ID:" + Game_ID_P + " Name: " + Name_P + " UID: " + UID_P + " GAME_UID: " + Game_UID_P + " Coords: " + coords_player + "] ";
		}
		if ((item) && (p_identity))
		{			
			vector dropPosition = item.GetPosition();
			Object item_casted = Object.Cast(item);
			if(item_casted)
			{
				message_log = action_name + myDebugString + TEMP_info_player + "Drop item " + item_casted.GetType() + " in position: " + dropPosition.ToString();
				Write_Log(message_log);
			}
		}
	}
	
	void Place_item_with_fixed_pos (EntityAI item, Man player)
	{
		if (item)
		{			
			item.SetPosition(Found_SURF_obj_position(player));
			item.SetOrientation(item.GetOrientation());
		}	
	}
	
	private vector Found_SURF_obj_position(Man player)
	{
		vector dropPosition_item	=	player.GetPosition();
		
		while (!Check_another_obj_in_position(dropPosition_item, meters_for_check_position,player))
		{
			dropPosition_item[0]	=	dropPosition_item[0] + Math.RandomFloatInclusive(-0.5, 0.5);
			dropPosition_item[1] 	=	dropPosition_item[1] + Math.RandomFloatInclusive(-0.02, 0.02);
			dropPosition_item[2]	=	dropPosition_item[2] + Math.RandomFloatInclusive(-0.5, 0.5);
		}
		Print("::: SERVER: [HandActionDrop 111]: generated unicue dropPosition = " + dropPosition_item.ToString());
		return dropPosition_item;
	}	
	private bool Check_another_obj_in_position(vector pos_check, float distance_check,Man player_check)
	{
		bool return_val = true;
		Object player = Object.Cast(player_check);
		array<Object> nearest_objects = new array<Object>;
		array<CargoBase> proxy_cargos = new array<CargoBase>;
		GetGame().GetObjectsAtPosition(pos_check, distance_check, nearest_objects, proxy_cargos);
		if (nearest_objects.Count() > 0) 
		{
			for ( int i = 0; i < nearest_objects.Count(); i++ )
			{
				if(player != nearest_objects[i])
				{				
					Print("::: SERVER: [HandActionDrop DEBUG]: Found neared object: nearest_objects[i] " + nearest_objects[i].GetType() + ", nearest_objects[i].GetPosition() =  " +  nearest_objects[i].GetPosition());
					return_val = false;
				} else
				{
					Print("::: SERVER: [HandActionDrop DEBUG]: Found player object: nearest_objects[i] " + nearest_objects[i].GetType() + ", nearest_objects[i].GetPosition() =  " +  nearest_objects[i].GetPosition());
				}
			}
		}
		return return_val;
	}
	
	private void Write_Log(string message) 
	{
		//Print(message);
		//Print(String(message));
		//PrintFormat("%1", message);
		//Getss_GlobalFunctions().WritePrintLog(message);
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Getss_GlobalFunctions().WritePrintLog, (1 * 1000), false,message); 
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Getss_GlobalFunctions().WriteCustomLog, (1 * 1000), false,"DropItemsLogs", "DropItemsLog.txt", message); 
		//Getss_GlobalFunctions().WritePrintLog(message);
		//Getss_GlobalFunctions().WriteCustomLog("DropItemsLogs", "DropItemsLog.txt", message_log);
	}
}

static ref ss_DropItem_FNC g_ss_DropItem_FNC;
static ref ss_DropItem_FNC Getss_DropItem_FNC()
{
    if ( !g_ss_DropItem_FNC )
    {
         g_ss_DropItem_FNC = new ref ZoS_DropItem_FNC();
    }
    
    return g_ss_DropItem_FNC;
}


есть альтернатива этому, или есть вариант как этот скрипт исправить ? я только учусь скриптингу так что могу глупости говорит) и вообще я не уверен что это скрипт, а не мод  ) 

 

братик, основной блок кода его, но сам то скрипт переделанный не его, а мой, лично для проекта переделывал ;) И кстати не полный, это раз. Два, прежде чем выкладывать неплохо б наверно разобраться как люди вот в этом разбираться должны например:

Getss_DropItem_FNC().Add_log_action("ItemInHands",item, player);

Не зная что за функция и откуда. Хотя я скажу так - ты не все выложил ;)

А вообще б тебе выписать бы по всей строгости, негоже чужие наработки по форумам без согласия кидать (моя переделка, кусок кода узнаю хоть с бодуна), уж не говоря о том, что поинтересоваться и в личке можно было ;)
Ответ по твоему вопросу нет, т.к. все модификации с классом inventory защищены от изменения моддингом, а без моддинга ты с этим нихренашечки не сделаешь, разве что скриптить в scripts родном с отключением проверок сервера, чем чревато сам догадаешься.
 

Edited by 123new (see edit history)

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.