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

[HELP]Tags Teams


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-14-2009 , 06:36   [HELP]Tags Teams
Reply With Quote #1

hello, I dont know what is wrong with this code, because when I choose the menu option it gives only 1 player from each team and not all ...:/

Code...

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "#8 SickneSS"

new tagTttagTtSidetagCttagCtSide
new g_tagsON

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("say /menu","Menu",ADMIN_CVAR)
    
register_concmd("mm_tag","cmdTags",ADMIN_CVAR)
    
g_tagsON register_cvar("mm_enable_tags","0")    
    
tagTt register_cvar("mm_tagtt","Terrrorist")
    
tagCt register_cvar("mm_tagct","Counter-Terrorist")
    
tagTtSide register_cvar("mm_tagtt_side","0")
    
tagCtSide register_cvar("mm_tagct_side","1")        
    
}
public 
cmdTags(id) {
    
    if(
get_pcvar_num(g_tagsON) == 1){ 
    new 
NNick[32]
    new 
Tt[32
    new 
Ct[32]
    new 
Name[32]
    new 
Team[32]
    
    
get_user_team(id,Team,31)
    
get_user_name(id,Name,31
    
get_pcvar_string(tagTtTt31)
    
get_pcvar_string(tagCtCt31)

    if (
strcmp(Team,"TERRORIST") == || strcmp(Team,"@terrorist") == )
    {    
        
    if (
containi(Name,Tt) != -)
    return 
PLUGIN_HANDLED 
    
    
if (get_pcvar_num(tagTtSide) == 1)
    {
        
format(NNick31"%s%s"NameTt)
        
set_user_info(id"name"NNick)
    }
    else
    {
        
format(NNick31"%s%s"TtName)
        
set_user_info(id"name"NNick)    
    }
    
    
client_print(id,print_chat,"The new tag for Terrorists is %s.",Tt)
    
    return 
PLUGIN_HANDLED
    
    
}

    if (
strcmp(Team,"CT") == || strcmp(Team,"@counter") == 0)
    {
        
    if (
containi(Name,Ct) != -)
        return 
PLUGIN_HANDLED 
        
    
if (get_pcvar_num(tagCtSide) == 1)
    {
        
format(NNick31"%s%s"NameCt)
        
set_user_info(id"name"NNick)
    }
    else
    {
        
format(NNick31"%s%s"CtName)
        
set_user_info(id"name"NNick)
    }        
    
    
client_print(id,print_chat,"The new tag for Counter-Terrorists is %s.",Ct

    return 
PLUGIN_HANDLED
    
    
}
    return 
PLUGIN_HANDLED
}
    return 
PLUGIN_HANDLED
}
public 
Menu(id,level,cid) {
    if ( !
cmd_access(idlevelcid1))
    return 
PLUGIN_HANDLED
    
new menu menu_create("Menu","menu_handler")
    
menu_additem(menu"Switch tags on teams""1"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_CONTINUE
    
}
    
    new 
iData[6];
    new 
iAccess;
    new 
iCallback;
    new 
iName[64];
    
menu_item_getinfo(menuitemiAccessiData5iName63iCallback)
    
    switch (
str_to_num(iData))
    {
        case 
1:
        {    
            
            for(new 
1<= get_maxplayers(); ++)
            {
            if(
is_user_connected(i))
            
cmdTags(i)
            
menu_destroy(menu)
        }
        }    
    }
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED 

ps : sorry for my bad english ... im from argentina

Thanks

Last edited by #8 SickneSS; 09-14-2009 at 08:59.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
vitorrd
Senior Member
Join Date: Jul 2009
Old 09-14-2009 , 08:52   Re: [HELP]Tags Teams
Reply With Quote #2

Is it really that hard to indent codes decently?
About the code, it is being called for every connected player. I'll give you a wild guess and tell you that some exception is being thrown when you try to destroy the menu over and over again. Shouldn't it be destroyed only once?
vitorrd is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-14-2009 , 08:54   Re: [HELP]Tags Teams
Reply With Quote #3

Quote:
Originally Posted by vitorrd View Post
Is it really that hard to indent codes decently?
i seek help nothing more
the code is perfect ...
The only mistake is the appointed

thanks!

-edit-

this code it out of my mixmaker, separating it just for not post the code again

Last edited by #8 SickneSS; 09-14-2009 at 08:58.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
vitorrd
Senior Member
Join Date: Jul 2009
Old 09-14-2009 , 08:58   Re: [HELP]Tags Teams
Reply With Quote #4

Read my full reply.
vitorrd 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 08:08.


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