Jump to content
kmiles1990

Safe Zones

Recommended Posts

Can someone show me how to set up a safe zone? Or how I can check if a player is in the bounds of coordinates in an array. Incase I have multiple safe zones? I know it is possible, as many server right now have safe zones.

Share this post


Link to post
Share on other sites

Unless something changed in the last few days safezones are only possible by banning players that break the rules as the setdamage false has been disabled by bi

Share this post


Link to post
Share on other sites
17 hours ago, Sy8282 said:

Unless something changed in the last few days safezones are only possible by banning players that break the rules as the setdamage false has been disabled by bi

 

21 hours ago, kmiles1990 said:

Can someone show me how to set up a safe zone? Or how I can check if a player is in the bounds of coordinates in an array. Incase I have multiple safe zones? I know it is possible, as many server right now have safe zones.

yes you are able to make safe zones , @Sy8282 your completely wrong DaOnes Admin tools have been out for about a week or more :) , you can use DaOne's Admin tools to create and set up safe zones , once ive found the download link for the files ill edit this post @kmiles1990

 

 

Here is the link to DaOnes admin tools 

https://github.com/Da0ne/DZMods also there is this , think it might be a update for the tools https://github.com/Da0ne/DZMods/tree/AdminTools(Solo)

The code below is located in the " SafeZoneFunctions.c " what is located in the folder "ScriptedMods" , you can edit your safe zones to where you would like them to be 

vector SAFEZONE_LOACTION = "7500 0 7500"; //Map coords (position of the safe zone)
float  SAFEZONE_RADIUS   = 500; //In meter
string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

 

 

Edited by Mr9099
  • Like 1

Share this post


Link to post
Share on other sites

Hello
When I made the change of my server with this safezone it has a bug it cuts as soon as I connect on it. Is this normal?
Thank you

Share this post


Link to post
Share on other sites

So after a while, i figured out how this scriptmods works.

At your: init.c

class CustomMission: MissionServer
{

};

add

bool m_StaminaStatus;	
bool m_SafeZone;

vector SAFEZONE_LOACTION = "3700 0 6060"; //Map coords (position of the safe zone)   Current Coords: [Green Mountain - Radio Tower (Military Base)]
float  SAFEZONE_RADIUS   = 500; //In meter

string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

override void TickScheduler(float timeslice)
	{
		GetGame().GetWorld().GetPlayerList(m_Players);
		if( m_Players.Count() == 0 ) return;
		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
		{
			if(m_currentPlayer >= m_Players.Count() )
			{
				m_currentPlayer = 0;
			}

			PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
			if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
			if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
			currentPlayer.OnTick();
			m_currentPlayer++;
		}
	}

and at your:

override void OnInit()
{

}

add

m_SafeZone	       = true;
m_StaminaStatus    = false; //Enable it = Unlimited Stamina

 

Notice: You get only a message about Entering Exiting the SafeZone when you run into it, if you spawn or teleport in, there will no message.

Hope it helps

Edited by madmax1337

Share this post


Link to post
Share on other sites

is there anyway to add markers around the zone please also this dose not work can still take full damage in the zone

Edited by mrwolv

Share this post


Link to post
Share on other sites

yea correct, somehow this doesnt work but why i dont know sadly.... godmode in admin tool doesnt work too maybe not possible atm

Edited by madmax1337

Share this post


Link to post
Share on other sites

Hello, I do not want an error message to start I put my init.c and the error message

void main()
{
	Hive ce = CreateHive();
	if (ce)
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits(0.0, 0.1);
	weather.GetRain().SetLimits(0.0, 0.1);
	weather.GetFog().SetLimits(0.0, 0.1);

	weather.GetOvercast().SetForecastChangeLimits(0.0, 0.2);
	weather.GetRain().SetForecastChangeLimits(0.0, 0.1);
	weather.GetFog().SetForecastChangeLimits(0.15, 0.45);

	weather.GetOvercast().SetForecastTimeLimits(1800, 1800);
	weather.GetRain().SetForecastTimeLimits(600, 600);
	weather.GetFog().SetForecastTimeLimits(1800, 1800);

	weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{
	bool m_StaminaStatus;	
bool m_SafeZone;

vector SAFEZONE_LOACTION = "12432.80 0 9538.90"; //Map coords (position of the safe zone)   Current Coords: [Green Mountain - Radio Tower (Military Base)]
float  SAFEZONE_RADIUS   = 200; //In meter

string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

override void TickScheduler(float timeslice)
	{
		GetGame().GetWorld().GetPlayerList(m_Players);
		if( m_Players.Count() == 0 ) return;
		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
		{
			if(m_currentPlayer >= m_Players.Count() )
			{
				m_currentPlayer = 0;
			}

			PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
			if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
			if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
			currentPlayer.OnTick();
			m_currentPlayer++;
		}
	}
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);

		return m_player;
	}

	void addMags(PlayerBase player, string mag_type, int count)
	{
		if (count < 1)
			return;

		EntityAI mag;

		for (int i = 0; i < count; i++) {
			mag = player.GetInventory().CreateInInventory(mag_type);
		}

		player.SetQuickBarEntityShortcut(mag, 1, true);
	}

	EntityAI assaultClass(PlayerBase player)
	{
		EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
		gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
		gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
		gun.GetInventory().CreateAttachment("M4_Suppressor");
		gun.GetInventory().CreateAttachment("ACOGOptic");
		addMags(player, "Mag_STANAGCoupled_30Rnd", 3);

		return gun;
	}


	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();

		player.GetInventory().CreateInInventory("Jeans_Black");
		player.GetInventory().CreateInInventory("TacticalShirt_Black");
		player.GetInventory().CreateInInventory("AthleticShoes_Black");
		player.GetInventory().CreateInInventory("CowboyHat_black");
		player.GetInventory().CreateInInventory("AssaultBag_Black");

		player.GetInventory().CreateInInventory("SodaCan_Pipsi");
		player.GetInventory().CreateInInventory("Canteen");
		player.GetInventory().CreateInInventory("SpaghettiCan");
		player.GetInventory().CreateInInventory("HuntingKnife");
		player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
		player.GetInventory().CreateInInventory("MakarovIJ70");
		player.GetInventory().CreateInInventory("AmmoBox_380_35rnd");
		ItemBase rags = player.GetInventory().CreateInInventory("Rag");
		rags.SetQuantity(4);

		EntityAI primary;
		EntityAI axe = player.GetInventory().CreateInInventory("WoodAxe");

		player.LocalTakeEntityToHands(primary);
		player.SetQuickBarEntityShortcut(primary, 0, true);
		player.SetQuickBarEntityShortcut(rags, 2, true);
		player.SetQuickBarEntityShortcut(axe, 3, true);
	}
};

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

