Jump to content
Sign in to follow this  
1para{god-father}

if (!isServer) exitWith {} does not seem to work on DEDI server ?

Recommended Posts

I am having a issue with a script that does not seem to work on a dedi server , it works great when i host it , so to test i tried the following :-

in my trigger:-

_null = 10 execVM "testscript1.sqf";

my testscript1.sqf

if (!isServer) exitWith {} ;

HINT "START SCRIPT";

blar blar blar

I never get the Hint on a dedi ?

If i do the same when i host I get the hint , am I missing somnething here ?

Share this post


Link to post
Share on other sites

as far as i know it should be (!isDedicated), maybe you wanna try that.

Share this post


Link to post
Share on other sites

That's because when you are hosting you are the server which means only you can see that hint. But when you are on a dedicated, you aren't the server so nobody see's it beside the machine hosting it.

If you change:

if (!isServer) exitWith {};

to:

if (isServer) exitWith {};

all clients will see it besides the server (hoster or dedicated machine).

Share this post


Link to post
Share on other sites

Yes,

hint is local and as such only the ded.server see it (well, not technically)

to spam messages over net you need to prepare all clients (in init.sqf or client.sqf if you have such a structure) with something like:

"publicHint" addPublicVariableEventHandler { hint (_this select 1); };

and then from a server, dedicated or not:

publicHint = "Ondrej has hair"; publicVariable "publicHint";

if(!isDedicated) then { hint publicHint };

Now, to extend this you may even do:

format["publicHint%1",side group player] addPublicVariableEventHandler { hint (_this select 1); };

and then from server (or client):

publicHintWEST = "Ondrej has hair"; publicVariable "publicHintWEST";

if(!isDedicated) then { hint publicHintWEST };

to hint all west players.

(GUER or EAST for others)

Share this post


Link to post
Share on other sites

Thanks for the info I was Just using the HINT as a test to see if the script was working because when I tried this script on my DEDI it does not work , if i host it works like a dream ! ( but that explains why My hint did not come up )

The script below which is Demonized script that i was trying to work on a DEDI , have no idea why it will not work on a dedi box, like it does when I run it on hosted.

Hopefully someone will point out the issue !?


private ["_huntdown","_require_1_capture","_noCntStart","_who","_colorChk","_col","_t","_min","_sec","_endHint","_endType","_marker","_cnt","_ALL_towns_markers"];
/*
* Save as timer.sqf
* Place the same markers here as in engageTowns.sqf
* Adjust end messages.
* Set the endMission types, check    http://community.bistudio.com/wiki/endMission    for info on endings.
* Place this in init.sqf or in any unit/object initline, number is minutes after all is captured before endMission.
	_null = 10 execVM "timer.sqf";

Credits: Psivalli for the idea and actual timer code part.
*/

_ALL_towns_markers = ["townMarker1","townMarker2","townMarker3"];
_require_1_capture = true;  // if one of the markers must change color before the actual timer is activated. (all markers can start as for example red, and once 1 of them has been captured by others the timer activates.

if (!isServer OR !isNil "DMZ_ET_endCheck") exitWith {};

DMZ_ET_endCheck = true;
waitUntil { !isNil "BIS_MPF_InitDone" };

if (_require_1_capture) then {
// wait until there is change in marker colors before activating the countdown, no matter color of marker, at least one of them has to change before timer is activated.
_noCntStart = [];
{_noCntStart = _noCntStart + [[_x, getMarkerColor _x]]} foreach _ALL_towns_markers;
waitUntil {sleep 1; ({getMarkerColor (_x select 0) != (_x select 1)} count _noCntStart) != 0};
};

while {DMZ_ET_endCheck} do {
_cnt = count _ALL_towns_markers;
waitUntil {sleep 1; ({getMarkerColor _x == "ColorBlue"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorRed"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorGreen"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorWhite"} count _ALL_towns_markers) == _cnt};
DMZ_ET_endCheck = false;

_t = _this * 60;
while {_t > 0} do {
	_colorChk = [];
	{
		_col = getMarkerColor _x;
		if (!(_col in _colorChk)) then {_colorChk = _colorChk + [_col]};
	} foreach _ALL_towns_markers;

	_who = switch (true) do {
		case ("ColorBlue" in _colorChk): {"West"};
		case ("ColorRed" in _colorChk): {"East"};
		case ("ColorGreen" in _colorChk): {"Resistance"};
	};

	_min = floor (_t / 60);
	_sec = floor (_t mod 60);
	_min = (if (_min <= 9) then {"0"} else {""}) + str _min;
	_sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec;
	_t = _t - 1;

	[nil,nil,rSPAWN,hintSilent (format["%3 WIN %1:%2",_min,_sec,_who])] call RE;
	sleep 1;

	if (_t != 0 AND count _colorChk > 1) then {_t = 0; DMZ_ET_endCheck = true};
};
[nil,nil,rSPAWN,hintSilent ""] call RE;

if (!DMZ_ET_endCheck) then {
	// now all markers is either red, blue or orange.
	_endType = ""; _endHint = "";
	_marker = _ALL_towns_markers select 0;

	if (getMarkerColor _marker == "ColorBlue") then {
		// Bluefor win message or set a variable for your own end triggers etc.
		_endHint= "Blue wins";
		_endType = "END1";
	};
	if (getMarkerColor _marker == "ColorRed") then {
		// Opfor win message or set a variable for your own end triggers etc.
		_endHint= "Red wins";
		_endType = "LOSER";
	};
	if (getMarkerColor _marker == "ColorGreen") then {
		// Resistance win message or set a variable for your own end triggers etc.
		_endHint = "Resistance wins";
		_endType = "LOSER";
	};
	if (getMarkerColor _marker == "ColorWhite") then {
		// Civilian win message or set a variable for your own end triggers etc.
		_endHint = "Civilians wins";
		_endType = "LOSER";
	};
	[nil,nil,rHINT,_endHint] call RE;

	// below  and the _endType lines can be deleted if you handle end of mission some other way.
	sleep 5;  // wait 5 seconds after hint then endmission for all.

	// end the mission.
	[nil,nil,rendMission,_endType] call RE;
};
};

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  

×