Raised This Month: $51 Target: $400
 12% 

Help / Support ZP Countdown


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
notblade0299
Junior Member
Join Date: Nov 2017
Old 02-13-2023 , 18:48   ZP Countdown
Reply With Quote #1

Hey
Code:
#include <amxmodx>
#include <amxmisc>
#include <dhudmessage>

#define PLUGIN "Countdown"
#define VERSION "1.0"
#define AUTHOR "MooxnS"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0") 
}

public plugin_precache()
{
	precache_sound("zombie_plague/countdown/start.wav")
	precache_sound("zombie_plague/countdown/20secs.wav")
	precache_sound("zombie_plague/countdown/10.wav")
	precache_sound("zombie_plague/countdown/9.wav")
	precache_sound("zombie_plague/countdown/8.wav")
	precache_sound("zombie_plague/countdown/7.wav")
	precache_sound("zombie_plague/countdown/6.wav")
	precache_sound("zombie_plague/countdown/5.wav")
	precache_sound("zombie_plague/countdown/4.wav")
	precache_sound("zombie_plague/countdown/3.wav")
	precache_sound("zombie_plague/countdown/2.wav")
	precache_sound("zombie_plague/countdown/1.wav")
}

// SetEvents
public event_round_start()
{
	set_task(1.0, "roundmusic")
	set_task(3.0, "countdown")
}

// StartTasks
public roundmusic()
{
	set_task(1.0, "zero")
}

public countdown()
{
	set_task(1.0, "twenty")
	set_task(2.0, "nineteen")
	set_task(3.0, "eighteen")
	set_task(4.0, "seventeen")
	set_task(5.0, "fifteen")
	set_task(6.0, "fourteen")
	set_task(7.0, "thirteen")
	set_task(8.0, "twelve")
	set_task(9.0, "eleven")
	set_task(10.0, "ten")
	set_task(11.0, "nine")
	set_task(12.0, "eight")
	set_task(13.0, "seven")
	set_task(14.0, "six")
	set_task(15.0, "five")
	set_task(16.0, "four")
	set_task(17.0, "three")
	set_task(18.0, "two")
	set_task(19.0, "one")
}

public zero()
{
	client_cmd(0, "spk zombie_plague/countdown/start")
}

public twenty()
{
	client_print(0, print_center, "Infection starts in: 20")
	client_cmd(0, "spk zombie_plague/countdown/20secs")
}

public nineteen()
{
	client_print(0, print_center, "Infection starts in: 19")
}

public eighteen()
{
	client_print(0, print_center, "Infection starts in: 18")
}

public seventeen()
{
	client_print(0, print_center, "Infection starts in: 17")
}

public sixteen()
{
	client_print(0, print_center, "Infection starts in: 16")
}

public fifteen()
{
	client_print(0, print_center, "Infection starts in: 15")
}

public fourteen()
{
	client_print(0, print_center, "Infection starts in: 14")
}

public thirteen()
{
	client_print(0, print_center, "Infection starts in: 13")
}

public twelve()
{
	client_print(0, print_center, "Infection starts in: 12")
}

public eleven()
{
	client_print(0, print_center, "Infection starts in: 11")
}

public ten()
{
	client_print(0, print_center, "Infection starts in: 10")
	client_cmd(0, "spk zombie_plague/countdown/10")
}

public nine()
{
	client_print(0, print_center, "Infection starts in: 9")
	client_cmd(0, "spk zombie_plague/countdown/9")
}

public eight()
{
	client_print(0, print_center, "Infection starts in: 8")
	client_cmd(0, "spk zombie_plague/countdown/8")
}

public seven()
{
	client_print(0, print_center, "Infection starts in: 7")
	client_cmd(0, "spk zombie_plague/countdown/7")
}

public six()
{
	client_print(0, print_center, "Infection starts in: 6")
	client_cmd(0, "spk zombie_plague/countdown/6")
}

public five()
{
	client_print(0, print_center, "Infection starts in: 5")
	client_cmd(0, "spk zombie_plague/countdown/5")
}

public four()
{
	client_print(0, print_center, "Infection starts in: 4")
	client_cmd(0, "spk zombie_plague/countdown/4")
}

public three()
{
	client_print(0, print_center, "Infection starts in: 3")
	client_cmd(0, "spk zombie_plague/countdown/3")
}

public two()
{
	client_print(0, print_center, "Infection starts in: 2")
	client_cmd(0, "spk zombie_plague/countdown/2")
}

public one()
{
	client_print(0, print_center, "Infection starts in: 1")
	client_cmd(0, "spk zombie_plague/countdown/1")
}
Can anyone shorten the code, make it more efficient, and also check for an roundEnd.
I have an autorestart on map_change so when it does it overlaps with 2 tasks, making annoying double sounds.
notblade0299 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode