DreamWorks |
04-16-2012 13:35 |
[HELP] Jointeam 02 (Problem!)
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(PLUGIN, VERSION, AUTHOR); 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(id, level, cid) { if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new Arg1[6] read_argv(1, Arg1, 5) if(!equali(Arg1, "T") && !equali(Arg1, "CT") && !equali(Arg1, "Auto") && !equali(Arg1, "Spec")) { client_print(id, print_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(id, name, 31) get_user_authid(id, steamid, 37) 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(id, key) { if ( blockjoining[key] == true && get_players2() >= 1 ) { engclient_cmd(id, "chooseteam") return PLUGIN_HANDLED } return PLUGIN_CONTINUE }
get_players2() { static Players_Activos, CsTeams:Team Players_Activos = 0 new Maxplayers = get_maxplayers() for(new i = 1; i <= Maxplayers; i++) { 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() == 0 ) { remove_task(id) return PLUGIN_CONTINUE } new arg[2] read_argv(1, arg, 1) if (blockjoining[str_to_num(arg)-1] == true) { engclient_cmd(id, "chooseteam") return PLUGIN_HANDLED } return PLUGIN_CONTINUE }
|