static vector zonepvp_pos1 = {5231.25, 0, 9820.31};// point1
static vector zonepvp_pos2 = {2321.25, 0, 8452.31};// point2
	
	override void OnInit() 
	{

		m_SafeZone	       = true;
        m_StaminaStatus    = true; //Enable it = Unlimited Stamina
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 60000, true);		// 10 min // DOES NOT BELONG TO PVP ZONE!!!
		
		super.OnInit();
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckPVPZone, 5000, true); //pvp //CHANGED TO 5 SECONDS TO AVOID SERVER STRESS
		
	}
	
	void CheckPVPZone()//pvp
	{
		bool in_zone1 = true;
		bool in_zone2 = true;
		ref array<Man> players = new array<Man>; 
		GetGame().GetPlayers( players );
		if ( players.Count() > 0 )
		{
			for ( int i = 0; i < players.Count(); i++ ) 
			{
				PlayerBase player; 
				Class.CastTo(player, players.Get(i));
				float dist1 = vector.Distance(player.GetPosition(),zonepvp_pos1);
				float dist2 = vector.Distance(player.GetPosition(),zonepvp_pos2);
				if (dist1 > 346) in_zone1 = false; //DISTANCE ZONE 1
				if (dist2 > 346) in_zone2 = false;// DISTANCE ZONE 2
				if(!in_zone1 && !in_zone2) //distance from the center to the player, from where the player will receive warnings and damage
				{
					float newHeal = player.GetHealth("", "") - 5; //5 - this is damage to the player //CHANGED TO 5 BECAUSE OF TIME-CHANGE ABOVE
					player.SetHealth("", "", newHeal);
					string messPlayers = "Hey, you (" + player.GetIdentity().GetName() + ") go back, and then is healthy!";
					Param1<string> m_MessageParam = new Param1<string>(messPlayers); 
					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
				}
			}
		}
	}

 

Share this post


Link to post
Share on other sites

can't compile mission init script

Mpmissions\dayzOffline.chernarusplus\init.c(171): fonction Oninit is marked as override, but there is fonction with this name in the base class

this is the error massage that can I do? Thank you

Share this post


Link to post
Share on other sites
2 hours ago, madmax1337 said:

yea correct, somehow this doesnt work but why i dont know sadly.... godmode in admin tool doesnt work too maybe not possible atm

that is odd as i use godmode in another script i run on my dayz and that works but this dosent maybe its called diffrent

Share this post


Link to post
Share on other sites

@John Mccalum try but not tested, you put it wrong together

