Quickly wrote this up for my server and thought I'd release it for other servers to use.
(image shows me on solo. though the score doesn't enable until there's 5 or more players)
Since BO2 Zombies isn't really meant to have 8 players, you usually see the score on the player's hud freeze, which requires users to hold TAB to see their score. This function will ensure that players wont have to do that (unless they want to see the scores of other players)
Automatically enables and disables based on the amount of players in game.
Install
Add these includes if you don't already have them
#include maps/mp/gametypes_zm/_hud_message;
#include maps/mp/gametypes_zm/_hud_util;
Add this line to your onplayerconnect()
foreach(player in GetPlayers())
{
player thread toggleScore();
}
Place this somewhere in your script
toggleScore()
{
//self waittill("spawned_player");
if(!isDefined(self.scoretext))
{
self.scoreText = CreateFontString("Objective", 1.5);
self.scoretext setPoint("CENTER", "RIGHT", "CENTER", "RIGHT");
self.scoreText.label = &"^2Score: ^7";
self.scoretext.alpha = 0;
}
else if(getplayers().size >= 5 && self.scoretext.alpha == 0)
{
self.scoretext.alpha = 1;
if(self.scoreInUse == 0)
self thread displayScore();
}
else if(getplayers().size < 5 && self.scoretext.alpha == 1)
{
self.scoretext.alpha = 0;
self.scoreInUse = 0;
}
}
displayScore()
{
self.scoreInUse = 1;
while(self.scoretext.alpha == 1)
{
self.scoretext SetValue(self.score);
wait 0.25;
}
return;
}
and compile
tested and worked pretty well, however I'm shit at writing loops so I'm open to suggestions and tweaks I should make. Also shoutout to Sore/Sorez for helping me a bit with the displayScore function, and Ashton Biehl for their health function, which I based this off of.
Updated 8/16/20: This was a rewrite I had laying around for a bit that I kinda forgot about, while I can't say for sure if this will have compatibility with other scripts (Z++, Z Reimagined) but it worked perfectly with my servers. I took a different approach to the loops using a combo of my code and Gerard's code. If there are any issues let me know, last time I ran this it worked just fine.