Jump to content

Recommended Posts

Hi

You know when you try to join server and get the "Warning Message: You cannot play/edit this mission" because you don't have some mod? Well I am hoping it would be possible to let the client enter debriefing screen instead of going straight to lobby so you could show download link for the missing mod.

Could this be somehow possible?

 

thx

Share this post


Link to post
Share on other sites

I do this in the init of my missions, not sure if it's what you're looking for:
 

if(isClass(configFile>>"CfgPatches">>"TPW_MODS"))exitWith{endMission"END2";};

Defined END2 in my Description.ext:
 

class CfgDebriefing {
class End1 {
	title="$STR_A3_mission_completed_title";
	subtitle="All caches destroyed!";
	description="";
	picture="b_inf";
	pictureColor[]={0.0,0.3,0.6,1};};
class End2 {
	title="$STR_A3_mission_failed_title";
	subtitle="TPW_Mods Detected!";
	description="TPW is disallowed.  Disable it and try to reconnect!";
	picture="b_inf";
	pictureColor[]={0.0,0.3,0.6,1};};
};

Used in my Insurgency mission, hence End1 referring to caches.

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, phronk said:

Used in my Insurgency mission, hence End1 referring to caches.

 

Is this working in single player or in multiplayer as well?

 

Edit: I just noticed you are telling the client to reconnect, so I guess that must work in MP. And I think while this kind of join prevention works it's probably different scenario when mods are missing

Share this post


Link to post
Share on other sites

It works in MP also. If the client connects with TPW enabled, it'll kick him out with the appropriate message before the mod initializes (Won't allow it to spawn the ambient life and all that shit that causes server issues). Does not cause the mission to end for everyone, unless the server is running it. If TPW isn't running, nothing happens, init code proceeds.

  • Thanks 1

Share this post


Link to post
Share on other sites

@phronk Just as I suspected 🙂

But my problem is different, need to check for missing mods. Getting auto kicked for those

Share this post


Link to post
Share on other sites

Aside from running the mods on the server, also add this to init (very similar):
 

if(isClass(configFile>>"CfgPatches">>"TPW_MODS"))exitWith{endMission"END2";};
if(isClass(configFile>>"CfgPatches">>"task_force_radio"))then{isTFAR=true;}else{isTFAR=false;};
if(isClass(configFile>>"CfgPatches">>"acre_main"))then{isACRE=true;}else{isACRE=false;};
if(isClass(configFile>>"cfgPatches">>"ace_common"))then{isACE=true;}else{isACE=false;};
if(isClass(configFile>>"cfgPatches">>"Taliban_fighters"))then{isTalib=true;}else{isTalib=false;};
if(isClass(configFile>>"cfgPatches">>"CUP_Weapons_WeaponsCore"))then{isCUPW=true;}else{isCUPW=false;};
if(isClass(configFile>>"cfgPatches">>"CUP_Creatures_People_Core"))then{isCUPU=true;}else{isCUPU=false;};
if((isClass(configFile>>"cfgPatches">>"CUP_WheeledVehicles_Core"))&&{(isClass(configFile>>"cfgPatches">>"CUP_BaseConfigs"))})then{isCUPV=true;}else{isCUPV=false;};
if(isClass(configFile>>"cfgPatches">>"SFG_Tac_Beard"))then{isBeard=true;}else{isBeard=false;};
if(isClass(configFile>>"cfgPatches">>"rhs_t72"))then{isRHSRF=true;}else{isRHSRF=false;};
if(isClass(configFile>>"cfgPatches">>"rhsusf_vehicles"))then{isRHSUS=true;}else{isRHSUS=false;};

if(count(isRHSUS,isCUPW,isCUPU,isCUPV]select{!_x})>0)exitWith{endMission"END2";};//Can also add an _x mod missing message

Just a general example, might be faster to use findIf command instead of select{!_x}

 