void main()
{
	Hive ce = CreateHive();
	if (ce)
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits(0.0, 0.1);
	weather.GetRain().SetLimits(0.0, 0.1);
	weather.GetFog().SetLimits(0.0, 0.1);

	weather.GetOvercast().SetForecastChangeLimits(0.0, 0.2);
	weather.GetRain().SetForecastChangeLimits(0.0, 0.1);
	weather.GetFog().SetForecastChangeLimits(0.15, 0.45);

	weather.GetOvercast().SetForecastTimeLimits(1800, 1800);
	weather.GetRain().SetForecastTimeLimits(600, 600);
	weather.GetFog().SetForecastTimeLimits(1800, 1800);

	weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{
	bool m_StaminaStatus;	
bool m_SafeZone;

vector SAFEZONE_LOACTION = "12432.80 0 9538.90"; //Map coords (position of the safe zone)   Current Coords: [Green Mountain - Radio Tower (Military Base)]
float  SAFEZONE_RADIUS   = 200; //In meter

string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

override void TickScheduler(float timeslice)
	{
		GetGame().GetWorld().GetPlayerList(m_Players);
		if( m_Players.Count() == 0 ) return;
		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
		{
			if(m_currentPlayer >= m_Players.Count() )
			{
				m_currentPlayer = 0;
			}

			PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
			if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
			if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
			currentPlayer.OnTick();
			m_currentPlayer++;
		}
	}
	
	static vector zonepvp_pos1 = {5231.25, 0, 9820.31};// point1
	static vector zonepvp_pos2 = {2321.25, 0, 8452.31};// point2
	
	
	void CheckPVPZone()//pvp
	{
		bool in_zone1 = true;
		bool in_zone2 = true;
		ref array<Man> players = new array<Man>; 
		GetGame().GetPlayers( players );
		if ( players.Count() > 0 )
		{
			for ( int i = 0; i < players.Count(); i++ ) 
			{
				PlayerBase player; 
				Class.CastTo(player, players.Get(i));
				float dist1 = vector.Distance(player.GetPosition(),zonepvp_pos1);
				float dist2 = vector.Distance(player.GetPosition(),zonepvp_pos2);
				if (dist1 > 346) in_zone1 = false; //DISTANCE ZONE 1
				if (dist2 > 346) in_zone2 = false;// DISTANCE ZONE 2
				if(!in_zone1 && !in_zone2) //distance from the center to the player, from where the player will receive warnings and damage
				{
					float newHeal = player.GetHealth("", "") - 5; //5 - this is damage to the player //CHANGED TO 5 BECAUSE OF TIME-CHANGE ABOVE
					player.SetHealth("", "", newHeal);
					string messPlayers = "Hey, you (" + player.GetIdentity().GetName() + ") go back, and then is healthy!";
					Param1<string> m_MessageParam = new Param1<string>(messPlayers); 
					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
				}
			}
		}
	}
	
	override void OnInit() 
	{

		m_SafeZone	       = true;
        m_StaminaStatus    = true; //Enable it = Unlimited Stamina
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 60000, true);		// 10 min // DOES NOT BELONG TO PVP ZONE!!!
		
		super.OnInit();
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckPVPZone, 5000, true); //pvp //CHANGED TO 5 SECONDS TO AVOID SERVER STRESS
		
	}
	
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);

		return m_player;
	}

	void addMags(PlayerBase player, string mag_type, int count)
	{
		if (count < 1)
			return;

		EntityAI mag;

		for (int i = 0; i < count; i++) {
			mag = player.GetInventory().CreateInInventory(mag_type);
		}

		player.SetQuickBarEntityShortcut(mag, 1, true);
	}

	EntityAI assaultClass(PlayerBase player)
	{
		EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
		gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
		gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
		gun.GetInventory().CreateAttachment("M4_Suppressor");
		gun.GetInventory().CreateAttachment("ACOGOptic");
		addMags(player, "Mag_STANAGCoupled_30Rnd", 3);

		return gun;
	}


	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();

		player.GetInventory().CreateInInventory("Jeans_Black");
		player.GetInventory().CreateInInventory("TacticalShirt_Black");
		player.GetInventory().CreateInInventory("AthleticShoes_Black");
		player.GetInventory().CreateInInventory("CowboyHat_black");
		player.GetInventory().CreateInInventory("AssaultBag_Black");

		player.GetInventory().CreateInInventory("SodaCan_Pipsi");
		player.GetInventory().CreateInInventory("Canteen");
		player.GetInventory().CreateInInventory("SpaghettiCan");
		player.GetInventory().CreateInInventory("HuntingKnife");
		player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
		player.GetInventory().CreateInInventory("MakarovIJ70");
		player.GetInventory().CreateInInventory("AmmoBox_380_35rnd");
		ItemBase rags = player.GetInventory().CreateInInventory("Rag");
		rags.SetQuantity(4);

		EntityAI primary;
		EntityAI axe = player.GetInventory().CreateInInventory("WoodAxe");

		player.LocalTakeEntityToHands(primary);
		player.SetQuickBarEntityShortcut(primary, 0, true);
		player.SetQuickBarEntityShortcut(rags, 2, true);
		player.SetQuickBarEntityShortcut(axe, 3, true);
	}
};

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

 

57 minutes ago, mrwolv said:

that is odd as i use godmode in another script i run on my dayz and that works but this dosent maybe its called diffrent

hmm i dunno, so far i readed, not possible atm

Edited by madmax1337

Share this post


Link to post
Share on other sites

So still not working? I've been away for 2 weeks so haven't been able to test 

Share this post


Link to post
Share on other sites

you got a variable that is called but doesnt exist... i added it... this should work now i tested it... (But keep in mind, this is atm only a text that work for the SafeZone, you will take damage until there is a solution about it...)

