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
Sign in to follow this  
RageHands

Фикс спавна машин при рестарте.

Может кто поделится, как сделать, чтобы машины при спавне на наклонных местностях не спавнились под текстурой? А спавнились нормально и соответственно не убивались. Наудивление машины в море у меня не улетают, т.к вырезал дефолтные спавны и сделал через продавца покупку. Но, вот если ставят в здание поставленное на карте, то это дичь начинается. 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts










  • 0

BorizzK Это ещё работает или улучшили уже?
 

{
	// === Bug fix ===
	bool CarScriptMyDebug			= true;
	bool CarScriptMyFullDebug		= true;
	protected int m_dmgCounter 		= 0;
	protected int m_MaxVehDmgCount 	= 2048;
	// ====== Bug fix ======
	
	override void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
	{

		if ( zoneName == "" )
		{
			Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " >>> ERROR >>> OnContact dmg zone not defined!");
			return;
		}
		
		switch( zoneName )
		{
/*
			case "dmgZone_lightsLF":
				//Print("dmgZone_lightsLF");
			break;
			
			case "dmgZone_lightsRF":
				//Print("dmgZone_lightsRF");
			break;
*/
			default:
				if ( GetGame().IsServer() && zoneName != "")
				{
					float dmgMin = 150.0;	
					float dmgThreshold = 750.0;
					float dmgKillCrew = 3500.0; //Default 3000
					float dmg = data.Impulse * m_dmgContactCoef / 1.4; //26.05.2019 devider: 1.3 //CivilianSedan m_dmgContactCoef = 0.065; //OffroadHatchback m_dmgContactCoef = 0.075; //Hatchback_02 m_dmgContactCoef = 0.070;
					
					// ====== Test Bug fix ====== >>>
					bool m_CarWithCrew = false;
					for( int a = 0; a < CrewSize(); a++ )
					{
						if (CrewMember(a))
						{
							m_CarWithCrew = true;
							break;
						}
					}
					
					if (m_CarWithCrew && m_dmgCounter > 0)
					{
						m_dmgCounter = 0;
						if (CarScriptMyFullDebug) Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " with crew >>> reset m_dmgCounter = " + m_dmgCounter);
					}

					if (!m_CarWithCrew && GetGame().GetTickTime() > 120 && !this.EngineIsOn())
					{
						if (!Object.Cast(other).IsTransport()) dmg = 0;
						if (CarScriptMyFullDebug) Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: Engine OFF: car: " + this.ToString() + " zoneName = " + zoneName + " contact with " + other.ToString() + " type = " + Object.Cast(other).GetType() + ", pos: " + this.GetPosition().ToString() + " >>> " + " increase m_dmgCounter = " + m_dmgCounter + " health = " + this.GetHealth());
					}
					
					if (!m_CarWithCrew && GetGame().GetTickTime() < 120)
					{
						if (CarScriptMyDebug && (m_dmgCounter <= 10 || m_dmgCounter == 100 || m_dmgCounter == 500 || m_dmgCounter == 1000 || m_dmgCounter == 1500 || m_dmgCounter == m_MaxVehDmgCount))
						{
							Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " zoneName = " + zoneName + " contact with " + other.ToString() + ", pos: " + this.GetPosition().ToString() + " >>> " + " increase m_dmgCounter = " + m_dmgCounter + " health = " + this.GetHealth());
						}
						m_dmgCounter++;
						bool doDeleteCar = false;

						if (!this.EngineIsOn()) dmg = 0;
						
						if (this.GetPosition()[0] < 900 && this.GetPosition()[2] < 900)
						{
							doDeleteCar = true;
						}
						else if (m_dmgCounter > m_MaxVehDmgCount && this.GetHealth() <= 0 && GetGame().GetTickTime() < 60)
						{
							doDeleteCar = true;
						}

						if (doDeleteCar)
						{
							Object m_bugCar = this;
							Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: Bug Fix: Delete bugging car: " + m_bugCar.ToString() + " at pos: " + this.GetPosition() + " m_dmgCounter = " + m_dmgCounter + " health = " + m_bugCar.GetHealth() + " speef = " + this.GetSpeedometer());
							GetGame().ObjectDelete(m_bugCar);
							m_bugCar = NULL;
							break;
						}
					}
					if (dmg == 0) break;
					// <<< ====== Test Bug fix ======

					if ( dmg < dmgThreshold )
					{					
						if ( dmg > dmgMin )
						{
							AddHealth( zoneName, "Health", -dmg);
							//m_PlayCrashSoundLight = true;
							SynchCrashLightSound( true );
						}
					}
					else if (m_CarWithCrew)
					{
						for( int i =0; i < CrewSize(); i++ )
						{
							Human crew = CrewMember( i );
							if ( !crew )
								continue;

							PlayerBase player;
							if ( Class.CastTo(player, crew ) )
							{
								if ( dmg > dmgKillCrew )
								{		
										player.SetHealth(0.0);
								}
								else
								{
									//deal shock to player
									float shockTemp = Math.InverseLerp(dmgThreshold, dmgKillCrew, dmg);
									float shock = Math.Lerp( 50, 100, shockTemp );

									player.AddHealth("", "Shock", -shock );
									//Print( "SHOCK..........." + shock );
								}
							}
						}
						//m_PlayCrashSoundHeavy = true;
						SynchCrashHeavySound( true );
						ProcessDirectDamage( 3, null, zoneName, "EnviroDmg", "0 0 0", dmg );
					}
				}
			break;
		}

		UpdateHeadlightState();
		UpdateLights();
	}
}

 

Share this post


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

