Raised This Month: $ Target: $400
 0% 

[REQ] Jailbreak Simon Countdown


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
agarwalakshay.1195
Junior Member
Join Date: Apr 2011
Old 07-24-2011 , 04:00   [REQ] Jailbreak Simon Countdown
Reply With Quote #1

I need a plugin for my Jailbreak server that displays a countdown when some race or swim competition is about to begin.
For example, The simon types /countdown and a HUD message displays a countdown of 5 seconds and after That A message appears Go Go Go !
I tried searching but no help
I'd be very grateful
agarwalakshay.1195 is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 06:52   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #2

Quote:
Originally Posted by agarwalakshay.1195 View Post
I need a plugin for my Jailbreak server that displays a countdown when some race or swim competition is about to begin.
For example, The simon types /countdown and a HUD message displays a countdown of 5 seconds and after That A message appears Go Go Go !
I tried searching but no help
I'd be very grateful
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <Cstrike>

#define PLUGIN "countdown"
#define VERSION "1.0"
#define AUTHOR "Drekes"

new timer
new name[33]
new 
boolgot_name false
new boolcountdown_on false
new const PREFIX [] = "[ JailBreak ]" 

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /countdown" "Cmdcountdown")
    
register_logevent("roundstart"2"1=Round_Start")
}
public 
plugin_precache()
{
    
precache_sound("fvox/one.wav")
    
precache_sound("fvox/two.wav")
    
precache_sound("fvox/three.wav")
    
precache_sound("fvox/four.wav")
    
precache_sound("fvox/five.wav")
    
precache_sound("radio/com_go.wav")
}

