Jump to content
Walkero0

cant get score on server

Recommended Posts

I really can't figure out why this don't work on server,

I decided to create my own variable for my score system wlkscore.

No hint and no score were added.

In editor (Play as Multiplayer) all works fine. I messed around since a few days now.

All i need is get 3 wlkscore for a killed independent zombie and 30 for a killed playable civilian (gamer).

I also tried addMPEventHandler with no luck

gamer = [];
zombies = [];
 while {true} do 
	{
		{ if ((side _x) isEqualTo independent) then 
			{
			_x addEventHandler ["Killed", { 
			wlkscore = wlkscore + 3; 
			zeus addCuratorPoints 0.05;
			hint format["Score %1", wlkscore];
			zombies = zombies - [_x]; }];
			zombies pushBack _x;
			};
		} forEach (allUnits - zombies); 
		
		{ if ((side _x) isEqualTo civilian) then 
			{
			_x addEventHandler ["Killed", { 
			wlkscore = wlkscore + 30; 
			zeus addCuratorPoints 0.05;
			hint format["Score %1", wlkscore];
			gamer = gamer - [_x]; }];
			gamer pushBack _x;
			};
		} forEach (allUnits - gamer); 
		
	sleep 1;
	};

client log:

https://cloud.walk3r.info/index.php/s/cdY5UHvgekD5egU/download

 

server log:

https://cloud.walk3r.info/index.php/s/17gdLy0iSl7VDPT/download

 

Share this post


Link to post
Share on other sites

Doubt this even works because wlkscore is never initialized.

Seems like an odd approach, why not use EntityKilled eventhandler and run it from initServer.sqf?

Something like this:

//initServer.sqf
wlkscore = 0;
addMissionEventHandler ["EntityKilled", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];

	if (isPlayer _unit AND side group _unit isEqualTo civilian) then {
		wlkscore = wlkscore + 30
	};

	if (!isPlayer _unit and side group _unit isEqualTo independent) then {
		wlkscore = wlkscore + 3
	};

}];

Might be easier to handle everything from the server with a single EH.

 

Cheers

Share this post


Link to post
Share on other sites
30 minutes ago, Grumpy Old Man said:

Doubt this even works because wlkscore is never initialized.

Seems like an odd approach, why not use EntityKilled eventhandler and run it from initServer.sqf?

Something like this:


//initServer.sqf
wlkscore = 0;
addMissionEventHandler ["EntityKilled", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];

	if (isPlayer _unit AND side group _unit isEqualTo civilian) then {
		wlkscore = wlkscore + 30
	};

	if (!isPlayer _unit and side group _unit isEqualTo independent) then {
		wlkscore = wlkscore + 3
	};

}];

Might be easier to handle everything from the server with a single EH.

 

Cheers

Thank you but same phenomen. Works great in Editor. On server no luck.

server log: https://cloud.walk3r.info/index.php/s/LZ0YQb0Eh2EuJp2/download

client log: https://cloud.walk3r.info/index.php/s/HOL6kwYFCexfrvE/download

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

×