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
MUXOMOR1989

одежда при заходе на сервер

привет всем, помогите с хп одеждой при спавне на персонаже. где менять целостность одежды? с лутом вроде разобрался всё работает.а где и как хп вещей поправить незнаю(

Скрытый текст

void main()
{
	//INIT ECONOMY--------------------------------------
	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year, month, day, hour, minute;
	int reset_month = 9, reset_day = 20;
	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

	if ((month == reset_month) && (day < reset_day))
	{
		GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
	}
	else
	{
		if ((month == reset_month + 1) && (day > reset_day))
		{
			GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
		}
		else
		{
			if ((month < reset_month) || (month > reset_month + 1))
			{
				GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
			}
		}
	}
}

class CustomMission: MissionServer
{
	void SetRandomHealth(EntityAI itemEnt)
	{
		if ( itemEnt )
		{
			float rndHlt = Math.RandomFloat( 0.45, 0.65 );
			itemEnt.SetHealth01( "", "", rndHlt );
		}
	}

	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt;
        playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
        Class.CastTo(m_player, playerEnt);

        GetGame().SelectPlayer(identity, m_player);

        m_player.SetHealth("GlobalHealth", "Health", 35); //в процентах
        m_player.SetHealth("GlobalHealth", "Blood", 3500);//кровь
        m_player.GetStatEnergy().Set(400);//еда
        m_player.GetStatWater().Set(500);//вода
        
        return m_player;
	}

	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		EntityAI itemClothing;
		EntityAI itemEnt;
		ItemBase itemBs;
		float rand;

		itemClothing = player.FindAttachmentBySlotName( "Body" );
		if ( itemClothing )
			player.RemoveAllItems();
		player.GetInventory().CreateInInventory("GP5GasMask");// противогаз
		player.GetInventory().CreateInInventory("NBCHoodYellow"); //Капюшон NBC желтый
		player.GetInventory().CreateInInventory("NBCGlovesYellow");//Перчатки NBC желтые
        player.GetInventory().CreateInInventory("NBCJacketYellow");//Куртка NBC желтая
        player.GetInventory().CreateInInventory("NBCPantsYellow");//Брюки NBC Желтые
        player.GetInventory().CreateInInventory("NBCBootsYellow");//Ботинки NBC Желтые
		{
			SetRandomHealth( itemClothing );
			
			string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
			int rndIndex = Math.RandomInt( 0, 4 );
			itemEnt = itemClothing.GetInventory().CreateInInventory( chemlightArray[rndIndex] );
			SetRandomHealth( itemEnt );
			player.SetQuickBarEntityShortcut(itemEnt, 1);

			rand = Math.RandomFloatInclusive( 0.0, 1.0 );
			if ( rand < 0.35 )
				itemEnt = player.GetInventory().CreateInInventory( "Apple" );
			else if ( rand > 0.65 )
				itemEnt = player.GetInventory().CreateInInventory( "Pear" );
			else
				itemEnt = player.GetInventory().CreateInInventory( "Plum" );

			player.SetQuickBarEntityShortcut(itemEnt, 3);
						// нож
                itemEnt = player.GetInventory().CreateInInventory("SteakKnife");
				        //НАВИГАТОР
				itemEnt = player.GetInventory().CreateInInventory("GPSReceiver");
                itemEnt = player.GetInventory().CreateInInventory("BandageDressing");
			SetRandomHealth( itemEnt );
		}
		
		itemClothing = player.FindAttachmentBySlotName( "Legs" );
		if ( itemClothing )
			SetRandomHealth( itemClothing );
		
		itemClothing = player.FindAttachmentBySlotName( "Feet" );
	}
};

Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

что значит поправить?
если тебе нужно дамагать то используется функция SetRandomHealth
ели нужно всё идеально чистенькое из хичистки то просто поубирай эти вызовы

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.