New plmenu

This commit is contained in:
David Anderson 2005-09-11 04:31:13 +00:00
parent 760e29e531
commit 138b732e75

View File

@ -32,15 +32,9 @@
* version. * version.
*/ */
//Uncomment to enable cstrike specific features
// #define CSTRIKE 1
#include <amxmodx> #include <amxmodx>
#include <amxmisc> #include <amxmisc>
#if defined CSTRIKE
#include <cstrike> #include <cstrike>
#endif
new g_menuPosition[33] new g_menuPosition[33]
new g_menuPlayers[33][32] new g_menuPlayers[33][32]
@ -59,6 +53,12 @@ new g_clcmdMisc[MAX_CLCMDS][2]
new g_clcmdNum new g_clcmdNum
new g_coloredMenus new g_coloredMenus
new g_cstrike = 0
public plugin_natives()
{
set_module_filter("module_filter")
}
public plugin_init() { public plugin_init() {
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team") register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team")
@ -85,6 +85,16 @@ public plugin_init() {
get_configsdir(clcmds_ini_file, 63) get_configsdir(clcmds_ini_file, 63)
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
if (module_exists("cstrike"))
g_cstrike = 1
}
public module_filter(const module[])
{
if (equali(module, "cstrike"))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
} }
/* Ban menu */ /* Ban menu */
@ -303,18 +313,19 @@ displaySlapMenu(id,pos) {
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a) {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i,name,31) get_user_name(i,name,31)
#if defined CSTRIKE if (g_cstrike)
if (cs_get_user_team(i) == CS_TEAM_T) {
{ if (cs_get_user_team(i) == CS_TEAM_T)
{
copy(team, 3, "CT") copy(team, 3, "CT")
} else if (cs_get_user_team(i) == CS_TEAM_CT) { } else if (cs_get_user_team(i) == CS_TEAM_CT) {
copy(team, 3, "TE") copy(team, 3, "TE")
} else { } else {
get_user_team(i,team,3) get_user_team(i,team,3)
} }
#else } else {
get_user_team(i,team,3) get_user_team(i,team,3)
#endif }
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) { if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) {
++b ++b
@ -476,15 +487,16 @@ public actionTeamMenu(id,key) {
case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" ) case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
} }
#if defined CSTRIKE if (g_cstrike)
cs_set_user_team(player, g_menuOption[id] ? 1 : 2) {
#else cs_set_user_team(player, g_menuOption[id] ? 1 : 2)
new limit_setting = get_cvar_num("mp_limitteams") } else {
set_cvar_num("mp_limitteams", 0) new limit_setting = get_cvar_num("mp_limitteams")
engclient_cmd(player, "jointeam", g_menuOption[id] ? "1" : "2") set_cvar_num("mp_limitteams", 0)
engclient_cmd(player, "joinclass", "1") engclient_cmd(player, "jointeam", g_menuOption[id] ? "1" : "2")
set_cvar_num("mp_limitteams", limit_setting) engclient_cmd(player, "joinclass", "1")
#endif set_cvar_num("mp_limitteams", limit_setting)
}
displayTeamMenu(id,g_menuPosition[id]) displayTeamMenu(id,g_menuPosition[id])
} }
@ -520,18 +532,19 @@ displayTeamMenu(id,pos) {
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a) {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i,name,31) get_user_name(i,name,31)
#if defined CSTRIKE if (g_cstrike)
iteam = _:cs_get_user_team(i) {
if (iteam == 1) { iteam = _:cs_get_user_team(i)
if (iteam == 1) {
copy(team, 3, "CT") copy(team, 3, "CT")
} else if (iteam == 2) { } else if (iteam == 2) {
copy(team, 3, "TE") copy(team, 3, "TE")
} else { } else {
get_user_team(i,team,3) get_user_team(i,team,3)
} }
#else } else {
iteam = get_user_team(i,team,3) iteam = get_user_team(i,team,3)
#endif }
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) { if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) {
++b ++b