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

mKSeRv Timeleft Countdown


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-10-2008 , 16:56   Re: mKSeRv Timeleft Countdown
Reply With Quote #11

set_task() is perfectly fine just for a countdown. Plus executed only 1 min before mapchange... It's nothing. I don't see where is the improvement using this tuto in such case ?

Like I've said your way can be optimized a bit. ( give me some times and i will post later, I'm busy atm )
__________________

Last edited by Arkshine; 08-10-2008 at 16:59.
Arkshine is offline
Lo6idZe
Member
Join Date: May 2008
Old 08-10-2008 , 17:04   Re: mKSeRv Timeleft Countdown
Reply With Quote #12

Ok , waiting for you post...
Lo6idZe is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 08-10-2008 , 17:43   Re: mKSeRv Timeleft Countdown
Reply With Quote #13

Nice This is worth +karma
maplebest is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-10-2008 , 18:15   Re: mKSeRv Timeleft Countdown
Reply With Quote #14

You can do something like :

Code:
#include <amxmodx> new gp_Plugin; new gp_Timecount; new gi_TimeCount; new gi_CreateHud; public plugin_init () {     register_plugin( "mKSeRv Timeleft Countdown", "0.2", "KIL" );         gp_Plugin    = register_cvar( "amx_mk_tlcd", "1" );     gp_Timecount = register_cvar( "amx_mk_seconds", "60" );         gi_CreateHud = CreateHudSyncObj(); } public plugin_cfg () {     if ( get_pcvar_num( gp_Plugin ) )     {         gi_TimeCount = max( 1, get_pcvar_num( gp_Timecount ) );         set_task( float( gi_TimeCount ), "StartCountDown", _, _, _, "d" );     } } public StartCountDown () {        set_task( 1.0, "DoCountDown", _, _, _, "a", gi_TimeCount ); } public DoCountDown () {     switch( gi_TimeCount )     {         case  0 .. 10 : set_hudmessage( 139, 0, 0, 0.7, 0.88, 1, 1.0, 1.0, 0.01, 0.01, -1 );         case 11 .. 30 : set_hudmessage( 0, 255, 255, 0.7, 0.88, 1, 1.0, 1.0, 0.01, 0.01, -1 );         default       : set_hudmessage( 255, 255, 255, 0.7, 0.88, 1, 1.0, 1.0, 0.01, 0.01, -1 );     }         ShowSyncHudMsg( 0, gi_CreateHud, "%i second(s) remaining", gi_TimeCount );     --gi_TimeCount; }

Notes :

- Using "d" flag on set_task means : do task on time before a map timeleft . So, "StartCountDown" will be called just one time at the right moment. It's better to call per second during all the play.

- Using "a" flag means : Repeat task a specified number of times. So, "DoCountDown" will be called as times as the provided value. No more.

- Always using a switch when you can. In such case, it's more efficient to do that.


Now, there is a problem. You cut the time in three parts to apply differents color. But theses parts are based on 60 seconds. What about if I provide another value like 30 seconds or 10 seconds ? You should considerate it. Either you calculate from this value either you can use anothers cvars. It's up to you.

As suggestion, maybe adding sound when the countdown starts, ML system ( even if there is one line ), etc..
__________________

Last edited by Arkshine; 08-10-2008 at 18:17.
Arkshine is offline
Lo6idZe
Member
Join Date: May 2008
Old 08-11-2008 , 04:38   Re: mKSeRv Timeleft Countdown
Reply With Quote #15

Thank you... This is something new for me...
Yes I was thinking about adding sound but I got one problem. If I use your code , I don't understand how to add it .
My code:

Code:
 
if (g_timeleft == 50) client_cmd(0,"spk ^"fvox/fifty seconds remaining^"") 
else if(g_timeleft == 40) client_cmd(0,"spk ^"fvox/fourty seconds remaining^"")
else if(g_timeleft == 30) client_cmd(0,"spk ^"fvox/thirty seconds remaining^"")
else if(g_timeleft == 20) client_cmd(0,"spk ^"fvox/twenty seconds remaining^"")
else if(g_timeleft == 10) client_cmd(0,"spk ^"fvox/ten seconds remaining^"")
But i see now , that it looks really stupid !
So can you edit this code ?
And last... AMXX countdown last 10 seconds by defualt... If we will add countdown by voice , two voices will countdown... it's not good...

P.S I am away for 3-4 days... when I'll be back I add all you changes...
Lo6idZe is offline
Deag1y
Member
Join Date: Jul 2008
Location: Russia,Yekaterinburg
Old 08-17-2008 , 07:27   Re: mKSeRv Timeleft Countdown
Reply With Quote #16

n1ce plugin but it erases from the screen hud-inscriptions from other plugins
__________________
sry if I do mistakes in English [IMG]http://img521.**************/img521/7178/happysw9.gif[/IMG]
Deag1y is offline
Send a message via ICQ to Deag1y Send a message via Skype™ to Deag1y
koss_4life
BANNED
Join Date: Jun 2008
Location: Heaven
Old 08-17-2008 , 18:04   Re: mKSeRv Timeleft Countdown
Reply With Quote #17

I really like your plugin!

But Can anyone pls help me with the same plugin (but special mode )

Hi!

I'm searching for a plugins!

A kind of "countdown" plugin that show HUD-text message in the middle of the screen (10 seconds before a mapchange) this text:

"The round will restart in : (these text start to show up when 10 seconds is left of the map-time and stays there in 3 seconds - I want text in white colour)

10 - 9 - 8 -7 - 6- 5- 4 - 3- 2 - 1 (Just this text will be counted down and shows up between these two lines of text)

"Please hang on to the next episode and enjoy the music! : )" (these text start to show up when 10 seconds is left of the map-time and stays there in 3 seconds- I want text in white colour)

Picture what it can look like:



+Karma then!
koss_4life is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-29-2008 , 14:39   Re: mKSeRv Timeleft Countdown
Reply With Quote #18

Useless.Unapproved

If you add something new or recode the plugin, PM me.
Alka is offline
Reply



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 04:28.


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