Raised This Month: $ Target: $400
 0% 

Having a problem with my CD menu.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-24-2012 , 13:17   Re: Having a problem with my CD menu.
Reply With Quote #3

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <dhudmessage>

#define PLUGIN "CountDown Menu"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define TASKID  1996

new iCountDown

new pPlugin

new iMenuItems[3][33] = {
    
"CountDown Seconds",
    
"Freeze Terrorists",
    
"Start CountDown"
}

new 
iCountDownSeconds[4][33] = {
    
"5",
    
"10",
    
"15",
    
"30"
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /cd""Cmd_CountDown")
    
    
pPlugin register_cvar("cd_enable""1")
}

public 
Cmd_CountDown(iPlayer) {
    if(!
get_pcvar_num(pPlugin))
        return 
PLUGIN_HANDLED
        
    
if(cs_get_user_team(iPlayer) == CS_TEAM_CT) {
        new 
menu menu_create("\r[ \y Advanced \r] \yCountDown Menu:""CountDown_handler")
        
        new 
szTemp[200], Key[10]
        for(new 
0sizeof(iMenuItems); i++) {
            
formatex(szTempcharsmax(szTemp), "%s"iMenuItems[i])
            
num_to_str(iKeycharsmax(Key))
            
menu_additem(menuszTempKey)
        }
        
menu_display(iPlayermenu)
    }
    else if(
cs_get_user_team(iPlayer) != CS_TEAM_CT) {
        
ColorChat(iPlayerGREEN"[CountDown]^x01 You need to be a^x03 CT^x01 to do this!")
    }
    return 
PLUGIN_CONTINUE
}

public 
CountDown_handler(iPlayermenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    if(
is_user_alive(iPlayer)) {
        switch(
item) {
            case 
0Cmd_CountDownSub(iPlayer)
            case 
1Cmd_FreezePlayers(iPlayer)
            case 
2set_task(1.0"Cmd_StartCountDown"TASKID__"a"iCountDown)
        }
    }
    else {
        
ColorChat(iPlayerGREEN"[CountDown]^x01 You need to be alive to do this!")
    }
    return 
PLUGIN_CONTINUE
}

public 
Cmd_CountDownSub(iPlayer) {
    
    new 
menu menu_create("CountDown Seconds""CountDownSeconds_handler")
    new 
szTemp[200], Key[10]
    
    for(new 
0sizeof(iCountDownSeconds); i++) {
        
formatex(szTempcharsmax(szTemp), "%s"iCountDownSeconds[i])
        
num_to_str(iKeycharsmax(Key))
        
menu_additem(menuszTempKey)
    }
    
menu_display(iPlayermenu)
}

public 
CountDownSeconds_handler(iPlayermenuitem) {
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        
Cmd_CountDown(iPlayer)
        return 
PLUGIN_HANDLED
    
}
    
    if(
is_user_alive(iPlayer)) {
        switch(
item) {
            case 
0iCountDown 5
            
case 1iCountDown 10
            
case 2iCountDown 15
            
case 3iCountDown 30
        
}
    }
    
    
Cmd_CountDown(iPlayer)
    
    return 
PLUGIN_CONTINUE
}
// Not done "Cmd_FreezePlayers"
public Cmd_FreezePlayers(iPlayer) {
    
}

public 
Cmd_StartCountDown(iPlayer) {
    if(
task_exists(TASKID)) {
        return 
PLUGIN_HANDLED
    
}
    if(
iCountDown <= 0) {
        
set_hudmessage(02550, -1.00.5025.08.00.00.010)
        
show_hudmessage(0"Go Go Go!"
    }
    
    else {
        
set_hudmessage1201201200.500.5000.10.80.10.1, -)
        
show_hudmessage(0"%i"iCountDown--)
    }
    return 
PLUGIN_CONTINUE
        

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
 



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 07:54.


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