{ // === Bug fix === bool CarScriptMyDebug = true; bool CarScriptMyFullDebug = true; protected int m_dmgCounter = 0; protected int m_MaxVehDmgCount = 2048; // ====== Bug fix ====== override void OnContact( string zoneName, vector localPos, IEntity other, Contact data ) {

 

12 часа назад, paranoyk сказал:

BorizzK Это ещё работает или улучшили уже?
 


{
	// === Bug fix ===
	bool CarScriptMyDebug			= true;
	bool CarScriptMyFullDebug		= true;
	protected int m_dmgCounter 		= 0;
	protected int m_MaxVehDmgCount 	= 2048;
	// ====== Bug fix ======
	
	override void OnContact( string zoneName, vector localPos, IEntity other, Contact data )
	{

		if ( zoneName == "" )
		{
			Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " >>> ERROR >>> OnContact dmg zone not defined!");
			return;
		}
		
		switch( zoneName )
		{
/*
			case "dmgZone_lightsLF":
				//Print("dmgZone_lightsLF");
			break;
			
			case "dmgZone_lightsRF":
				//Print("dmgZone_lightsRF");
			break;
*/
			default:
				if ( GetGame().IsServer() && zoneName != "")
				{
					float dmgMin = 150.0;	
					float dmgThreshold = 750.0;
					float dmgKillCrew = 3500.0; //Default 3000
					float dmg = data.Impulse * m_dmgContactCoef / 1.4; //26.05.2019 devider: 1.3 //CivilianSedan m_dmgContactCoef = 0.065; //OffroadHatchback m_dmgContactCoef = 0.075; //Hatchback_02 m_dmgContactCoef = 0.070;
					
					// ====== Test Bug fix ====== >>>
					bool m_CarWithCrew = false;
					for( int a = 0; a < CrewSize(); a++ )
					{
						if (CrewMember(a))
						{
							m_CarWithCrew = true;
							break;
						}
					}
					
					if (m_CarWithCrew && m_dmgCounter > 0)
					{
						m_dmgCounter = 0;
						if (CarScriptMyFullDebug) Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " with crew >>> reset m_dmgCounter = " + m_dmgCounter);
					}

					if (!m_CarWithCrew && GetGame().GetTickTime() > 120 && !this.EngineIsOn())
					{
						if (!Object.Cast(other).IsTransport()) dmg = 0;
						if (CarScriptMyFullDebug) Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: Engine OFF: car: " + this.ToString() + " zoneName = " + zoneName + " contact with " + other.ToString() + " type = " + Object.Cast(other).GetType() + ", pos: " + this.GetPosition().ToString() + " >>> " + " increase m_dmgCounter = " + m_dmgCounter + " health = " + this.GetHealth());
					}
					
					if (!m_CarWithCrew && GetGame().GetTickTime() < 120)
					{
						if (CarScriptMyDebug && (m_dmgCounter <= 10 || m_dmgCounter == 100 || m_dmgCounter == 500 || m_dmgCounter == 1000 || m_dmgCounter == 1500 || m_dmgCounter == m_MaxVehDmgCount))
						{
							Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: car: " + this.ToString() + " zoneName = " + zoneName + " contact with " + other.ToString() + ", pos: " + this.GetPosition().ToString() + " >>> " + " increase m_dmgCounter = " + m_dmgCounter + " health = " + this.GetHealth());
						}
						m_dmgCounter++;
						bool doDeleteCar = false;

						if (!this.EngineIsOn()) dmg = 0;
						
						if (this.GetPosition()[0] < 900 && this.GetPosition()[2] < 900)
						{
							doDeleteCar = true;
						}
						else if (m_dmgCounter > m_MaxVehDmgCount && this.GetHealth() <= 0 && GetGame().GetTickTime() < 60)
						{
							doDeleteCar = true;
						}

						if (doDeleteCar)
						{
							Object m_bugCar = this;
							Print("::: SERVER: [Modded CarScript DEBUG]: Tick: " + GetGame().GetTickTime() + " OnContact: Bug Fix: Delete bugging car: " + m_bugCar.ToString() + " at pos: " + this.GetPosition() + " m_dmgCounter = " + m_dmgCounter + " health = " + m_bugCar.GetHealth() + " speef = " + this.GetSpeedometer());
							GetGame().ObjectDelete(m_bugCar);
							m_bugCar = NULL;
							break;
						}
					}
					if (dmg == 0) break;
					// <<< ====== Test Bug fix ======

					if ( dmg < dmgThreshold )
					{					
						if ( dmg > dmgMin )
						{
							AddHealth( zoneName, "Health", -dmg);
							//m_PlayCrashSoundLight = true;
							SynchCrashLightSound( true );
						}
					}
					else if (m_CarWithCrew)
					{
						for( int i =0; i < CrewSize(); i++ )
						{
							Human crew = CrewMember( i );
							if ( !crew )
								continue;

							PlayerBase player;
							if ( Class.CastTo(player, crew ) )
							{
								if ( dmg > dmgKillCrew )
								{		
										player.SetHealth(0.0);
								}
								else
								{
									//deal shock to player
									float shockTemp = Math.InverseLerp(dmgThreshold, dmgKillCrew, dmg);
									float shock = Math.Lerp( 50, 100, shockTemp );

									player.AddHealth("", "Shock", -shock );
									//Print( "SHOCK..........." + shock );
								}
							}
						}
						//m_PlayCrashSoundHeavy = true;
						SynchCrashHeavySound( true );
						ProcessDirectDamage( 3, null, zoneName, "EnviroDmg", "0 0 0", dmg );
					}
				}
			break;
		}

		UpdateHeadlightState();
		UpdateLights();
	}
}

Это надо в инит, в майн?

 

Share this post


Link to post
Share on other sites
  • 0

paranoyk Должно

я выложу улучшенный вариант  завтра

Но все равно - иногда авты пропадают

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
Sign in to follow this  

×
×
  • 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.