Jump to content
HonzaVinCZ

score punishment & systemChat message

Recommended Posts

Hello, guys. I have done this script but it won't take away instigator's score and shows "any" instead of -100 points in system message.
Any help please? Also if possible, could you give me a advice how to set message to show score ammount taken not in minus? Thank you!
 

// Turn Punishments ON/OFF
_run = true;

// Turn Civillian Punishment ON/OFF
//_civillianPunishment = true;
// How many points take away to instigator for civillian killed - WORKS ONLY IF _civillianPunishment = true
_civilianPunishmentPoints = -100;

// Turn Team Kill Punishment ON/OFF
//_teamKillPunishment = true;
// How many points take away to instigator for teamkill - WORKS ONLY IF _teamKillPunishment = true
_teamKillPunishmentPoints = -100;


if (_run) then {

	addMissionEventHandler ["EntityKilled", 
	{
		params ["_killed", "_killer", "_instigator"];

		// UAV/UGV player operated road kill
		if (isNull _instigator) then {
			_instigator = UAVControl vehicle _killer select 0
		}; 
	
		// player driven vehicle road kill
		if (isNull _instigator) then {
			_instigator = _killer
		}; 
	
		// Civillian Punishment
		if ((side group _killed == civilian) && (isPlayer _instigator)) then { 
		 	if (isServer) then {
		 		_instigator addScore _civilianPunishmentPoints};
		  	systemChat format ["%1 killed a civilian, he loses %2 score.", name _instigator, _teamKillPunishmentPoints];
		};

		// Team Kill Punishment
		if ((side group _killed == side _instigator) && (isPlayer _instigator)) then { 
		 	if (isServer) then {
		 		_instigator addScore _teamKillPunishmentPoints};
		  	systemChat format ["%1 did a team kill, he loses %2 score.", name _instigator, _teamKillPunishmentPoints];
		};
	}];
};

 

Share this post


Link to post
Share on other sites

@HonzaVinCZ,

_instigator addScore _civilianPunishmentPoints}; systemChat format ["%1 killed a civilian, he loses %2 score.", name _instigator, _teamKillPunishmentPoints];<--- is this a typo? Should be civilian?

I'm not sure what the issue is. It's supposed to read,

Quote

"Player did a team kill, he loses -100 score."

but says,

Quote

"Player did a team kill, he loses any score."

and ideally you want it to say,

Quote

"Player did a team kill, he loses 100 score."

I'd like to see this script work because I'll soon need something similar. Following...


 

Quote

Any help please?

Given the context that is a pun. 😉

  • Like 1

Share this post


Link to post
Share on other sites

So... I still didn't found how to make it work. The problem are just number variables. When I set numbers in addScore manually, it works well but it won't work with variables I set.
I must have it written wrong so I would like to ask you how I could write those number variables right because I have no idea how to write it. 

Share this post


Link to post
Share on other sites

I was so lucky and I had to laugh what I noticed. In this situation you need to type variable without that "_" and then it will work. I was trying everything and then I tried to remove those "_" in variables containing just number and it worked! So then I could finish this script. Not sure with using "if-then" in this situation to turn on/off civilian or team kill punishment... it was just not working if even "if" was true so I removed that and let script be like this:
 

// Turn Punishments ON/OFF
_run = true;

// How many points take away to instigator for civillian killed
civilianPunishmentPoints = -100;

// How many points take away to instigator for teamkill
teamKillPunishmentPoints = -100;

// Score to kick for is <= kickPoints
kickPoints = -500;

if ((_run) && (isServer)) then {

	civilianPunishmentPointsABS = abs civilianPunishmentPoints;
	teamKillPunishmentPointsABS = abs teamKillPunishmentPoints;

	addMissionEventHandler ["EntityKilled", 
	{
		params ["_killed", "_killer", "_instigator"];

		// UAV/UGV player operated road kill
		if (isNull _instigator) then {
			_instigator = UAVControl vehicle _killer select 0
		}; 
	
		// player driven vehicle road kill
		if (isNull _instigator) then {
			_instigator = _killer
		}; 

		// Civillian Punishment
			if ((side group _killed == civilian) && (isPlayer _instigator)) then { 
			 	_instigator addScore civilianPunishmentPoints;
			  	systemChat format ["%1 killed a civilian, he loses %2 score.", name _instigator, civilianPunishmentPointsABS];
			};

		// Team Kill Punishment
			if ((side group _killed == side _instigator) && (isPlayer _instigator)) then { 
			 	_instigator addScore teamKillPunishmentPoints;
			  	systemChat format ["%1 did a team kill, he loses %2 score.", name _instigator, teamKillPunishmentPointsABS];
			};

		// Kick For Too Bad Points
		if ((score _instigator <= kickPoints) && (isPlayer _instigator)) then {
		_uid = getPlayerUID _instigator;
		systemChat format ["%1 has been kicked for killing too many civillians and/or team kills", name _instigator];
		serverCommand format ["#kick %1", _uid];
		};
	}];
};

Hopefully someone find it helpful!

  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, HonzaVinCZ said:

civilianPunishmentPointsABS = abs civilianPunishmentPoints;
teamKillPunishmentPointsABS = abs teamKillPunishmentPoints;

 

No need to set up separate global vars just for systemChat message. Just use abs in the systemChat lines.

systemChat format ["%1 did a team kill, he loses %2 score.", name _instigator, abs teamKillPunishmentPoints];

 

  • Like 3
  • Thanks 1

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

×