use coloredMenus instead of cstrikeRunning

This commit is contained in:
Felix Geyer 2004-07-26 15:48:12 +00:00
parent db726a5ba2
commit 9d0481e7df
8 changed files with 187 additions and 201 deletions

View File

@ -40,7 +40,7 @@ new g_optionName[4][32]
new g_voteCount[4] new g_voteCount[4]
new g_validMaps new g_validMaps
new g_yesNoVote new g_yesNoVote
new g_cstrikeRunning new g_coloredMenus
new g_voteCaller new g_voteCaller
new g_Execute[256] new g_Execute[256]
new g_execLen new g_execLen
@ -66,7 +66,7 @@ public plugin_init() {
register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>") register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>")
register_concmd("amx_vote","cmdVote",ADMIN_VOTE,"<question> <answer#1> <answer#2>") register_concmd("amx_vote","cmdVote",ADMIN_VOTE,"<question> <answer#1> <answer#2>")
register_concmd("amx_cancelvote","cmdCancelVote",ADMIN_VOTE,"- cancels last vote") register_concmd("amx_cancelvote","cmdCancelVote",ADMIN_VOTE,"- cancels last vote")
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
} }
public cmdCancelVote(id,level,cid){ public cmdCancelVote(id,level,cid){
@ -140,8 +140,8 @@ public checkVotes() {
g_execResult = false g_execResult = false
if ( is_user_connected(g_voteCaller) ) { if ( is_user_connected(g_voteCaller) ) {
new menuBody[512] new menuBody[512]
new len = format(menuBody,511,g_cstrikeRunning ? "\yThe result: \w%s^n^n" : "The result: %s^n^n", g_Execute ) new len = format(menuBody,511,g_coloredMenus ? "\yThe result: \w%s^n^n" : "The result: %s^n^n", g_Execute )
len += copy( menuBody[len] ,511 - len, g_cstrikeRunning ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" ) len += copy( menuBody[len] ,511 - len, g_coloredMenus ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" )
copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No") copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No")
show_menu( g_voteCaller ,0x03 ,menuBody, 10 ) show_menu( g_voteCaller ,0x03 ,menuBody, 10 )
set_task(10.0,"autoRefuse",4545454) set_task(10.0,"autoRefuse",4545454)
@ -199,7 +199,7 @@ public cmdVoteMap(id,level,cid) {
new keys = 0 new keys = 0
if (g_validMaps > 1){ if (g_validMaps > 1){
keys = (1<<9) keys = (1<<9)
copy(menu_msg,255,g_cstrikeRunning ? "\yChoose map: \w^n^n" : "Choose map: ^n^n") copy(menu_msg,255,g_coloredMenus ? "\yChoose map: \w^n^n" : "Choose map: ^n^n")
new temp[128] new temp[128]
for(new a = 0; a < g_validMaps; ++a){ for(new a = 0; a < g_validMaps; ++a){
format(temp,127,"%d. %s^n",a+1,g_optionName[a]) format(temp,127,"%d. %s^n",a+1,g_optionName[a])
@ -210,7 +210,7 @@ public cmdVoteMap(id,level,cid) {
g_yesNoVote = 0 g_yesNoVote = 0
} }
else{ else{
format(menu_msg,255,g_cstrikeRunning ? "\yChange map to %s?\w^n^n1. Yes^n2. No" format(menu_msg,255,g_coloredMenus ? "\yChange map to %s?\w^n^n1. Yes^n2. No"
: "Change map to %s?^n^n1. Yes^n2. No",g_optionName[0]) : "Change map to %s?^n^n1. Yes^n2. No",g_optionName[0])
keys = (1<<0)|(1<<1) keys = (1<<0)|(1<<1)
g_yesNoVote = 1 g_yesNoVote = 1
@ -282,7 +282,7 @@ public cmdVote(id,level,cid) {
new menu_msg[256] new menu_msg[256]
new keys = (1<<0)|(1<<1) new keys = (1<<0)|(1<<1)
format(menu_msg,255, g_cstrikeRunning ? "\yVote: %s\w^n^n1. %s^n2. %s" format(menu_msg,255, g_coloredMenus ? "\yVote: %s\w^n^n1. %s^n2. %s"
: "Vote: %s^n^n1. %s^n2. %s",quest,g_optionName[0],g_optionName[1]) : "Vote: %s^n^n1. %s^n2. %s",quest,g_optionName[0],g_optionName[1])
g_execResult = false g_execResult = false
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
@ -327,7 +327,7 @@ public cmdVoteKickBan(id,level,cid) {
new keys = (1<<0)|(1<<1) new keys = (1<<0)|(1<<1)
new menu_msg[256] new menu_msg[256]
get_user_name(player,arg,31) get_user_name(player,arg,31)
format(menu_msg,255,g_cstrikeRunning ? "\y%s %s?\w^n^n1. Yes^n2. No" format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. Yes^n2. No"
: "%s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg) : "%s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg)
g_yesNoVote = 1 g_yesNoVote = 1
if (voteban) if (voteban)

View File

@ -84,7 +84,7 @@ new g_menuSelect[33][64]
new g_menuSelectNum[33] new g_menuSelectNum[33]
new g_menuLayer[33] new g_menuLayer[33]
new g_cstrikeRunning new g_coloredMenus
public plugin_init() public plugin_init()
{ {
@ -107,7 +107,7 @@ public plugin_init()
format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini"); format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini");
loadCvarSettings(cvars_ini_file) loadCvarSettings(cvars_ini_file)
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
} }
/* Commands menu */ /* Commands menu */
@ -144,7 +144,7 @@ displayCmdMenu(id,pos){
if (start >= g_menuSelectNum[id]) if (start >= g_menuSelectNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511,g_cstrikeRunning ? new len = format(menuBody,511,g_coloredMenus ?
"\y%s\R%d/%d^n\w^n" : "%s %d/%d^n^n" , g_cmdMenuName[ g_menuLayer[id] ], "\y%s\R%d/%d^n\w^n" : "%s %d/%d^n^n" , g_cmdMenuName[ g_menuLayer[id] ],
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) ) pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
@ -158,7 +158,7 @@ displayCmdMenu(id,pos){
{ {
if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' ) if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' )
{ {
if ( g_cstrikeRunning) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%s^n\w",g_cmdName[ g_menuSelect[id][ a ] ] ) len += format(menuBody[len],511-len,"\d%s^n\w",g_cmdName[ g_menuSelect[id][ a ] ] )
else else
len += format(menuBody[len],511-len,"%s^n",g_cmdName[ g_menuSelect[id][ a ] ] ) len += format(menuBody[len],511-len,"%s^n",g_cmdName[ g_menuSelect[id][ a ] ] )
@ -310,7 +310,7 @@ displayCvarMenu(id,pos){
if (start >= g_menuSelectNum[id]) if (start >= g_menuSelectNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n",
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) ) pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
@ -326,7 +326,7 @@ displayCvarMenu(id,pos){
get_cvar_string( g_cvarNames[ g_menuSelect[id][ a ] ],szValue,31) get_cvar_string( g_cvarNames[ g_menuSelect[id][ a ] ],szValue,31)
keys |= (1<<b) keys |= (1<<b)
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"%d. %s\R%s^n\w", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue ) len += format(menuBody[len],511-len,"%d. %s\R%s^n\w", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )
else else
len += format(menuBody[len],511-len,"%d. %s %s^n", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue ) len += format(menuBody[len],511-len,"%d. %s %s^n", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )

View File

@ -47,7 +47,7 @@ new g_mapVoteNum
new g_teamScore[2] new g_teamScore[2]
new g_lastMap[32] new g_lastMap[32]
new g_cstrikeRunning new g_coloredMenus
new bool:g_selected = false new bool:g_selected = false
public plugin_init() public plugin_init()
@ -57,7 +57,7 @@ public plugin_init()
register_cvar("amx_extendmap_max","90") register_cvar("amx_extendmap_max","90")
register_cvar("amx_extendmap_step","15") register_cvar("amx_extendmap_step","15")
if ( ( g_cstrikeRunning = (is_running("cstrike")||is_running("czero")) ) != 0 ) if ( ( g_coloredMenus = colored_menus()
register_event("TeamScore", "team_score", "a") register_event("TeamScore", "team_score", "a")
get_localinfo("lastMap",g_lastMap,31) get_localinfo("lastMap",g_lastMap,31)
@ -142,7 +142,7 @@ public voteNextmap(){
return return
g_selected = true g_selected = true
new menu[512], a, mkeys = (1<<SELECTMAPS+1) new menu[512], a, mkeys = (1<<SELECTMAPS+1)
new pos = copy(menu,511,g_cstrikeRunning ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n") new pos = copy(menu,511,g_coloredMenus ? "\yAMX Choose nextmap:\w^n^n" : "AMX Choose nextmap:^n^n")
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){ for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
a=random_num(0,g_mapNums-1) a=random_num(0,g_mapNums-1)

View File

@ -46,7 +46,7 @@ new g_voteCount[5]
new g_voteSelected[33][4] new g_voteSelected[33][4]
new g_voteSelectedNum[33] new g_voteSelectedNum[33]
new g_cstrikeRunning new g_coloredMenus
new g_choosed new g_choosed
@ -69,7 +69,7 @@ public plugin_init()
format(maps_ini_file, 63, "mapcycle.txt") format(maps_ini_file, 63, "mapcycle.txt")
load_settings(maps_ini_file) load_settings(maps_ini_file)
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
} }
new g_resultAck[] = "Result accepted" new g_resultAck[] = "Result accepted"
@ -116,8 +116,8 @@ public checkVotes( id )
if ( g_choosed != -1 ) { if ( g_choosed != -1 ) {
if ( is_user_connected( id ) ) { if ( is_user_connected( id ) ) {
new menuBody[512] new menuBody[512]
new len = format(menuBody,511,g_cstrikeRunning ? "\yThe winner: \w%s^n^n" : "The winner: %s^n^n", g_mapName[ g_choosed ] ) new len = format(menuBody,511,g_coloredMenus ? "\yThe winner: \w%s^n^n" : "The winner: %s^n^n", g_mapName[ g_choosed ] )
len += copy( menuBody[len] ,511 - len, g_cstrikeRunning ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" ) len += copy( menuBody[len] ,511 - len, g_coloredMenus ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" )
copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No") copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No")
show_menu( id ,0x03 ,menuBody, 10 ) show_menu( id ,0x03 ,menuBody, 10 )
set_task(10.0,"autoRefuse",4545454) set_task(10.0,"autoRefuse",4545454)
@ -172,7 +172,7 @@ displayVoteMapsMenu(id,pos)
if (start >= g_mapNums) if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yVotemap Menu\R%d/%d^n\w^n" : "Votemap Menu %d/%d^n^n", "\yVotemap Menu\R%d/%d^n\w^n" : "Votemap Menu %d/%d^n^n",
pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) ) pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) )
@ -186,7 +186,7 @@ displayVoteMapsMenu(id,pos)
if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) ) if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) )
{ {
++b ++b
if ( g_cstrikeRunning) if ( g_coloredMenus)
len += format(menuBody[len],511-len,"\d%d. %s^n\w", b ,g_mapName[ a ]) len += format(menuBody[len],511-len,"\d%d. %s^n\w", b ,g_mapName[ a ])
else else
len += format(menuBody[len],511-len,"#. %s^n", g_mapName[ a ]) len += format(menuBody[len],511-len,"#. %s^n", g_mapName[ a ])
@ -204,7 +204,7 @@ displayVoteMapsMenu(id,pos)
len += format(menuBody[len],511-len,"^n8. Start Voting^n") len += format(menuBody[len],511-len,"^n8. Start Voting^n")
} }
else else
len += format(menuBody[len],511-len, g_cstrikeRunning ? len += format(menuBody[len],511-len, g_coloredMenus ?
"^n\d8. Start Voting^n\w" : "^n#. Start Voting^n") "^n\d8. Start Voting^n\w" : "^n#. Start Voting^n")
if (end != g_mapNums) if (end != g_mapNums)
@ -216,7 +216,7 @@ displayVoteMapsMenu(id,pos)
len += format(menuBody[len],511-len,"^n0. %s^n", pos ? "Back" : "Exit") len += format(menuBody[len],511-len,"^n0. %s^n", pos ? "Back" : "Exit")
len += format(menuBody[len],511-len, g_voteSelectedNum[id] ? len += format(menuBody[len],511-len, g_voteSelectedNum[id] ?
( g_cstrikeRunning ? "^n\ySelected Maps:^n\w" : "^nSelected Maps:^n") : "^n^n") ( g_coloredMenus ? "^n\ySelected Maps:^n\w" : "^nSelected Maps:^n") : "^n^n")
for(new c = 0; c < 4; c++) for(new c = 0; c < 4; c++)
{ {
@ -309,7 +309,7 @@ public actionVoteMapMenu(id,key)
if ( g_voteSelectedNum[id] > 1 ) if ( g_voteSelectedNum[id] > 1 )
{ {
len = format(menuBody,511,g_cstrikeRunning ? len = format(menuBody,511,g_coloredMenus ?
"\yWhich map do you want?^n\w^n" : "Which map do you want?^n^n") "\yWhich map do you want?^n\w^n" : "Which map do you want?^n^n")
for(new c = 0; c < g_voteSelectedNum[id] ; ++c) for(new c = 0; c < g_voteSelectedNum[id] ; ++c)
{ {
@ -321,7 +321,7 @@ public actionVoteMapMenu(id,key)
} }
else else
{ {
len = format(menuBody,511, g_cstrikeRunning ? "\yChange map to^n%s?^n\w^n1. Yes^n2. No^n" len = format(menuBody,511, g_coloredMenus ? "\yChange map to^n%s?^n\w^n1. Yes^n2. No^n"
: "Change map to^n%s?^n^n1. Yes^n2. No^n" , g_mapName[ g_voteSelected[id][ 0 ] ] ) : "Change map to^n%s?^n^n1. Yes^n2. No^n" , g_mapName[ g_voteSelected[id][ 0 ] ] )
keys = (1<<0) | (1<<1) keys = (1<<0) | (1<<1)
} }
@ -408,7 +408,7 @@ displayMapsMenu(id,pos)
if (start >= g_mapNums) if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yChangelevel Menu\R%d/%d^n\w^n" : "Changelevel Menu %d/%d^n^n", "\yChangelevel Menu\R%d/%d^n\w^n" : "Changelevel Menu %d/%d^n^n",
pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) ) pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) )

View File

@ -117,6 +117,7 @@ new g_menuAccess[MENUS_NUMBER][2] = {
{ADMIN_LEVEL_A,0} {ADMIN_LEVEL_A,0}
} }
new g_coloredMenus
new g_cstrikeRunning new g_cstrikeRunning
new g_funModule new g_funModule
@ -127,7 +128,8 @@ public plugin_init()
register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu") register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu")
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus") register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
g_cstrikeRunning = ( is_running("cstrike") || is_running("czero") )
g_funModule = is_module_loaded("Fun") g_funModule = is_module_loaded("Fun")
} }
@ -153,7 +155,7 @@ displayMenu(id,pos){
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, new len = format(menuBody,511,
g_cstrikeRunning ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos+1, 2 ) g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos+1, 2 )
new end = start + 8 new end = start + 8
new keys = (1<<9) new keys = (1<<9)
@ -176,7 +178,7 @@ displayMenu(id,pos){
else else
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len, "\d%d. %s^n\w",b, g_menuBody[ a ] ) len += format(menuBody[len],511-len, "\d%d. %s^n\w",b, g_menuBody[ a ] )
else else
len += format(menuBody[len],511-len, "#. %s^n",g_menuBody[ a ] ) len += format(menuBody[len],511-len, "#. %s^n",g_menuBody[ a ] )

View File

@ -51,7 +51,7 @@ new g_clcmdCmd[MAX_CLCMDS][64]
new g_clcmdMisc[MAX_CLCMDS][2] new g_clcmdMisc[MAX_CLCMDS][2]
new g_clcmdNum new g_clcmdNum
new g_cstrikeRunning new g_coloredMenus
public plugin_init() public plugin_init()
{ {
@ -68,7 +68,7 @@ public plugin_init()
register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu") register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu")
register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu")
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
new clcmds_ini_file[64]; new clcmds_ini_file[64];
get_configsdir(clcmds_ini_file, 63); get_configsdir(clcmds_ini_file, 63);
@ -145,7 +145,7 @@ displayBanMenu(id,pos){
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n", "\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
@ -163,7 +163,7 @@ displayBanMenu(id,pos){
if ( is_user_bot(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) if ( is_user_bot(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else else
len += format(menuBody[len],511-len,"#. %s^n",name) len += format(menuBody[len],511-len,"#. %s^n",name)
@ -282,7 +282,7 @@ displaySlapMenu(id,pos){
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" , "\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" ,
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
@ -301,7 +301,7 @@ displaySlapMenu(id,pos){
if ( !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) if ( !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team) len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team)
else else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team) len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
@ -311,7 +311,7 @@ displaySlapMenu(id,pos){
{ {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len],511-len, g_cstrikeRunning ? len += format(menuBody[len],511-len, g_coloredMenus ?
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team) "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
} }
} }
@ -393,7 +393,7 @@ displayKickMenu(id,pos){
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^n", "\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) ) pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
@ -411,7 +411,7 @@ displayKickMenu(id,pos){
if ( get_user_flags(i) & ADMIN_IMMUNITY ) if ( get_user_flags(i) & ADMIN_IMMUNITY )
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else else
len += format(menuBody[len],511-len,"#. %s^n",name) len += format(menuBody[len],511-len,"#. %s^n",name)
@ -500,7 +500,7 @@ displayTeamMenu(id,pos){
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n", "\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
@ -519,7 +519,7 @@ displayTeamMenu(id,pos){
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || (get_user_flags(i)&ADMIN_IMMUNITY) ) if ( (iteam == (g_menuOption[id] ? 1 : 2)) || (get_user_flags(i)&ADMIN_IMMUNITY) )
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team) len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team)
else else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team) len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
@ -528,7 +528,7 @@ displayTeamMenu(id,pos){
else else
{ {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len],511-len, g_cstrikeRunning ? len += format(menuBody[len],511-len, g_coloredMenus ?
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team) "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
} }
} }
@ -611,7 +611,7 @@ displayClcmdMenu(id,pos){
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_cstrikeRunning ? new len = format(menuBody,511, g_coloredMenus ?
"\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n", "\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
@ -629,7 +629,7 @@ displayClcmdMenu(id,pos){
if ( !g_menuSelectNum[id] || get_user_flags(i)&ADMIN_IMMUNITY ) if ( !g_menuSelectNum[id] || get_user_flags(i)&ADMIN_IMMUNITY )
{ {
++b ++b
if ( g_cstrikeRunning ) if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else else
len += format(menuBody[len],511-len,"#. %s^n",name) len += format(menuBody[len],511-len,"#. %s^n",name)

View File

@ -36,166 +36,150 @@
#include <amxmisc> #include <amxmisc>
#include <fun> #include <fun>
new g_menuPosition[33] new g_menuPosition[33]
new g_menuPlayers[33][32] new g_menuPlayers[33][32]
new g_menuPlayersNum[33] new g_menuPlayersNum[33]
new g_menuOption[33] = { -1 , ... } new g_menuOption[33] = { -1 , ... }
new g_menuOrgin[33][3] new g_menuOrgin[33][3]
new g_cstrikeRunning new g_coloredMenus
public plugin_init() public plugin_init() {
{ register_plugin("Teleport Menu","0.20","AMXX Dev Team")
register_plugin("Teleport Menu","0.20","AMXX Dev Team") register_clcmd("amx_teleportmenu","cmdTelMenu",ADMIN_CFG,"- displays teleport menu")
register_clcmd("amx_teleportmenu","cmdTelMenu",ADMIN_CFG,"- displays teleport menu") register_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")
register_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
} }
public actionTelMenu(id,key) public actionTelMenu(id,key) {
{ switch(key) {
switch(key){ case 6: {
case 6:{ g_menuOption[id] = 1 - g_menuOption[id]
g_menuOption[id] = 1 - g_menuOption[id] displayTelMenu(id,g_menuPosition[id])
displayTelMenu(id,g_menuPosition[id]) }
} case 7: {
case 7:{ if (g_menuOption[id] < 0) /* unlocking position for the first time */
if (g_menuOption[id] < 0) /* unlocking position for the first time */ g_menuOption[id] = 0
g_menuOption[id] = 0 get_user_origin(id,g_menuOrgin[id])
get_user_origin(id,g_menuOrgin[id]) displayTelMenu(id,g_menuPosition[id])
displayTelMenu(id,g_menuPosition[id]) }
} case 8: displayTelMenu(id,++g_menuPosition[id])
case 8: displayTelMenu(id,++g_menuPosition[id]) case 9: displayTelMenu(id,--g_menuPosition[id])
case 9: displayTelMenu(id,--g_menuPosition[id]) default: {
default:{ new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
new name2[32]
get_user_name(player,name2,31)
if (!is_user_alive(player))
{
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
displayTelMenu(id,g_menuPosition[id])
return PLUGIN_HANDLED
}
if (g_menuOption[id] > 0)
{
set_user_origin(player,g_menuOrgin[id])
}
else
{
new origin[3]
get_user_origin(id,origin)
set_user_origin(player,origin)
}
new authid[32],authid2[32], name[32]
get_user_authid(id,authid,31) new name2[32]
get_user_authid(player,authid2,31) get_user_name(player,name2,31)
get_user_name(id,name,31)
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2)
}
displayTelMenu(id,g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
if (!is_user_alive(player)) {
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
displayTelMenu(id,g_menuPosition[id])
return PLUGIN_HANDLED
}
displayTelMenu(id,pos){ if (g_menuOption[id] > 0) {
set_user_origin(player,g_menuOrgin[id])
}
else {
new origin[3]
get_user_origin(id,origin)
set_user_origin(player,origin)
}
if (pos < 0) new authid[32],authid2[32], name[32]
return
get_user_authid(id,authid,31)
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_user_authid(player,authid2,31)
get_user_name(id,name,31)
new menuBody[512]
new b = 0 log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
new i name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
new name[32]
new start = pos * 6 switch(get_cvar_num("amx_show_activity")) {
new bool:blockMenu = (is_user_alive(id)&&g_menuOption[id]<1) ? true : false case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2)
if (start >= g_menuPlayersNum[id]) }
start = pos = g_menuPosition[id] = 0
displayTelMenu(id,g_menuPosition[id])
new len = format(menuBody,511, g_cstrikeRunning ? }
"\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" , }
pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) ) return PLUGIN_HANDLED
}
new end = start + 6
new keys = (1<<9)|(1<<7) displayTelMenu(id,pos) {
if (pos < 0)
if (end > g_menuPlayersNum[id]) return
end = g_menuPlayersNum[id]
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
for(new a = start; a < end; ++a)
{ new menuBody[512]
i = g_menuPlayers[id][a] new b = 0
get_user_name(i,name,31) new i
new name[32]
if ( blockMenu || !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) new start = pos * 6
{ new bool:blockMenu = (is_user_alive(id)&&g_menuOption[id]<1) ? true : false
++b
if ( g_cstrikeRunning ) if (start >= g_menuPlayersNum[id])
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) start = pos = g_menuPosition[id] = 0
else
len += format(menuBody[len],511-len,"#. %s^n",name) new len = format(menuBody,511, g_coloredMenus ?
} "\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" ,
else pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
{
keys |= (1<<b) new end = start + 6
len += format(menuBody[len],511-len,"%d. %s^n",++b,name) new keys = (1<<9)|(1<<7)
}
} if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id]
if ( g_menuOption[id] > 0 ) // 1
{ for (new a = start; a < end; ++a) {
keys |= (1<<6) i = g_menuPlayers[id][a]
len += format(menuBody[len],511-len,"^n7. To location: %d %d %d^n", get_user_name(i,name,31)
g_menuOrgin[id][0],g_menuOrgin[id][1] ,g_menuOrgin[id][2])
} if ( blockMenu || !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) {
else if ( g_menuOption[id] ) // -1 ++b
{ if ( g_coloredMenus )
if ( g_cstrikeRunning ) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
len += format(menuBody[len],511-len,"^n\d7. Current Location^n\w")
else else
len += format(menuBody[len],511-len,"^n#. Current Location^n") len += format(menuBody[len],511-len,"#. %s^n",name)
} }
else // 0 else {
{ keys |= (1<<b)
keys |= (1<<6) len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
len += format(menuBody[len],511-len,"^n7. Current Location^n") }
} }
len += format(menuBody[len],511-len,"8. Save Location^n")
if (end != g_menuPlayersNum[id])
{
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
keys |= (1<<8)
}
else
format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
show_menu(id,keys,menuBody)
}
public cmdTelMenu(id,level,cid) if ( g_menuOption[id] > 0 ) { // 1
{ keys |= (1<<6)
if (cmd_access(id,level,cid,1)) len += format(menuBody[len],511-len,"^n7. To location: %d %d %d^n",
displayTelMenu(id,g_menuPosition[id] = 0) g_menuOrgin[id][0],g_menuOrgin[id][1] ,g_menuOrgin[id][2])
}
return PLUGIN_HANDLED else if ( g_menuOption[id] ) { // -1
} if ( g_coloredMenus )
len += format(menuBody[len],511-len,"^n\d7. Current Location^n\w")
else
len += format(menuBody[len],511-len,"^n#. Current Location^n")
}
else { // 0
keys |= (1<<6)
len += format(menuBody[len],511-len,"^n7. Current Location^n")
}
len += format(menuBody[len],511-len,"8. Save Location^n")
if (end != g_menuPlayersNum[id]) {
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
keys |= (1<<8)
}
else
format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
show_menu(id,keys,menuBody)
}
public cmdTelMenu(id,level,cid) {
if (cmd_access(id,level,cid,1))
displayTelMenu(id,g_menuPosition[id] = 0)
return PLUGIN_HANDLED
}

View File

@ -42,7 +42,7 @@
#define READ_FROM_FILE #define READ_FROM_FILE
//#define SHOW_TIME_AND_IP //#define SHOW_TIME_AND_IP
new g_cstrikeRunning new g_coloredMenus
#if defined READ_FROM_FILE #if defined READ_FROM_FILE
new g_motdFile[64] new g_motdFile[64]
@ -51,7 +51,7 @@ new g_motdFile[64]
public plugin_init() public plugin_init()
{ {
register_plugin("Welcome Message","0.20","AMXX Dev Team") register_plugin("Welcome Message","0.20","AMXX Dev Team")
g_cstrikeRunning = (is_running("cstrike") || is_running("czero")) g_coloredMenus = colored_menus()
#if defined READ_FROM_FILE #if defined READ_FROM_FILE
get_configsdir(g_motdFile, 63) get_configsdir(g_motdFile, 63)
format(g_motdFile, 63, "%s/conmotd.txt", g_motdFile) format(g_motdFile, 63, "%s/conmotd.txt", g_motdFile)
@ -108,7 +108,7 @@ public alt_motd(param[]) {
} }
// C4 and FF // C4 and FF
if ( g_cstrikeRunning ){ if ( g_coloredMenus ){
len += format(motdBody[len],MOTD_LENGTH-len,"<li>Friendly fire is %s</li>",get_cvar_num("mp_friendlyfire") ? "ON" : "OFF") len += format(motdBody[len],MOTD_LENGTH-len,"<li>Friendly fire is %s</li>",get_cvar_num("mp_friendlyfire") ? "ON" : "OFF")
len += format(motdBody[len],MOTD_LENGTH-len,"<li>C4 timer is set to %.0f sec.</li>",get_cvar_float("mp_c4timer")) len += format(motdBody[len],MOTD_LENGTH-len,"<li>C4 timer is set to %.0f sec.</li>",get_cvar_float("mp_c4timer"))
} }