Monthly Target: $400 Donations: $13
 3% 

[HELP] Jointeam 02 (Problem!)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DreamWorks
Senior Member
Join Date: Mar 2012
Old 04-16-2012 , 13:35   [HELP] Jointeam 02 (Problem!)
Reply With Quote #1

Hello! everybody..
My plugin blocks users from acceding to : CT Team... but the problem is that the plugin don't block users when they write in the console: "jointeam 02" they can join CT Team, so how to block them from using this command?

PHP Code:
new const PLUGIN[]  = "Team Locker";
new const 
VERSION[] = "1.0"
new const AUTHOR[]  = "Drekes";

#include <amxmodx>
#include <amxmisc> 
#include <cstrike> 

#define TE 0
#define CT 1
#define AUTO 4
#define SPEC 5

new const Teamnames[6][] = {
    
"Terrorists",
    
"Counter-Terrorists",
    
"",
    
"",
    
"Auto",
    
"Spectator"
}

new 
bool:blockjoining[6

new 
amx_show_activity

public plugin_init() { 
        
register_plugin(PLUGINVERSIONAUTHOR);
    
register_dictionary("teamlocker.txt")

    
register_cvar("teamlocker",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY);    
    
register_menucmd(register_menuid("Team_Select",1), (1<<0)|(1<<1)|(1<<4)|(1<<5), "team_select"); 
        
    
register_clcmd("jointeam""join_team");
    
    
register_concmd("amxx_lockit""admin_lock"ADMIN_BAN,"- <CT/T/Auto/Spec> Locks a team");
}
    public 
plugin_cfg()
{
    
amx_show_activity get_cvar_pointer("amx_show_activity");
}

public 
admin_lock(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
    return 
PLUGIN_HANDLED
    
    
new Arg1[6]
    
    
read_argv(1Arg15)
    
    if(!
equali(Arg1"T") && !equali(Arg1"CT") && !equali(Arg1"Auto") && !equali(Arg1"Spec"))
    {
        
client_print(idprint_console"%L"LANG_PLAYER"TEAM_INVALID")
        return 
PLUGIN_HANDLED
    
}
    
    new 
team
    
    
if(equali(Arg1"T"))
        
team TE
    
else if(equali(Arg1"CT"))
        
team CT
    
else if(equali(Arg1"Auto"))
        
team AUTO
    
else if(equali(Arg1"Spec"))
        
team SPEC
        
    blockjoining
[team] = true
    
    
new name[32], steamid[38]
    
    
get_user_name(idname31)
    
get_user_authid(idsteamid37)
    
    switch(
get_pcvar_num(amx_show_activity)) {
        case 
2:    client_print(0,print_chat,"%L"LANG_PLAYER"TEAM_LOCK_CASE2",name,Teamnames[team])
        case 
1:    client_print(0,print_chat,"%L"LANG_PLAYER"TEAM_LOCK_CASE1",Teamnames[team])
    }

    
console_print(id,"%L"LANG_PLAYER"TEAM_LOCK_CONSOLE",Teamnames[team])
    
log_amx("%L"LANG_SERVER"LOCK_TEAMS_LOG"name,steamid,Teamnames[team])

    return 
PLUGIN_HANDLED
}

public 
team_select(idkey

    if ( 
blockjoining[key] == true && get_players2() >= )
    {
        
engclient_cmd(id"chooseteam"
        return 
PLUGIN_HANDLED 
    
}         
    
    return 
PLUGIN_CONTINUE 


get_players2()

    static 
Players_ActivosCsTeams:Team
    Players_Activos 

    
new Maxplayers get_maxplayers()
    for(new 
1<= Maxplayersi++) 
    { 
        if(!
is_user_connected(i)) continue  
        
        
Team cs_get_user_team(i
        
        if(
Team == CS_TEAM_CT
        { 
            
Players_Activos++ 
        } 
        
    } 
    return 
Players_Activos 

}

public 
join_team(id
{
        if (
is_user_admin(id))
    {
        
remove_task(id)
        return 
PLUGIN_CONTINUE
    
}
        if( 
get_players2() == )
        {
           
remove_task(id)
           return 
PLUGIN_CONTINUE
    
}
    
    new 
arg[2
        
read_argv(1arg1)
    
        if (
blockjoining[str_to_num(arg)-1] == true)
    {
                
engclient_cmd(id"chooseteam"
                return 
PLUGIN_HANDLED 
        

    
        return 
PLUGIN_CONTINUE 


Last edited by DreamWorks; 04-16-2012 at 13:36.
DreamWorks is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-16-2012 , 13:56   Re: [HELP] Jointeam 02 (Problem!)
Reply With Quote #2

Don't start multiple threads about the same problem, just post in your original thread until someone helps you.
__________________
wickedd is offline
Reply


Thread Tools
Display Modes

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:05.


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