Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

Sign in to follow this  
mrwolv

Player Count in game

Recommended Posts

i used to use a chunk of code in my mp mission init.c and it used to call out the ammount of  players perfectly on the server when they connect here is the code

 

//Player Call Start//
	override void OnInit()
	{

		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 300000, true);		// 30 seconds
	}	
	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()); 

			}
		}
		
	}
	//Player Call End//

 

but i have added the trader mod to my server now and this stops the trader mod working is there a mod or plugin that will solve this for me as i want it to call players out when they join the server thanks

Edited by mrwolv

Share this post


Link to post
Share on other sites

you add it under class CustomMission: MissionServer but if you use the trader plugin it will break the plugin for you but it dose work

 

class CustomMission: MissionServer
{	
    
	
	//Player Call Start//
	override void OnInit()
	{

		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 300000, true);		// 30 seconds
	}	
	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()); 

			}
		}
		
	}
	//Player Call End//


 

  • Thanks 1

Share this post


Link to post
Share on other sites
45 minutes ago, mrwolv said:

you add it under class CustomMission: MissionServer but if you use the trader plugin it will break the plugin for you but it dose work

 


class CustomMission: MissionServer
{	
    
	
	//Player Call Start//
	override void OnInit()
	{

		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(NumPLayersOnServer, 300000, true);		// 30 seconds
	}	
	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()); 

			}
		}
		
	}
	//Player Call End//


 

Beans for u. Now Working perfectly

 

  • Like 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×