It might be better to do this check in the initPlayerLocal.sqf that way the variables stay local, IDK if setting it all in the init.sqf messes with locality of variables that were set on the other players' machines. (I'm a scrub for not knowing, I know)

  • Like 2

Share this post


Link to post
Share on other sites

@phronkDon't you get auto kicked (back to lobby) when mod is missing?

 

Share this post


Link to post
Share on other sites

If the server is running a mod/mission which requires an addon, it will automatically kick. Some mods however, such as client-side mods allowed via bikeys in server's "Keys" folder with "verifySignatures=2" in server.cfg won't automatically kick. The code allows you to check for whatever mod you want (Assmuning you reference the correct mod info in CfgPatches) and sets a variable which represents that they have it or not. Then you can code whatever reaction you want. Personally, I kick people with TPW because it destroys servers and the other mod variables are set so that I can reference them in my insurgency code, which is how I "auto-detect" mods running on the server and dress vanilla units appropriately with modded equipment so that the units are still visible to all players, rather than spawning modded units which will be invisible to players joining without the modded content.

 

Hope that makes sense. As far as whether it kicks them to the lobby or server browser, I can't remember honestly.

Share this post


Link to post
Share on other sites

@phronk Thanks I totally understand what your code does but still looking for way to deal those missing addons... Maybe not possible

Share this post


Link to post
Share on other sites

i was just wondering about this too, couldn't you adapt the above for dealing with missing addons? like so (untested):

 

if !(isClass(configFile>>"CfgPatches">>"TPW_MODS")) then {
	systemChat "can't you read instructions fool? it clearly states in the mission dependencies that you need TPW installed,
	if i hadn't put this script in i bet you'd already be on your way to the comments page to troll with complaints of a 'broken mission'";

	sleep 5;
	endMission"END2";
};

though in MP i think system chat would broadcast to all users, i just used it for simple example, i suppose you could use group chat for players group or something

  • Haha 1

Share this post


Link to post
Share on other sites

@lordfrith systemchat actually isn't a bad solution because the texts remains when user returns to lobby. But it's still not perfect which would be clickable link to steam page for downloading the required  mod

Share this post


Link to post
Share on other sites
11 minutes ago, lordfrith said:

though in MP i think system chat would broadcast to all users

It doesn't

Share this post


Link to post
Share on other sites
1 minute ago, gc8 said:

the texts remains when user returns to lobby

ah yes so it does, in that case you don't really need the 'sleep' as i only put that in so user had time to read it before leaving mission.

 

7 minutes ago, gc8 said:

clickable link to steam page for downloading the required  mod

 

i have no idea but i'd also be interested to see if its possible.

Share this post


Link to post
Share on other sites
3 minutes ago, lordfrith said:

i have no idea but i'd also be interested to see if its possible.

 

It would be possible via debriefing is user didn't get kicked back to the lobby 😕

 

Share this post


Link to post
Share on other sites
10 minutes ago, gc8 said:

possible via debriefing

 

if you have any script for that could you not put it in the then bracket instead of 'end mission'?

 

if !(isClass(configFile>>"CfgPatches">>"TPW_MODS")) then {
	//insert script here to start debrief with clicky link for missing mod
};

 

Share this post


Link to post
Share on other sites
11 minutes ago, lordfrith said:

 

if you have any script for that could you not put it in the then bracket instead of 'end mission'?

 


if !(isClass(configFile>>"CfgPatches">>"TPW_MODS")) then {
	//insert script here to start debrief with clicky link for missing mod
};

 

 

No because if missing an addon you get immediately kicked to lobby. At least I haven't yet found any way to display any links in this case

Share this post


Link to post
Share on other sites

Can't post the code on how to do it right now, but it can be done using something like:

systemChat format parseText ["Missing mod: %1", _theModThatsMissing ];

It'd generally have to be a bit more complex but maybe I'll post that later.

Share this post


Link to post
Share on other sites

@phronk That part is covered 🙂

 

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

×