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

Fix This :) please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sahil vichare
Junior Member
Join Date: May 2017
Old 03-17-2018 , 09:32   Fix This :) please
Reply With Quote #1

hey all actually i need help with zp cso countdown plugin. it works good but i want the text for 20 seconds currently it only starts with 10 but i want to the text from 20 seconds for example

Remaining Seconds For Zombie Infection 20.
Remaining Seconds For Zombie Infection 19
Remaining Seconds For Zombie Infection 18
Remaining Seconds For Zombie Infection 17
Remaining Seconds For Zombie Infection 16
Remaining Seconds For Zombie Infection 15
... till 0


Here Is The Code

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>

#define PLUGIN "[ ZE ] Countdown"
#define VERSION "1.0"
#define AUTHOR "littleboy"

new zp_cso_sec, zp_cso_sec_text , zp_center_textmsg

new const zp_cso_roundstart[][] = 
{
	"sound/city/other/start2.mp3",
		"sound/zombie_escape/ZE_Ready.mp3"
}

new zp_cso_countchant[10][] = 
{ 
    "city/other/1.wav",
    "city/other/2.wav",
    "city/other/3.wav",
    "city/other/4.wav",
    "city/other/5.wav",
    "city/other/6.wav",
    "city/other/7.wav",
    "city/other/8.wav",
    "city/other/9.wav",
    "city/other/10.wav" 
}

public plugin_init() 
{
	register_plugin(PLUGIN , VERSION, AUTHOR)
	register_event("HLTV", "zp_cso_round_start", "a", "1=0", "2=0")
	zp_center_textmsg = get_user_msgid("TextMsg")
}

public plugin_precache()
{
	new i

	for(i = 0; i < sizeof zp_cso_roundstart; i++) 
	engfunc(EngFunc_PrecacheGeneric, zp_cso_roundstart[i]) 

	for(i = 0; i < sizeof zp_cso_countchant; i++) 
	engfunc(EngFunc_PrecacheSound, zp_cso_countchant[i])
	
	register_dictionary("zp_cso_countdown.txt")
}

public zp_cso_round_start()
{
	set_task(2.0, "sound");
	
	zp_cso_sec = 20
	
	zp_cso_sec_text = 20
	
	zp_cso_countdown()
}

public zp_round_started(mode, id)
{
	zp_cso_sec = 0
	zp_cso_sec_text = -1
}

public sound()
{
	new iMP3, MP3[64]

	iMP3 = random_num(0,1)
	copy(MP3, charsmax(MP3), zp_cso_roundstart[iMP3])

	client_cmd(0,"mp3 play ^"%s^"", MP3)
}

public  zp_cso_countdown()
{ 
	zp_cso_sec -= 1
	
	if(zp_cso_sec < 10)
	{
		zp_cso_chantdown()
	}

	if(zp_cso_sec >= 1)
	{
		set_task(1.0, "zp_cso_countdown")
		set_task(10.0, "text")
	}
} 

public text()
{
	new texts
	
	texts = zp_cso_sec_text

	if(texts == -1)
	return PLUGIN_CONTINUE
	
	new iText[64]

	format(iText, charsmax(iText), "%L", LANG_PLAYER, "ZP_CSO_COUNTDOWN_NOTICE", zp_cso_sec_text)
	zp_clientcenter_text(0, iText)
	
	zp_cso_sec_text -=1
	
	return PLUGIN_CONTINUE
}

public zp_cso_chantdown()
{
	new iChant[64], iSound

	iSound = zp_cso_sec

	if(iSound == -1)
	return PLUGIN_CONTINUE

	copy(iChant, charsmax(iChant), zp_cso_countchant[iSound])
	client_cmd(0,"speak ^"%s^"", iChant)
	return PLUGIN_CONTINUE
}

stock zp_clientcenter_text(id, zp_message[])
{
	new dest
	if (id) dest = MSG_ONE
	else dest = MSG_ALL

	message_begin(dest, zp_center_textmsg, {0,0,0}, id)
	write_byte(4)
	write_string(zp_message)
	message_end()
}

Thanks In Advance
sahil vichare is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 03-17-2018 , 10:38   Re: Fix This :) please
Reply With Quote #2

Code:
public  zp_cso_countdown()
{ 
	zp_cso_sec -= 1
	
	if(zp_cso_sec < 20)
	{
		zp_cso_chantdown()
	}

	if(zp_cso_sec >= 1)
	{
		set_task(1.0, "zp_cso_countdown")
		set_task(20.0, "text")
	}
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 03-17-2018 , 11:08   Re: Fix This :) please
Reply With Quote #3

I think that the 20s won't count, it would start at 19. So drop by 1 the variable after checks.
__________________
Relaxing is offline
sahil vichare
Junior Member
Join Date: May 2017
Old 03-18-2018 , 01:07   Re: Fix This :) please
Reply With Quote #4

Quote:
Originally Posted by Relaxing View Post
I think that the 20s won't count, it would start at 19. So drop by 1 the variable after checks.
Please fix
sahil vichare is offline
Reply


Thread Tools
Display Modes

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 21:57.


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