AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CountDown Only for CT (https://forums.alliedmods.net/showthread.php?t=222062)

MrKiller2010 07-29-2013 11:32

CountDown Only for CT
 
Alright i have a countdown menu which should only be for players in CT which is alive..

PHP Code:

if (is_user_alive(id) && cs_get_user_team(id) & CS_TEAM_CT

But i don't get it why it doesn't work.
It works for everyone and even dead people.


PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Count down"
#define VERSION "1.1"
#define AUTHOR "UnKnown"
#define CS_TEAM_CT    3  
#define TASKID 1996

new Timer

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /cd""CmdMenu")
    
register_clcmd("say /tid""CmdMenu")
}

public 
CmdMenu(id)
{
    if (
is_user_alive(id) && cs_get_user_team(id) & CS_TEAM_CT)  
    {
    new 
menu menu_create("\rCountdown Menu!""MainMenuHandler"0)
    
    
menu_additem(menu"Timer \d#5""1")
    
menu_additem(menu"Timer \d#10""2")
    
menu_additem(menu"Timer \d#15""3")
    
menu_additem(menu"Timer \d#60""4")
    
menu_additem(menu"Timer \d#120""5")
    
menu_additem(menu"Timer \d#200""6")
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    }
}

public 
MainMenuHandler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], name[64], accescallback
    menu_item_getinfo
(menuitemaccesdatacharsmax(data), namecharsmax(name), callback)
    new 
key str_to_num(data)
    
    switch (
key)
    {
        case 
1Timer 5
            
case 2Timer 10
            
case 3Timer 15
            
case 4Timer 60
       
case 5Timer 120
       
case 6Timer 200
       
        
}
    
Countdown(id)
    return 
PLUGIN_HANDLED
}

public 
Countdown(id)
{
    if(
task_exists(TASKID))
        
remove_task(TASKID)

    
set_task(1.0"Countdown2"TASKID__"a"Timer)
}

public 
Countdown2(id
{
    if (
Timer == 1
    {
        
set_hudmessage(02550, -1.00.4001.01.00.11.02)
        
show_hudmessage(0"Time is up!"
    }
    else 
    {
        
set_hudmessage(02550, -1.00.3001.01.00.11.01)
        
show_hudmessage(0"Timer: %i"Timer--)
    }
    return 
PLUGIN_CONTINUE



guipatinador 07-29-2013 11:58

Re: CountDown Only for CT
 
PHP Code:

cs_get_user_team(id) == CS_TEAM_CT 


MrKiller2010 07-29-2013 13:11

Re: CountDown Only for CT
 
Quote:

Originally Posted by guipatinador (Post 2001472)
PHP Code:

cs_get_user_team(id) == CS_TEAM_CT 


Now /cd doesn't works for anyone.

Have i done anything wrong?

PHP Code:

public CmdMenu(id)
{
    if(
is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
    
   {    
    new 
menu menu_create("\rCountdown Menu!""MainMenuHandler"0)
    
    
menu_additem(menu"Timer \d#5""1")
    
menu_additem(menu"Timer \d#10""2")
    
menu_additem(menu"Timer \d#15""3")
    
menu_additem(menu"Timer \d#60""4")
    
menu_additem(menu"Timer \d#120""5")
    
menu_additem(menu"Timer \d#200""6")
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    }
    else
    {
        
ColorChat(idGREY"^03[SWE-KUNG]^01 Only^03 Alive CTs^01 can open this menu.")
    }



EpicMonkey 07-29-2013 13:34

Re: CountDown Only for CT
 
Code:
if( is_user_alive ( id ) && cs_get_user_team( id ) == CS_TEAM_CT )

MrKiller2010 07-29-2013 13:40

Re: CountDown Only for CT
 
Quote:

Originally Posted by EpicMonkey (Post 2001530)
Code:
if( is_user_alive ( id ) && cs_get_user_team( id ) == CS_TEAM_CT )

Now i get the colorchat messages but when it wont open for CTs..

wickedd 07-29-2013 13:54

Re: CountDown Only for CT
 
Delete
PHP Code:

#define CS_TEAM_CT    3 

It's not needed, plus it's wrong.

0 = Unassigned
1 = Terrorist
2 = Counter Terrorist
3 = Spectator

r3p 07-30-2013 03:32

Re: CountDown Only for CT
 
if(get_user_team(id) = 1) // tero 2-ct 3-spec !

ConnorMcLeod 07-30-2013 03:48

Re: CountDown Only for CT
 
Quote:

Originally Posted by r3p (Post 2001969)
if(get_user_team(id) = 1) // tero 2-ct 3-spec !

Please learn before trying to help, you assign instead of checking.

MrKiller2010 07-30-2013 03:54

Re: CountDown Only for CT
 
Thanks but i have fixed it! :)
THanks for the help.
Also i hope you check my other threads! I need help.


All times are GMT -4. The time now is 15:51.

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