void main()
{
	Hive ce = CreateHive();
	if (ce)
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits(0.0, 0.1);
	weather.GetRain().SetLimits(0.0, 0.1);
	weather.GetFog().SetLimits(0.0, 0.1);

	weather.GetOvercast().SetForecastChangeLimits(0.0, 0.2);
	weather.GetRain().SetForecastChangeLimits(0.0, 0.1);
	weather.GetFog().SetForecastChangeLimits(0.15, 0.45);

	weather.GetOvercast().SetForecastTimeLimits(1800, 1800);
	weather.GetRain().SetForecastTimeLimits(600, 600);
	weather.GetFog().SetForecastTimeLimits(1800, 1800);

	weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{
	void NumPLayersOnServer()
    
    {
        ref array<Man> players = new array<Man>;
        GetGame().GetPlayers( players );
        int numPlayers = players.Count();
        
        for ( int i = 0; i < players.Count(); ++i )
        {
            Man player = players.Get(i);
            if( player )
            {
                string messPlayers = "Players on the server: " + numPlayers.ToString();
                Param1<string> m_MessageParam = new Param1<string>(messPlayers); 
                GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
            }
        }
    }
	
bool m_StaminaStatus;	
bool m_SafeZone;

vector SAFEZONE_LOACTION = "12432.80 0 9538.90"; //Map coords (position of the safe zone)
float  SAFEZONE_RADIUS   = 200; //In meter

string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

override void TickScheduler(float timeslice)
	{
		GetGame().GetWorld().GetPlayerList(m_Players);
		if( m_Players.Count() == 0 ) return;
		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
		{
			if(m_currentPlayer >= m_Players.Count() )
			{
				m_currentPlayer = 0;
			}

			PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
			if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
			if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
			currentPlayer.OnTick();
			m_currentPlayer++;
		}
	}
	
	static vector zonepvp_pos1 = {5231.25, 0, 9820.31};// point1
	static vector zonepvp_pos2 = {2321.25, 0, 8452.31};// point2
	
	
	void CheckPVPZone()//pvp
	{
		bool in_zone1 = true;
		bool in_zone2 = true;
		ref array<Man> players = new array<Man>; 
		GetGame().GetPlayers( players );
		if ( players.Count() > 0 )
		{
			for ( int i = 0; i < players.Count(); i++ ) 
			{
				PlayerBase player; 
				Class.CastTo(player, players.Get(i));
				float dist1 = vector.Distance(player.GetPosition(),zonepvp_pos1);
				float dist2 = vector.Distance(player.GetPosition(),zonepvp_pos2);
				if (dist1 > 346) in_zone1 = false; //DISTANCE ZONE 1
				if (dist2 > 346) in_zone2 = false;// DISTANCE ZONE 2
				if(!in_zone1 && !in_zone2) //distance from the center to the player, from where the player will receive warnings and damage
				{
					float newHeal = player.GetHealth("", "") - 5; //5 - this is damage to the player //CHANGED TO 5 BECAUSE OF TIME-CHANGE ABOVE
					player.SetHealth("", "", newHeal);
					string messPlayers = "Hey, you (" + player.GetIdentity().GetName() + ") go back, and then is healthy!";
					Param1<string> m_MessageParam = new Param1<string>(messPlayers); 
					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
				}
			}
		}
	}
	
	override void OnInit() 
	{

		m_SafeZone	       = true;
        m_StaminaStatus    = true; //Enable it = Unlimited Stamina
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 120000, true);		// 2 mins
		
		super.OnInit();
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckPVPZone, 5000, true); //pvp //CHANGED TO 5 SECONDS TO AVOID SERVER STRESS
		
	}
	
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);

		return m_player;
	}

	void addMags(PlayerBase player, string mag_type, int count)
	{
		if (count < 1)
			return;

		EntityAI mag;

		for (int i = 0; i < count; i++) {
			mag = player.GetInventory().CreateInInventory(mag_type);
		}

		player.SetQuickBarEntityShortcut(mag, 1, true);
	}

	EntityAI assaultClass(PlayerBase player)
	{
		EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
		gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
		gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
		gun.GetInventory().CreateAttachment("M4_Suppressor");
		gun.GetInventory().CreateAttachment("ACOGOptic");
		addMags(player, "Mag_STANAGCoupled_30Rnd", 3);

		return gun;
	}


	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();

		player.GetInventory().CreateInInventory("Jeans_Black");
		player.GetInventory().CreateInInventory("TacticalShirt_Black");
		player.GetInventory().CreateInInventory("AthleticShoes_Black");
		player.GetInventory().CreateInInventory("CowboyHat_black");
		player.GetInventory().CreateInInventory("AssaultBag_Black");

		player.GetInventory().CreateInInventory("SodaCan_Pipsi");
		player.GetInventory().CreateInInventory("Canteen");
		player.GetInventory().CreateInInventory("SpaghettiCan");
		player.GetInventory().CreateInInventory("HuntingKnife");
		player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
		player.GetInventory().CreateInInventory("MakarovIJ70");
		player.GetInventory().CreateInInventory("AmmoBox_380_35rnd");
		ItemBase rags = player.GetInventory().CreateInInventory("Rag");
		rags.SetQuantity(4);

		EntityAI primary;
		EntityAI axe = player.GetInventory().CreateInInventory("WoodAxe");

		player.LocalTakeEntityToHands(primary);
		player.SetQuickBarEntityShortcut(primary, 0, true);
		player.SetQuickBarEntityShortcut(rags, 2, true);
		player.SetQuickBarEntityShortcut(axe, 3, true);
	}
};

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

 

Edited by madmax1337

Share this post


Link to post
Share on other sites
On 29/10/2018 at 9:43 AM, John Mccalum said:

can't compile mission init script

Mpmissions\dayzOffline.chernarusplus\init.c(171): fonction Oninit is marked as override, but there is fonction with this name in the base class

this is the error massage that can I do? Thank you

the script does work 

Share this post


Link to post
Share on other sites

me i add it in my init.c and he make me message erreur.

Mpmissions \ dayzOffline.chernarusplus \ init.c (90 )broken expresion (missing ';'?)

can you help me thx.

Share this post


Link to post
Share on other sites
On 29/10/2018 at 1:40 PM, madmax1337 said:

@John Mccalum try but not tested, you put it wrong together


