timer and count zombie bo2 t6
-
windows + R = %localappdata%\Plutonium\storage\t6\raw\scripts\zmcrée un fichier exemple = Timer_Count.csg et ajoute le code
#include maps\mp_utility;
#include common_scripts\utility;
#include maps\mp\gametypes_zm_hud_util;
#include maps\mp\gametypes_zm_hud_message;
#include maps\mp\zombies_zm_utility;init()
{
level thread onPlayerConnect();
}onPlayerConnect()
{
for (;;)
{
level waittill("connecting", player);
player thread onplayerspawned();
}
}onplayerspawned()
{
self endon("disconnect");
self thread zombie_counter();
self thread game_timer();
self thread round_timer();
for (;;)
{
self waittill("spawned_player");
}
}game_timer()
{
self endon("disconnect");
wait 2;hud = create_simple_hud(self); hud.foreground = true; hud.sort = 1; hud.hidewheninmenu = true; hud.alignX = "left"; hud.alignY = "top"; hud.horzAlign = "user_left"; hud.vertAlign = "user_top"; hud.x = 5; hud.y = 5; hud.alpha = 1; hud.label = &"^2Game: "; hud setTimerUp(0);
}
round_timer()
{
self endon("disconnect");
wait 2;timerHud = create_simple_hud(self); timerHud.foreground = true; timerHud.sort = 1; timerHud.hidewheninmenu = true; timerHud.alignX = "left"; timerHud.alignY = "top"; timerHud.horzAlign = "user_left"; timerHud.vertAlign = "user_top"; timerHud.x = 5; timerHud.y = 15; timerHud.color = (1, 0, 0); timerHud.alpha = 1; timerHud.label = &"^2Round: "; for (;;) { timerHud setTimerUp(0); start_time = GetTime() / 1000; level waittill("end_of_round"); end_time = GetTime() / 1000; time_elapsed = end_time - start_time; timerHud setTimer(time_elapsed); }
}
zombie_counter()
{
self endon("disconnect");
flag_wait("initial_blackscreen_passed");// Utilisation de create_simple_hud() pour uniformiser la police self.zombiecounter = create_simple_hud(self); self.zombiecounter.foreground = true; self.zombiecounter.sort = 1; self.zombiecounter.hidewheninmenu = true; self.zombiecounter.alignX = "left"; self.zombiecounter.alignY = "top"; self.zombiecounter.horzAlign = "user_left"; self.zombiecounter.vertAlign = "user_top"; self.zombiecounter.x = 5; self.zombiecounter.y = 25; self.zombiecounter.alpha = 1; self.zombiecounter.label = &"^2Zomb: "; for (;;) { self.zombiecounter setvalue(level.zombie_total + get_current_zombie_count()); wait 0.05; }
}