public 
Cmdcountdown(id)
{
    if(
get_user_team(id) != 2)
    {
            
client_print(idprint_chat"%s Only Counter-terrorist can start a countdown"PREFIX)

        return 
PLUGIN_HANDLED
    
}
    
    if(
countdown_on)
    {
            
client_print(idprint_chat"%s There is already a countdown on"PREFIX)
        
        return 
PLUGIN_HANDLED
    
}
    
    new 
menu menu_create("\yCountDown Menu""menu_handler")
    
    
menu_additem(menu"\w5 Seconds""1"0)
    
menu_additem(menu"\w10 Seconds""2"0)
    
menu_additem(menu"\w15 Seconds""3"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}

public 
menu_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
Data[7], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(menuitemAccessData,5Name63Callback)
    
    new 
Key str_to_num(Data)
    
    switch(
Key)
    {
        case 
1:
        {
            
timer 5
        
}
        
        case 
2:
        {
            
timer 10
        
}
            
        case 
3:
        {
            
timer 15
        
}
    }
    
countdown_on true
    got_name 
false
    countdown
(id)
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
countdown(id)
{
    if(!
got_name)
        
get_user_name(idname32)
        
    switch(
timer)
    {
        case 
0:
        {
            
set_hudmessage(255255255, -1.0, -1.006.03.0)
            
show_hudmessage(0"Go go go")
            
client_cmd(0"spk ^"sound/radio/com_go.wav^"")
            
countdown_on false
        
}
        
        case 
1:
        {
            
client_cmd(0"spk ^"fvox/one.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
2:
        {
            
client_cmd(0"spk ^"fvox/two.wav^"")
            
set_task(1.0"countdown"0)
        }
            
        case 
3:
        {
            
client_cmd(0"spk ^"fvox/three.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
4:
        {
            
client_cmd(0"spk ^"fvox/four.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
5:
        {
            
client_cmd(0"spk ^"fvox/five.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
6:
        {
            
client_cmd(0"spk ^"fvox/six.wav^"")
            
set_task(1.0"countdown"0)
        }
        case 
7:
        {
            
client_cmd(0"spk ^"fvox/seven.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
8:
        {
            
client_cmd(0"spk ^"fvox/eight.wav^"")
            
set_task(1.0"countdown"0)
        }
            
        case 
9:
        {
            
client_cmd(0"spk ^"fvox/nine.wav^"")
            
set_task(1.0"countdown"0)
        }
            
        case 
10:
        {
            
client_cmd(0"spk ^"fvox/ten.wav^"")        
            
set_task(1.0"countdown"0)
        }
        
        case 
11:
        {
            
client_cmd(0"spk ^"fvox/eleven.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
12:
        {
            
client_cmd(0"spk ^"fvox/twelve.wav^"")
            
set_task(1.0"countdown"0)
        }
            
        case 
13:
        {
            
client_cmd(0"spk ^"fvox/thirteen.wav^"")
            
set_task(1.0"countdown"0)
        }
            
        case 
14:
        {
            
client_cmd(0"spk ^"fvox/fourteen.wav^"")
            
set_task(1.0"countdown"0)
        }
        
        case 
15:
        {
            
client_cmd(0"spk ^"fvox/fifteen.wav^"")
            
set_task(1.0"countdown"0)
        }
    }
    
    if(
timer != 0)
    {
        
set_hudmessage(255255255, -1.0, -1.006.03.0)
        
show_hudmessage(0"%s started countdown: %i"nametimer)
        
timer--
    }
    
got_name true
}

public 
roundstart(id)
{
    
got_name false;
    
countdown_on false;
}
public 
client_connect(id)
{
    
got_name false;
    
countdown_on false;
}
public 
client_disconnect(id)
{
    
got_name false;
    
countdown_on false;

2reason2kill is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 06:58   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #3

Bad code, i'll write you a new one.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
2reason2kill
Senior Member
Join Date: Feb 2011
Old 07-24-2011 , 07:00   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #4

Quote:
Originally Posted by drekes View Post
Bad code, i'll write you a new one.
Sorry, I didnt want to Put my Name as author Cuz I took this from Your Cfjb.
2reason2kill is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 08:04   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #5

Cfjb is very badly coded and is unapproved because of that.
I've written it almost 2 years ago when i didn't have the knowledge i have now.

@op:

PHP Code:
#include <amxmodx>
#include <cstrike>

#pragma semicolon    1
#define VERSION        "1.0.0"

new const g_szPrefix[] = "AMXX";

new const 
g_iTaskidCountdown 7445;


new 
g_iSyncHud
    
boolg_bHasSaid[33]
;


public 
plugin_init()
{
    
register_plugin("Countdown"VERSION"Drekes");
    
    
register_clcmd("say /countdown""CmdCountdown");
    
register_clcmd("say /cd""CmdCountdown");
    
    
register_clcmd("_countdown_""MessageModeCountdown");
    
    
g_iSyncHud CreateHudSyncObj();
}


public 
client_connect(id)
    
g_bHasSaid[id] = false;
    

public 
CmdCountdown(id)
{
    if(!
is_user_alive(id))
        Print(
id"You must be alive to start a countdown.");
    
    else if(
cs_get_user_team(id) != CS_TEAM_CT)
        Print(
id"Only Counter-terrorists can start a countdown.");
    
    else if(
task_exists(g_iTaskidCountdown))
        Print(
id"There is already a countdown started.");
    
    else
    {
        
g_bHasSaid[id] = true;
        
        
client_cmd(id"messagemode _countdown_");
        Print(
id"Type the amount of seconds you want to count down.");
    }
    
    return 
PLUGIN_HANDLED;
}


public 
MessageModeCountdown(id)
{
    if(!
g_bHasSaid[id])
        return 
PLUGIN_HANDLED;
    
    
g_bHasSaid[id] = false;
    
    new 
szArg[5];
    
read_args(szArgcharsmax(szArg));
    
remove_quotes(szArg);
    
    if(!
szArg[0])
        return 
PLUGIN_HANDLED;
    
    new 
szName[32];
    
get_user_name(idszNamecharsmax(szName));
    Print(
0"%s started a countdown!"szName);
    
    new 
iCount;
    
iCount str_to_num(szArg);
    
    
TaskCountdown(iCount 1);
    
    
set_task(1.0"TaskCountdown"g_iTaskidCountdown__"a"iCount);
    
    return 
PLUGIN_HANDLED;
}


public 
TaskCountdown(iStartCount)
{
    static 
iCount;
    
    if(!
iCount && !task_exists(g_iTaskidCountdown))
        
iCount iStartCount;
        
    switch(
iCount--)
    {
        case 
1:
            
ClearSyncHud(0g_iSyncHud);
        
        case 
2..21:
        {
            new 
szTime[20];
            
num_to_word(iCountszTimecharsmax(szTime));
            
            
client_cmd(0"spk ^"fvox/%s.wav^""szTime);
            
            
set_hudmessage(255255255, -1.0, -1.01);
            
ShowSyncHudMsg(0g_iSyncHud"%i"iCount);
        }
        
        default:
        {
            
set_hudmessage(255255255, -1.0, -1.01);
            
ShowSyncHudMsg(0g_iSyncHud"%i"iCount);
        }
    }
}


Print(
id, const szBuffer[], any:...)
{
    new 
szMessage[192];
    
vformat(szMessagecharsmax(szMessage), szBuffer3);
    
    
client_print(idprint_chat"[%s] %s"g_szPrefixszMessage);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
agarwalakshay.1195
Junior Member
Join Date: Apr 2011
Old 07-24-2011 , 08:47   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #6

thanks man ! just going to test it offline
agarwalakshay.1195 is offline
agarwalakshay.1195
Junior Member
Join Date: Apr 2011
Old 07-24-2011 , 09:31   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #7

Working as a charm
Thanks !
One more thing.. It'd be really awesome if there could be a HUD message at the center like "%s has started the countdown" along the 5,4,3,2,1 countdown.
Because the countdown on crosshair is barely visible. If some text would be above the the countdown or the numbers be a little larger. It'll be just superb !
I could've done it myself if I knew how to
agarwalakshay.1195 is offline
mehmet31
Junior Member
Join Date: Aug 2010
Old 07-24-2011 , 09:43   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #8

Nıce ++ ! But how i add ''3,2,1 Go go go !'' etc. I want to go go go msg.
mehmet31 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-24-2011 , 11:36   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #9

I haven't centered this info hud message. I couldn't get it right because of the name lenght. I've placed it in the left corner.

Changes:
- Added go go go sound
- Added hudmessage for countdown start.
- moved countdown number up above crosshairs.

PHP Code:
#include <amxmodx>
#include <cstrike>

#pragma semicolon    1
#define VERSION        "1.0.0"

new const g_szPrefix[] = "AMXX";

new const 
g_iTaskidCountdown 7445;


new 
g_iSyncHud
    
boolg_bHasSaid[33]
;


public 
plugin_init()
{
    
register_plugin("Countdown"VERSION"Drekes");
    
    
register_clcmd("say /countdown""CmdCountdown");
    
register_clcmd("say /cd""CmdCountdown");
    
    
register_clcmd("_countdown_""MessageModeCountdown");
    
    
g_iSyncHud CreateHudSyncObj();
}


public 
client_connect(id)
    
g_bHasSaid[id] = false;
    

public 
CmdCountdown(id)
{
    if(!
is_user_alive(id))
        Print(
id"You must be alive to start a countdown.");
    
    else if(
cs_get_user_team(id) != CS_TEAM_CT)
        Print(
id"Only Counter-terrorists can start a countdown.");
    
    else if(
task_exists(g_iTaskidCountdown))
        Print(
id"There is already a countdown started.");
    
    else
    {
        
g_bHasSaid[id] = true;
        
        
client_cmd(id"messagemode _countdown_");
        Print(
id"Type the amount of seconds you want to count down.");
    }
    
    return 
PLUGIN_HANDLED;
}


public 
MessageModeCountdown(id)
{
    if(!
g_bHasSaid[id])
        return 
PLUGIN_HANDLED;
    
    
g_bHasSaid[id] = false;
    
    new 
szArg[5];
    
read_args(szArgcharsmax(szArg));
    
remove_quotes(szArg);
    
    if(!
szArg[0])
        return 
PLUGIN_HANDLED;
    
    
    
// Print(0, "%s started a countdown!", szName);
    
    
new iCount;
    
iCount str_to_num(szArg);
    
    
TaskCountdown(iCount 1);
    
    
set_task(1.0"TaskCountdown"g_iTaskidCountdown__"a"iCount);
    
    new 
szName[32];
    
get_user_name(idszNamecharsmax(szName));
    
    
set_hudmessage(2552551000.010.352);
    
show_hudmessage(0"%s started the countdown!"szName);
    
    return 
PLUGIN_HANDLED;
}


public 
TaskCountdown(iStartCount)
{
    static 
iCount;
    
    if(!
iCount && !task_exists(g_iTaskidCountdown))
        
iCount iStartCount;
        
    switch(
iCount--)
    {
        case 
1:
        {
            
ClearSyncHud(0g_iSyncHud);
            
client_cmd(0"spk ^"radio/com_go.wav^"");
        }
        
        case 
2..21:
        {
            new 
szTime[20];
            
num_to_word(iCountszTimecharsmax(szTime));
            
            
client_cmd(0"spk ^"fvox/%s.wav^""szTime);
            
            
set_hudmessage(2552552550.50.351);    
            
ShowSyncHudMsg(0g_iSyncHud"%i"iCount);
            
// ShowSyncHudMsg(0, g_iSyncHud, "%s has started the countdown.", g_szName);
        
}
        
        default:
        {
            
set_hudmessage(2552552550.50.351);
            
ShowSyncHudMsg(0g_iSyncHud"%i"iCount);
            
// ShowSyncHudMsg(0, g_iSyncHud, "%s has started the countdown.^n", g_szName);
        
}
    }
}


Print(
id, const szBuffer[], any:...)
{
    new 
szMessage[192];
    
vformat(szMessagecharsmax(szMessage), szBuffer3);
    
    
client_print(idprint_chat"[%s] %s"g_szPrefixszMessage);

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 07-24-2011 at 13:30.
drekes is offline
Send a message via MSN to drekes
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 07-24-2011 , 12:38   Re: [REQ] Jailbreak Simon Countdown
Reply With Quote #10

include file
Attached Files
File Type: inc dhudmessage.inc (3.4 KB, 177 views)
__________________
Preparing to release my plugins..
r0ck 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 10:06.


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