void main()
{
	Hive ce = CreateHive();
	if (ce)
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits(0.0, 0.1);
	weather.GetRain().SetLimits(0.0, 0.1);
	weather.GetFog().SetLimits(0.0, 0.1);

	weather.GetOvercast().SetForecastChangeLimits(0.0, 0.2);
	weather.GetRain().SetForecastChangeLimits(0.0, 0.1);
	weather.GetFog().SetForecastChangeLimits(0.15, 0.45);

	weather.GetOvercast().SetForecastTimeLimits(1800, 1800);
	weather.GetRain().SetForecastTimeLimits(600, 600);
	weather.GetFog().SetForecastTimeLimits(1800, 1800);

	weather.GetOvercast().Set(Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set(Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set(Math.RandomFloatInclusive(0.0, 0.1), 0, 0);

	weather.SetWindMaximumSpeed(15);
	weather.SetWindFunctionParams(0.1, 0.3, 50);
}

class CustomMission: MissionServer
{
	bool m_StaminaStatus;	
bool m_SafeZone;

vector SAFEZONE_LOACTION = "12432.80 0 9538.90"; //Map coords (position of the safe zone)   Current Coords: [Green Mountain - Radio Tower (Military Base)]
float  SAFEZONE_RADIUS   = 200; //In meter

string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";

//Runs every tick (Stat time tick!) IMPORANT: Does reduce about 120 FPS when server is High-Full Pop!
void SafeZoneHandle(PlayerBase player)
{
	float distance;
	string ZoneCheck, GUID;
	GUID = player.GetIdentity().GetPlainId(); //Steam 64
	Param1<string> Msgparam;

	distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
	if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "true") //Already in zone
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
			Msgparam = new Param1<string>( ENTRY_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
	else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
	{
		g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
		if (ZoneCheck == "false")
		{
			return;
		}
		else
		{
			g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
			Msgparam = new Param1<string>( EXIT_MESSAGE );
			GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
		}
	}
}

override void TickScheduler(float timeslice)
	{
		GetGame().GetWorld().GetPlayerList(m_Players);
		if( m_Players.Count() == 0 ) return;
		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
		{
			if(m_currentPlayer >= m_Players.Count() )
			{
				m_currentPlayer = 0;
			}

			PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
			if (m_StaminaStatus) { currentPlayer.GetStatStamina().Set(1000); }
			if (m_SafeZone) { SafeZoneHandle(currentPlayer); } //Check if player is near safezone
			currentPlayer.OnTick();
			m_currentPlayer++;
		}
	}
	
	static vector zonepvp_pos1 = {5231.25, 0, 9820.31};// point1
	static vector zonepvp_pos2 = {2321.25, 0, 8452.31};// point2
	
	
	void CheckPVPZone()//pvp
	{
		bool in_zone1 = true;
		bool in_zone2 = true;
		ref array<Man> players = new array<Man>; 
		GetGame().GetPlayers( players );
		if ( players.Count() > 0 )
		{
			for ( int i = 0; i < players.Count(); i++ ) 
			{
				PlayerBase player; 
				Class.CastTo(player, players.Get(i));
				float dist1 = vector.Distance(player.GetPosition(),zonepvp_pos1);
				float dist2 = vector.Distance(player.GetPosition(),zonepvp_pos2);
				if (dist1 > 346) in_zone1 = false; //DISTANCE ZONE 1
				if (dist2 > 346) in_zone2 = false;// DISTANCE ZONE 2
				if(!in_zone1 && !in_zone2) //distance from the center to the player, from where the player will receive warnings and damage
				{
					float newHeal = player.GetHealth("", "") - 5; //5 - this is damage to the player //CHANGED TO 5 BECAUSE OF TIME-CHANGE ABOVE
					player.SetHealth("", "", newHeal);
					string messPlayers = "Hey, you (" + player.GetIdentity().GetName() + ") go back, and then is healthy!";
					Param1<string> m_MessageParam = new Param1<string>(messPlayers); 
					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
				}
			}
		}
	}
	
	override void OnInit() 
	{

		m_SafeZone	       = true;
        m_StaminaStatus    = true; //Enable it = Unlimited Stamina
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 60000, true);		// 10 min // DOES NOT BELONG TO PVP ZONE!!!
		
		super.OnInit();
		
		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckPVPZone, 5000, true); //pvp //CHANGED TO 5 SECONDS TO AVOID SERVER STRESS
		
	}
	
	override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
	{
		Entity playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");
		Class.CastTo(m_player, playerEnt);
		GetGame().SelectPlayer(identity, m_player);

		return m_player;
	}

	void addMags(PlayerBase player, string mag_type, int count)
	{
		if (count < 1)
			return;

		EntityAI mag;

		for (int i = 0; i < count; i++) {
			mag = player.GetInventory().CreateInInventory(mag_type);
		}

		player.SetQuickBarEntityShortcut(mag, 1, true);
	}

	EntityAI assaultClass(PlayerBase player)
	{
		EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
		gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
		gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
		gun.GetInventory().CreateAttachment("M4_Suppressor");
		gun.GetInventory().CreateAttachment("ACOGOptic");
		addMags(player, "Mag_STANAGCoupled_30Rnd", 3);

		return gun;
	}


	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
		player.RemoveAllItems();

		player.GetInventory().CreateInInventory("Jeans_Black");
		player.GetInventory().CreateInInventory("TacticalShirt_Black");
		player.GetInventory().CreateInInventory("AthleticShoes_Black");
		player.GetInventory().CreateInInventory("CowboyHat_black");
		player.GetInventory().CreateInInventory("AssaultBag_Black");

		player.GetInventory().CreateInInventory("SodaCan_Pipsi");
		player.GetInventory().CreateInInventory("Canteen");
		player.GetInventory().CreateInInventory("SpaghettiCan");
		player.GetInventory().CreateInInventory("HuntingKnife");
		player.GetInventory().CreateInInventory("Mag_IJ70_8Rnd");
		player.GetInventory().CreateInInventory("MakarovIJ70");
		player.GetInventory().CreateInInventory("AmmoBox_380_35rnd");
		ItemBase rags = player.GetInventory().CreateInInventory("Rag");
		rags.SetQuantity(4);

		EntityAI primary;
		EntityAI axe = player.GetInventory().CreateInInventory("WoodAxe");

		player.LocalTakeEntityToHands(primary);
		player.SetQuickBarEntityShortcut(primary, 0, true);
		player.SetQuickBarEntityShortcut(rags, 2, true);
		player.SetQuickBarEntityShortcut(axe, 3, true);
	}
};

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

 

hmm i dunno, so far i readed, not possible atm

when i put this line of code for the safezone i take a lot of damage when i appear it's normal?

Share this post


Link to post
Share on other sites

https://github.com/Da0ne/DZMods/issues/9

read this thread

 “At the moment there is no possible way of full god mode. Due to the fact we can not interrupt the functions that handle damage. Since they are 'hard codded' within the engine. The only option we have is the 'EEHit' function , its not the best but its all we got. For now. And for the losing blood/shock you can add a line in EEHit that will stop bleeding process upon hit same goes for shock. As for fall damage and or direct Head shot damage, we can not stop it.”

Edited by Fester808

Share this post


Link to post
Share on other sites
On 30/10/2018 at 5:34 PM, Mostabdel said:

me i add it in my init.c and he make me message erreur.

Mpmissions \ dayzOffline.chernarusplus \ init.c (90 )broken expresion (missing ';'?)

can you help me thx.

your doing it all wrong

Share this post


Link to post
Share on other sites

There has been evolution for safezone? because I do not evolve I still have no messages when I arrive on the spot

Share this post


