Jump to content
Sign in to follow this  
Sulu_03

How to make an addon start only in MP ?

Recommended Posts

Hi everybody !

A teammate and i have created a mission with a radio system simulator.

It works fine with the wonderful Teamspeak 3 SDK.

We now want to make this script become an addon to avoid mission editing to make it works.

Altough I searched how to do, i didn't find a reliable way to make the script start when the client join a multiplayer game.

This script is only needed in MP game, and should start only one time per game whatever the kind of soldier player choosed to play.

No P3D, no redefinition of any object, just this script for anyone.

No server side is needed.

Sorry for my poor english and thanks for any help you provide !

Share this post


Link to post
Share on other sites

Put this to config.cpp:

class Extended_PostInit_EventHandlers
{
class someNiceNameForTheClass
{
	clientInit = "if (isMultiplayer) then {call compile preProcessFileLineNumbers 'pathToScript'}";
};
};

And make your cfgPatches "requiredAddons" look something like this:

class CfgPatches
{
class Someclassname
{
	....
	requiredAddons[] = 
	{
		"Extended_EventHandlers"
	};
	....
};
};

Your addon now requires CBA, more precisely the ExtendedEventHandlers part of it, but at least it works :)

Edited by Fincuan

Share this post


Link to post
Share on other sites

And that's all ? :eek:

I don't know how to thank you ! :)

Edited by Sulu_03

Share this post


Link to post
Share on other sites

Yeah that should be all. The script is now started EXACTLY once per mission, in MP just before you enter the briefing screen with the map.

Share this post


Link to post
Share on other sites

It works fine !

Here is my config.cpp

class CfgPatches

{

class armats

{

requiredAddons[] = {"Extended_EventHandlers"};

};

};

#include "\armatsbwf\description.h"

class Extended_PostInit_EventHandlers

{

class armatsbwf

{

clientInit = "if (isMultiplayer) then {call compile preProcessFileLineNumbers '\armatsbwf\init.sqf'}";

};

};

Thank you Fincuan !

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

×