Downloads containing h.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: h?Featured Download Violet CLM Mutator 10 Download file

File preview

#pragma name "h?"

array<int> LastHealths(jjLocalPlayerCount, -1);

bool playerHasFlag(const jjPLAYER@ play) {
	return play.flag > 0 && jjObjects[play.flag].var[0] == play.playerID + CREATOR::PLAYER;
}

void onPlayer(jjPLAYER@ play) {
	if (!playerHasFlag(play))
		LastHealths[play.localPlayerID] = -1; //any health while carrying a flag will be different from the health while not carrying a flag
	else if (LastHealths[play.localPlayerID] != play.health) {
		LastHealths[play.localPlayerID] = play.health;
		if (play.health > 0)
			jjChat("" + play.health, true);
	}
}

void onChat(int, string &in stringReceived, CHAT::Type chatType) {
	if (chatType == CHAT::TEAMCHAT && jjRegexMatch(stringReceived, "h\\??", true)) {
		for (int i = 0; i < jjLocalPlayerCount; ++i)
			if (playerHasFlag(jjLocalPlayers[i])) {
				jjChat("" + jjLocalPlayers[i].health, true);
				break;
			}
	}
}