Link to post
Share on other sites
On 5-11-2018 at 6:39 PM, Rife 47 said:

#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\InfoMessages.c"
void main()
{

 Hive ce = CreateHive();
 if ( ce )
  ce.InitOffline();

 Weather weather = g_Game.GetWeather();

 weather.GetOvercast().SetLimits( 0.0 , 1.0 );
 weather.GetRain().SetLimits( 0.0 , 0.0 );
 weather.GetFog().SetLimits( 0.0 , 0.25 );

 weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.2 );
 weather.GetRain().SetForecastChangeLimits( 0.0, 0.0 );
 weather.GetFog().SetForecastChangeLimits( 0.15, 0.45 );

 weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
 weather.GetRain().SetForecastTimeLimits( 0 , 0 );
 weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

 weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
 weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.0), 0, 0);
 weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
 
 weather.SetWindMaximumSpeed(15);
 weather.SetWindFunctionParams(0.1, 0.3, 50);

 //------InfectedZone--------//
  GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(InfectedZone_Tisy, 20000, true); //Таймер на вызов void InfectedZone интрвал 20000 МС = 20с
 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(InfectedZone_Kaminsk, 20000, true); //Таймер на вызов void InfectedZone интрвал 20000 МС = 20с
 //------InfectedZone--------//
 
 //------safezone--------//
 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(SafeZoneHandle, 20000, true);
 //------safezone--------//
}

//------InfectedZone--------//
void InfectedZone_Tisy()

    ref array<Man> players = new array<Man>;
    GetGame().GetPlayers( players );
           
    float Zone_X = 1689.08;   // Кордената X
    float Zone_Y = 14014.99; // Кордената Y
    float Zone_Radius = 1150; //  Радиус зоны
 string ENTRY_MESSAGE     = "warning you are entering contamination zone!";
    string EXIT_MESSAGE      = "You Have Left The contamination zone!";
 
    for ( int i = 0; i < players.Count(); i++ )
    {
           
        PlayerBase player;
        Class.CastTo(player, players.Get(i));
        vector pos = player.GetPosition();
  
  float distance_squared = Math.Pow(Zone_X-pos[0], 2) + Math.Pow(Zone_Y-pos[2], 2);
  
        if ( distance_squared < Math.Pow(Zone_Radius, 2) )
  {

  DamageInfectedZone(player);
   
        }
    }
}

void InfectedZone_Kaminsk()

    ref array<Man> players = new array<Man>;
    GetGame().GetPlayers( players );
           
    float Zone_X = 7890.71;   // Кордената X
    float Zone_Y = 14697.49; // Кордената Y
    float Zone_Radius = 300; //  Радиус зоны
 
    for ( int i = 0; i < players.Count(); i++ )
    {
           
        PlayerBase player;
        Class.CastTo(player, players.Get(i));
        vector pos = player.GetPosition();
  
  float distance_squared = Math.Pow(Zone_X-pos[0], 2) + Math.Pow(Zone_Y-pos[2], 2);
  
        if ( distance_squared < Math.Pow(Zone_Radius, 2) )
  {

  DamageInfectedZone(player);
   
        }
    }
}
 void DamageInfectedZone(PlayerBase player)
 {
      EntityAI itemMask = player.FindAttachmentBySlotName("mask");
   EntityAI itemHeadgear = player.FindAttachmentBySlotName("headgear");
   EntityAI itemBody = player.FindAttachmentBySlotName("body");
   EntityAI itemGloves = player.FindAttachmentBySlotName("gloves");
   EntityAI itemLegs = player.FindAttachmentBySlotName("legs");
   EntityAI itemFeet = player.FindAttachmentBySlotName("feet");
   
   float damageMask =     100 - itemMask.GetHealth("", "");
   float damageHead = 100 - itemHeadgear.GetHealth("", "");
   float damageBody =     100 - itemBody.GetHealth("", "");
   float damageGloves = 100 - itemGloves.GetHealth("", "");
   float damageLegs =     100 - itemLegs.GetHealth("", "");
   float damageFeet =     100 - itemFeet.GetHealth("", "");
   
   if ( !itemMask.IsKindOf("GP5GasMask") || itemMask == NULL || damageMask == 100  )
   {
    player.AddHealth("","Health", -25); //Дамаг если нет ГП-5 25 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "it's hard to breathe!");
   }
   else if ( itemMask.IsKindOf("GP5GasMask") )
   {
    itemMask.AddHealth( "", "", -0.1 );
   }
   
   //-------------------------------------//
   if ( !itemHeadgear.IsKindOf("NBCHoodGray") || itemHeadgear == NULL || damageHead == 100   )
   {
    player.AddHealth("","Health", -3); //Дамаг если нет капюшона 3 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "I'm getting sick!");
   }
   else if ( itemHeadgear.IsKindOf("NBCHoodGray") )
   {
    itemHeadgear.AddHealth( "", "", -0.1 );
   }
   //-------------------------------------//
   if ( !itemBody.IsKindOf("NBCJacketGray") || itemBody == NULL || damageBody == 100 )
   {
    player.AddHealth("","Health", -7); //Дамаг если нет куртки 7 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "My Skin burns!");
   }
   else if ( itemBody.IsKindOf("NBCJacketGray") )
   {
    itemBody.AddHealth( "", "", -0.1 ); 
   }
   //-------------------------------------//
   if ( !itemGloves.IsKindOf("NBCGlovesGray") || itemGloves == NULL || damageGloves == 100 )
   {
    player.AddHealth("","Health", -3); //Дамаг если нет перчаток 3 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "My hands are pinching!");
   }
   else if ( itemGloves.IsKindOf("NBCGlovesGray") )
   {
    itemGloves.AddHealth( "", "", -0.1 );
   }
   //-------------------------------------//
   if ( !itemLegs.IsKindOf("NBCPantsGray") || itemLegs == NULL || damageLegs == 100 )
   {
    player.AddHealth("","Health", -7); //Дамаг если нет штанов 7 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "My Skin burns!");
   }
   else if ( itemLegs.IsKindOf("NBCPantsGray") )
   {
    itemLegs.AddHealth( "", "", -0.1 );
   }
   //-------------------------------------//
   if ( !itemFeet.IsKindOf("NBCBootsGray") || itemFeet == NULL || damageFeet == 100  )
   {
    player.AddHealth("","Health", -3); //Дамаг если нет бахил 3 HP в 20 с (Всего 100 hp)
    SendMessageClient(player, "My legs burns!");    
   }
   else if ( itemFeet.IsKindOf("NBCBootsGray") )
   {
    itemFeet.AddHealth( "", "", -0.1 );
   }
 }
 
//------safezone--------//
void SafeZoneHandle(PlayerBase player)
{
 vector SAFEZONE_LOACTION = "7500 0 7500"; //Map coords (position of the safe zone)
    float  SAFEZONE_RADIUS   = 500; //In meter
    string ENTRY_MESSAGE     = "Welcome to The SafeZone! Godmode ENABLED!";
    string EXIT_MESSAGE      = "You Have Left The SafeZone! Godmode DISABLED!";
 float distance;
 string ZoneCheck, GUID;
 GUID = player.GetIdentity().GetPlainId(); //Steam 64
 Param1<string> Msgparam;

 distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
 if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
 {
  g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
  if (ZoneCheck == "true") //Already in zone
  {
   return;
  }
  else
  {
   g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
   Msgparam = new Param1<string>( ENTRY_MESSAGE );
   GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
  }
 }
 else if (distance > SAFEZONE_RADIUS) //Plauer Outside of Zone
 {
  g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
  if (ZoneCheck == "false")
  {
   return;
  }
  else
  {
   g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
   Msgparam = new Param1<string>( EXIT_MESSAGE );
   GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
  }
 }
}
 
void SendMessageClient(PlayerBase player, string message)
{
 Param1<string> m_MesParam = new Param1<string>(message);
 GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MesParam, true, player.GetIdentity());
}
//------InfectedZone--------//

class CustomMission: MissionServer

 void SetRandomHealth(EntityAI itemEnt)
 {
  int rndHlt = Math.RandomInt(40,100);
  itemEnt.SetHealth("","",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);
  GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.CustomInformation, TIME_Information_Repeat, true);
     GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.PlayerCounter, 110000, true);  //Default 120000 2 mins Looped
  
  return m_player;
 }
 
 void GlobalMessage(int Channel, string Message)
 {
  if (Message != "")
  {
   GetGame().ChatPlayer(Channel,Message);
  }
 }

 void PlayerCounter()
 {
  array<Man> players = new array<Man>;
     GetGame().GetPlayers( players );
     int numbOfplayers = players.Count();
     GlobalMessage(1,"Online Players: "+ numbOfplayers.ToString());
 }
 void addMags(PlayerBase player, string mag_type, int count)
 {
  if (count < 1)
   return;

  EntityAI mag;

  for (int i = 0; i < count; i++) {
   mag = player.GetInventory().CreateInInventory(mag_type);
   player.SetQuickBarEntityShortcut(mag, i + 1, true);
  }

  //player.SetQuickBarEntityShortcut(mag, 1, true);
 }

 EntityAI assault1Class(PlayerBase player)
 {
  EntityAI gun = player.GetHumanInventory().CreateInHands("M4A1");
  gun.GetInventory().CreateAttachment("M4_RISHndgrd_Black");
  gun.GetInventory().CreateAttachment("M4_MPBttstck_Black");
  gun.GetInventory().CreateAttachment("ACOGOptic");
  //gun.GetInventory().CreateAttachment("Mag_STANAG_30Rnd");
  addMags(player, "Mag_STANAG_30Rnd", 3);

  return gun;
 }
 EntityAI assault2Class(PlayerBase player)
 {
  EntityAI gun = player.GetHumanInventory().CreateInHands("AKM");
  gun.GetInventory().CreateAttachment("AK_WoodBttstck");
  gun.GetInventory().CreateAttachment("AK_WoodHndgrd");
  gun.GetInventory().CreateAttachment("PSO1Optic");
  //gun.GetInventory().CreateAttachment("Mag_AKM_30Rnd");
  addMags(player, "Mag_AKM_30Rnd", 3);

  return gun;
 }

 EntityAI sniperClass(PlayerBase player)
 {
  EntityAI gun = player.GetHumanInventory().CreateInHands("SVD");
  gun.GetInventory().CreateAttachment("PSO1Optic");
  //gun.GetInventory().CreateAttachment("Mag_SVD_10Rnd");
  addMags(player, "Mag_SVD_10Rnd", 3);

  return gun;
 }

 EntityAI smgClass(PlayerBase player)
 {
  EntityAI gun = player.GetHumanInventory().CreateInHands("UMP45");
  gun.GetInventory().CreateAttachment("PistolSuppressor");
  gun.GetInventory().CreateAttachment("M68Optic");
  //gun.GetInventory().CreateAttachment("Mag_UMP_25Rnd");
  addMags(player, "Mag_UMP_25Rnd", 3);

  return gun;
 }

 override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
 {
  //
  TStringArray pants = {"Jeans_Black","Jeans_BlueDark","Jeans_Blue","Jeans_Brown","Jeans_Green","Jeans_Grey"};
         TStringArray shoes = {"AthleticShoes_Black","AthleticShoes_Blue","AthleticShoes_Brown","AthleticShoes_Green","AthleticShoes_Grey","HikingBootsLow_Beige","HikingBootsLow_Black","HikingBootsLow_Blue","HikingBootsLow_Grey","HikingBoots_Black","HikingBoots_Brown","HikingJacket_Black"};
  TStringArray backpack = {"TortillaBag","HuntingBag","SmershBag","AssaultBag_Ttsko","AssaultBag_Black","AssaultBag_Green","CoyoteBag_Brown","CoyoteBag_Green","AliceBag_Green","AliceBag_Black","AliceBag_Camo"};
         TStringArray vest = {"PlateCarrierComplete","HighCapacityVest_Olive","HighCapacityVest_Black"};
  
         TStringArray drink = {"SodaCan_Cola","SodaCan_Kvass","SodaCan_Pipsi","SodaCan_Spite"};
         TStringArray food = {"Worm","SmallGuts","PowderedMilk","PeachesCan","Pear"};
  TStringArray tool = {"OrienteeringCompass","Knife","PurificationTablets","Matchbox"};
  //
  
  player.RemoveAllItems();
  
  player.GetInventory().CreateInInventory(pants.GetRandomElement());
  player.GetInventory().CreateInInventory(shoes.GetRandomElement());
  player.GetInventory().CreateInInventory(backpack.GetRandomElement());
  player.GetInventory().CreateInInventory(vest.GetRandomElement());
  
  player.GetInventory().CreateInInventory(drink.GetRandomElement());
  player.GetInventory().CreateInInventory(food.GetRandomElement());
  player.GetInventory().CreateInInventory(tool.GetRandomElement());
  player.GetInventory().CreateInInventory("FNX45");
  player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
  player.GetInventory().CreateInInventory("Mag_FNX45_15Rnd");
  ItemBase rags = player.GetInventory().CreateInInventory("Rag");
  rags.SetQuantity(4);

  EntityAI primary;
  EntityAI axe = player.GetInventory().CreateInInventory("FirefighterAxe");

  switch (Math.RandomInt(0, 4)) {
   case 0: primary = assault1Class(player); break;
   case 1: primary = assault2Class(player); break;
   case 2: primary = sniperClass(player); break;
   case 3: primary = smgClass(player); break;
  }

  player.LocalTakeEntityToHands(primary);
  player.SetQuickBarEntityShortcut(primary, 0, true);
  player.SetQuickBarEntityShortcut(rags, 4, true);
  player.SetQuickBarEntityShortcut(axe, 5, true);
 }
};

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

Please repost in code brackets and explain a little what it does, plus where to get the InfoMessages.c file?
I can make out that it adds radioactive/contaminated area's
and gasmasks have a positive effect.

Share this post


Link to post
Share on other sites

Im install this admin tool https://github.com/Da0ne/DZMods/tree/AdminTools(Solo) but i have error on start server 

Error:

Quote

Can't compile mission init script!

$CurrentDir:mpmissions\dayzOffline.chernarusplus\ini.c(31): Opened

scope at the end of file, missing '}'?

My ini.c

void main()
{

	Hive ce = CreateHive();
	if ( ce )
		ce.InitOffline();

	Weather weather = g_Game.GetWeather();

	weather.GetOvercast().SetLimits( 0.0 , 0.1 );
	weather.GetRain().SetLimits( 0.0 , 0.1 );
	weather.GetFog().SetLimits( 0.0 , 0.1 );

	weather.GetOvercast().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetRain().SetForecastChangeLimits( 0.0, 0.1 );
	weather.GetFog().SetForecastChangeLimits( 0.0, 0.0 );

	weather.GetOvercast().SetForecastTimeLimits( 1800 , 1800 );
	weather.GetRain().SetForecastTimeLimits( 600 , 600 );
	weather.GetFog().SetForecastTimeLimits( 1800 , 1800 );

	weather.GetOvercast().Set( Math.RandomFloatInclusive(0.0, 0.3), 0, 0);
	weather.GetRain().Set( Math.RandomFloatInclusive(0.0, 0.2), 0, 0);
	weather.GetFog().Set( Math.RandomFloatInclusive(0.0, 0.1), 0, 0);
	
	weather.SetWindMaximumSpeed(30);
	weather.SetWindFunctionParams(0.1, 1.0, 50);
}

class CustomMission: MissionServer
{	
	#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\AdminTool.c"
	override void OnInit()
	{
		AdminTool();
		string m_AdminListPath = "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\";	
		FileHandle AdminUIDSFile = OpenFile(m_AdminListPath + "Admins.txt", FileMode.READ);
		if (AdminUIDSFile != 0)
		{
			string line_content = "";
			while ( FGets(AdminUIDSFile,line_content) > 0 )
			{
				m_AdminList.Insert(line_content,"null"); //UID , NAME
				Print("Adding Admin: "+ line_content + " To the Admin List!");
			}
			CloseFile(AdminUIDSFile);
		}
	}
	
	void SetRandomHealth(EntityAI itemEnt)
	{
		
		int rndHlt = Math.RandomInt(40,100);
		itemEnt.SetHealth("","",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);
		
		return m_player;
	}
	
	override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
	{
/*
		player.RemoveAllItems();

		EntityAI item = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
		EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
		EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
*/
		EntityAI itemEnt;
		ItemBase itemBs;
		
		itemEnt = player.GetInventory().CreateInInventory("Rag");
		itemBs = ItemBase.Cast(itemEnt);
		itemBs.SetQuantity(4);
		SetRandomHealth(itemEnt);

		itemEnt = player.GetInventory().CreateInInventory("Flashlight");
		itemBs = ItemBase.Cast(itemEnt);
		
		itemEnt = player.GetInventory().CreateInInventory("Battery9V");
		itemBs = ItemBase.Cast(itemEnt);
		
		itemEnt = player.GetInventory().CreateInInventory("ChernarusMap");
		itemBs = ItemBase.Cast(itemEnt);
	}
};
  
Mission CreateCustomMission(string path)
{
	return new CustomMission();
}

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×