updated to use the multi-lingual system | better code style
This commit is contained in:
parent
80a32b6d08
commit
a8dab8993e
@ -53,35 +53,37 @@ new g_clcmdNum
|
|||||||
|
|
||||||
new g_coloredMenus
|
new g_coloredMenus
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
|
register_dictionary("plmenu.txt")
|
||||||
|
register_dictionary("common.txt")
|
||||||
|
|
||||||
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
|
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
|
||||||
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
|
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
|
||||||
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
|
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
|
||||||
register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
|
register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
|
||||||
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu")
|
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu")
|
||||||
|
|
||||||
register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu")
|
register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu")
|
||||||
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu")
|
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu")
|
||||||
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu")
|
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu")
|
||||||
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_coloredMenus = colored_menus()
|
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)
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ban menu */
|
/* Ban menu */
|
||||||
|
|
||||||
public actionBanMenu(id,key)
|
public actionBanMenu(id,key) {
|
||||||
{
|
switch (key) {
|
||||||
switch(key){
|
case 7: {
|
||||||
case 7:{
|
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= 3
|
g_menuOption[id] %= 3
|
||||||
|
|
||||||
@ -93,9 +95,9 @@ public actionBanMenu(id,key)
|
|||||||
|
|
||||||
displayBanMenu(id,g_menuPosition[id])
|
displayBanMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayBanMenu(id,++g_menuPosition[id])
|
case 8: displayBanMenu(id,++g_menuPosition[id])
|
||||||
case 9: displayBanMenu(id,--g_menuPosition[id])
|
case 9: displayBanMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
|
|
||||||
new name[32], name2[32], authid[32],authid2[32]
|
new name[32], name2[32], authid[32],authid2[32]
|
||||||
@ -104,34 +106,32 @@ public actionBanMenu(id,key)
|
|||||||
get_user_authid(player,authid2,31)
|
get_user_authid(player,authid2,31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id,name,31)
|
||||||
new userid2 = get_user_userid(player)
|
new userid2 = get_user_userid(player)
|
||||||
|
|
||||||
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")",
|
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")",
|
||||||
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
|
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
|
||||||
|
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,name2)
|
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2)
|
||||||
case 1: client_print(0,print_chat,"ADMIN: ban %s",name2)
|
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (equal("4294967295",authid2)){ /* lan */
|
if (equal("4294967295",authid2)) { /* lan */
|
||||||
new ipa[32]
|
new ipa[32]
|
||||||
get_user_ip(player,ipa,31,1)
|
get_user_ip(player,ipa,31,1)
|
||||||
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
|
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
|
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
|
||||||
|
|
||||||
server_exec()
|
server_exec()
|
||||||
|
|
||||||
displayBanMenu(id,g_menuPosition[id])
|
displayBanMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayBanMenu(id,pos) {
|
||||||
displayBanMenu(id,pos){
|
|
||||||
|
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||||
@ -146,88 +146,81 @@ displayBanMenu(id,pos){
|
|||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n",
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
||||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
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 ( is_user_bot(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) {
|
||||||
{
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
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)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuSettings[id] )
|
if ( g_menuSettings[id] )
|
||||||
len += format(menuBody[len],511-len,"^n8. Ban for %d minutes^n" , g_menuSettings[id] )
|
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id] )
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. Ban permanently^n" )
|
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_PERM" )
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id]) {
|
||||||
{
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"Ban Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdBanMenu(id,level,cid)
|
public cmdBanMenu(id,level,cid) {
|
||||||
{
|
if (!cmd_access(id,level,cid,1))
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 1
|
g_menuOption[id] = 1
|
||||||
g_menuSettings[id] = 5
|
g_menuSettings[id] = 5
|
||||||
displayBanMenu(id,g_menuPosition[id] = 0)
|
displayBanMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Slap/Slay */
|
/* Slap/Slay */
|
||||||
|
|
||||||
public actionSlapMenu(id,key)
|
public actionSlapMenu(id,key) {
|
||||||
{
|
switch (key) {
|
||||||
switch(key){
|
case 7: {
|
||||||
case 7:{
|
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= 4
|
g_menuOption[id] %= 4
|
||||||
switch(g_menuOption[id]){
|
switch (g_menuOption[id]) {
|
||||||
case 1: g_menuSettings[id] = 0
|
case 1: g_menuSettings[id] = 0
|
||||||
case 2: g_menuSettings[id] = 1
|
case 2: g_menuSettings[id] = 1
|
||||||
case 3: g_menuSettings[id] = 5
|
case 3: g_menuSettings[id] = 5
|
||||||
}
|
}
|
||||||
displaySlapMenu(id,g_menuPosition[id])
|
displaySlapMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displaySlapMenu(id,++g_menuPosition[id])
|
case 8: displaySlapMenu(id,++g_menuPosition[id])
|
||||||
case 9: displaySlapMenu(id,--g_menuPosition[id])
|
case 9: displaySlapMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
|
|
||||||
new name2[32]
|
new name2[32]
|
||||||
get_user_name(player,name2,31)
|
get_user_name(player,name2,31)
|
||||||
|
|
||||||
if (!is_user_alive(player))
|
if (!is_user_alive(player)) {
|
||||||
{
|
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
|
||||||
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
|
|
||||||
displaySlapMenu(id,g_menuPosition[id])
|
displaySlapMenu(id,g_menuPosition[id])
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
@ -241,17 +234,17 @@ public actionSlapMenu(id,key)
|
|||||||
if ( g_menuOption[id] ) {
|
if ( g_menuOption[id] ) {
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
|
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
|
||||||
name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 )
|
name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 )
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: slap %s with %d damage",name,name2,g_menuSettings[id])
|
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_2",name,name2,g_menuSettings[id])
|
||||||
case 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",name2,g_menuSettings[id])
|
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,g_menuSettings[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
|
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch(get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: slay %s",name,name2)
|
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2)
|
||||||
case 1: client_print(0,print_chat,"ADMIN: slay %s",name2)
|
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,79 +260,74 @@ public actionSlapMenu(id,key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
displaySlapMenu(id,pos){
|
displaySlapMenu(id,pos) {
|
||||||
|
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
new i
|
new i
|
||||||
new name[32], team[4]
|
new name[32], team[4]
|
||||||
new start = pos * 7
|
new start = pos * 7
|
||||||
|
|
||||||
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_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" ,
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
||||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
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)
|
||||||
get_user_team(i,team,3)
|
get_user_team(i,team,3)
|
||||||
|
|
||||||
if ( !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) {
|
||||||
{
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
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)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
|
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ?
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuOption[id] )
|
if ( g_menuOption[id] )
|
||||||
len += format(menuBody[len],511-len,"^n8. Slap with %d damage^n",g_menuSettings[id] )
|
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAP_WITH_DMG",g_menuSettings[id] )
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. Slay^n")
|
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAY")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id]) {
|
||||||
{
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"Slap/Slay Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdSlapMenu(id,level,cid)
|
public cmdSlapMenu(id,level,cid)
|
||||||
{
|
{
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
g_menuSettings[id] = 0
|
g_menuSettings[id] = 0
|
||||||
|
|
||||||
displaySlapMenu(id,g_menuPosition[id] = 0)
|
displaySlapMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,27 +335,27 @@ public cmdSlapMenu(id,level,cid)
|
|||||||
|
|
||||||
public actionKickMenu(id,key)
|
public actionKickMenu(id,key)
|
||||||
{
|
{
|
||||||
switch(key){
|
switch (key) {
|
||||||
case 8: displayKickMenu(id,++g_menuPosition[id])
|
case 8: displayKickMenu(id,++g_menuPosition[id])
|
||||||
case 9: displayKickMenu(id,--g_menuPosition[id])
|
case 9: displayKickMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
||||||
|
|
||||||
new authid[32],authid2[32], name[32], name2[32]
|
new authid[32],authid2[32], name[32], name2[32]
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id,authid,31)
|
||||||
get_user_authid(player,authid2,31)
|
get_user_authid(player,authid2,31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id,name,31)
|
||||||
get_user_name(player,name2,31)
|
get_user_name(player,name2,31)
|
||||||
new userid2 = get_user_userid(player)
|
new userid2 = get_user_userid(player)
|
||||||
|
|
||||||
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
|
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
|
||||||
name,get_user_userid(id),authid, name2,userid2,authid2 )
|
name,get_user_userid(id),authid, name2,userid2,authid2 )
|
||||||
|
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2)
|
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2)
|
||||||
case 1: client_print(0,print_chat,"ADMIN: kick %s",name2)
|
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
server_cmd("kick #%d",userid2)
|
server_cmd("kick #%d",userid2)
|
||||||
server_exec()
|
server_exec()
|
||||||
|
|
||||||
@ -377,39 +365,35 @@ public actionKickMenu(id,key)
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayKickMenu(id,pos) {
|
||||||
displayKickMenu(id,pos){
|
|
||||||
|
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
new i
|
new i
|
||||||
new name[32]
|
new name[32]
|
||||||
new start = pos * 8
|
new start = pos * 8
|
||||||
|
|
||||||
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_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^n",
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
||||||
pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
|
id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 8
|
new end = start + 8
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
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 ( get_user_flags(i) & ADMIN_IMMUNITY )
|
if ( access(i,ADMIN_IMMUNITY) ) {
|
||||||
{
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
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)
|
||||||
@ -417,58 +401,54 @@ displayKickMenu(id,pos){
|
|||||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
len += format(menuBody[len],511-len,"#. %s^n",name)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id]) {
|
||||||
{
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"Kick Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdKickMenu(id,level,cid)
|
public cmdKickMenu(id,level,cid) {
|
||||||
{
|
|
||||||
if (cmd_access(id,level,cid,1))
|
if (cmd_access(id,level,cid,1))
|
||||||
displayKickMenu(id,g_menuPosition[id] = 0)
|
displayKickMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Team menu */
|
/* Team menu */
|
||||||
|
|
||||||
public actionTeamMenu(id,key)
|
public actionTeamMenu(id,key) {
|
||||||
{
|
switch (key) {
|
||||||
switch(key){
|
case 7:{
|
||||||
case 7:{
|
|
||||||
g_menuOption[id] = 1 - g_menuOption[id]
|
g_menuOption[id] = 1 - g_menuOption[id]
|
||||||
displayTeamMenu(id,g_menuPosition[id])
|
displayTeamMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayTeamMenu(id,++g_menuPosition[id])
|
case 8: displayTeamMenu(id,++g_menuPosition[id])
|
||||||
case 9: displayTeamMenu(id,--g_menuPosition[id])
|
case 9: displayTeamMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
new authid[32],authid2[32], name[32], name2[32]
|
new authid[32],authid2[32], name[32], name2[32]
|
||||||
get_user_name(player,name2,31)
|
get_user_name(player,name2,31)
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id,authid,31)
|
||||||
get_user_authid(player,authid2,31)
|
get_user_authid(player,authid2,31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id,name,31)
|
||||||
|
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
|
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" )
|
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||||
|
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: transfer %s to %s",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
case 2: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_2",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||||
case 1: client_print(0,print_chat,"ADMIN: transfer %s to %s",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||||
}
|
}
|
||||||
|
|
||||||
new limitt = get_cvar_num("mp_limitteams")
|
new limitt = get_cvar_num("mp_limitteams")
|
||||||
set_cvar_num("mp_limitteams",0)
|
set_cvar_num("mp_limitteams",0)
|
||||||
user_kill(player,1)
|
user_kill(player,1)
|
||||||
@ -477,7 +457,7 @@ public actionTeamMenu(id,key)
|
|||||||
engclient_cmd(player, "menuselect", "5")
|
engclient_cmd(player, "menuselect", "5")
|
||||||
client_cmd(player,"slot1")
|
client_cmd(player,"slot1")
|
||||||
set_cvar_num("mp_limitteams",limitt)
|
set_cvar_num("mp_limitteams",limitt)
|
||||||
|
|
||||||
displayTeamMenu(id,g_menuPosition[id])
|
displayTeamMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,90 +465,83 @@ public actionTeamMenu(id,key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
displayTeamMenu(id,pos){
|
displayTeamMenu(id,pos) {
|
||||||
|
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
new i, iteam
|
new i, iteam
|
||||||
new name[32], team[4]
|
new name[32], team[4]
|
||||||
new start = pos * 7
|
new start = pos * 7
|
||||||
|
|
||||||
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_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n",
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
||||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
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)
|
||||||
iteam = get_user_team(i,team,3)
|
iteam = get_user_team(i,team,3)
|
||||||
|
|
||||||
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || (get_user_flags(i)&ADMIN_IMMUNITY) )
|
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) {
|
||||||
{
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
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)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ?
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len += format(menuBody[len],511-len,"^n8. Transfer to %s^n",g_menuOption[id] ? "TERRORIST" : "CT" )
|
len += format(menuBody[len],511-len,"^n8. %L^n",id,"TRANSF_TO",g_menuOption[id] ? "TERRORIST" : "CT" )
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id])
|
||||||
{
|
{
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"TEAM_MENU")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdTeamMenu(id,level,cid)
|
public cmdTeamMenu(id,level,cid) {
|
||||||
{
|
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
|
|
||||||
displayTeamMenu(id,g_menuPosition[id] = 0)
|
displayTeamMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client cmds menu */
|
/* Client cmds menu */
|
||||||
|
|
||||||
public actionClcmdMenu(id,key)
|
public actionClcmdMenu(id,key) {
|
||||||
{
|
switch (key) {
|
||||||
switch(key){
|
case 7:{
|
||||||
case 7:{
|
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= g_menuSelectNum[id]
|
g_menuOption[id] %= g_menuSelectNum[id]
|
||||||
displayClcmdMenu(id,g_menuPosition[id])
|
displayClcmdMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayClcmdMenu(id,++g_menuPosition[id])
|
case 8: displayClcmdMenu(id,++g_menuPosition[id])
|
||||||
case 9: displayClcmdMenu(id,--g_menuPosition[id])
|
case 9: displayClcmdMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
|
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
|
||||||
if (is_user_connected(player)) {
|
if (is_user_connected(player)) {
|
||||||
@ -580,7 +553,7 @@ public actionClcmdMenu(id,key)
|
|||||||
replace(command,63,"%userid%",userid)
|
replace(command,63,"%userid%",userid)
|
||||||
replace(command,63,"%authid%",authid)
|
replace(command,63,"%authid%",authid)
|
||||||
replace(command,63,"%name%",name)
|
replace(command,63,"%name%",name)
|
||||||
if (flags & 1){
|
if (flags & 1) {
|
||||||
server_cmd(command)
|
server_cmd(command)
|
||||||
server_exec()
|
server_exec()
|
||||||
}
|
}
|
||||||
@ -589,118 +562,108 @@ public actionClcmdMenu(id,key)
|
|||||||
else if (flags & 4)
|
else if (flags & 4)
|
||||||
client_cmd(player,command)
|
client_cmd(player,command)
|
||||||
}
|
}
|
||||||
if (flags & 8) displayClcmdMenu(id,g_menuPosition[id])
|
if (flags & 8) displayClcmdMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayClcmdMenu(id,pos) {
|
||||||
|
if (pos < 0) return
|
||||||
|
|
||||||
displayClcmdMenu(id,pos){
|
|
||||||
|
|
||||||
if (pos < 0) return
|
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
new i
|
new i
|
||||||
new name[32]
|
new name[32]
|
||||||
new start = pos * 7
|
new start = pos * 7
|
||||||
|
|
||||||
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_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n",
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
||||||
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
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 ( !g_menuSelectNum[id] || get_user_flags(i)&ADMIN_IMMUNITY )
|
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) {
|
||||||
{
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
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)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuSelectNum[id] )
|
if ( g_menuSelectNum[id] )
|
||||||
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] )
|
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] )
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. No cmds available^n")
|
len += format(menuBody[len],511-len,"^n8. %L^n",id,"NO_CMDS")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id]) {
|
||||||
{
|
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"Client Cmds Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdClcmdMenu(id,level,cid)
|
public cmdClcmdMenu(id,level,cid) {
|
||||||
{
|
if (!cmd_access(id,level,cid,1))
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
g_menuSelectNum[id] = 0
|
g_menuSelectNum[id] = 0
|
||||||
|
|
||||||
for(new a = 0; a < g_clcmdNum; ++a)
|
for (new a = 0; a < g_clcmdNum; ++a)
|
||||||
if (g_clcmdMisc[a][0] & flags)
|
if (g_clcmdMisc[a][0] & flags)
|
||||||
g_menuSelect[id][g_menuSelectNum[id]++] = a
|
g_menuSelect[id][g_menuSelectNum[id]++] = a
|
||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
|
|
||||||
displayClcmdMenu(id,g_menuPosition[id] = 0)
|
displayClcmdMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
load_settings( szFilename[] )
|
load_settings( szFilename[] ) {
|
||||||
{
|
|
||||||
|
|
||||||
if ( !file_exists ( szFilename ) )
|
if ( !file_exists ( szFilename ) )
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256], szFlags[32], szAccess[32]
|
new text[256], szFlags[32], szAccess[32]
|
||||||
new a, pos = 0
|
new a, pos = 0
|
||||||
|
|
||||||
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) )
|
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) ) {
|
||||||
{
|
|
||||||
if ( text[0] == ';' ) continue
|
if ( text[0] == ';' ) continue
|
||||||
|
|
||||||
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
|
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
|
||||||
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
|
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
|
||||||
{
|
{
|
||||||
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) {
|
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags )
|
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags )
|
||||||
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess )
|
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess )
|
||||||
g_clcmdNum++
|
g_clcmdNum++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
@ -149,47 +149,47 @@ new g_WeaponNames[MAXMENUPOS][] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
new g_MenuItem[MAXMENUPOS][] = {
|
new g_MenuItem[MAXMENUPOS][] = {
|
||||||
"\yHandguns^n\w^n%d. %s\y\R%s^n\w",
|
"\yHandguns^n\w^n%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\yShotguns^n\w^n%d. %s\y\R%s^n\w",
|
"\yShotguns^n\w^n%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\ySub-Machine Guns^n\w^n%d. %s\y\R%s^n\w",
|
"\ySub-Machine Guns^n\w^n%d. %s\y\R%s^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w",
|
"\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\ySniper Rifles^n\w^n%d. %s\y\R%s^n\w",
|
"\ySniper Rifles^n\w^n%d. %s\y\R%s^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\yMachine Guns^n\w^n%d. %s\y\R%s^n\w^n",
|
"\yMachine Guns^n\w^n%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\yEquipment^n\w^n%d. %s\y\R%s^n\w",
|
"\yEquipment^n\w^n%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w",
|
"%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w^n",
|
"%d. %s\y\R%L^n\w^n",
|
||||||
|
|
||||||
"\yAmmunition^n\w^n%d. %s\y\R%s^n\w",
|
"\yAmmunition^n\w^n%d. %s\y\R%L^n\w",
|
||||||
"%d. %s\y\R%s^n\w"
|
"%d. %s\y\R%L^n\w"
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_Aliases[MAXMENUPOS][] = {
|
new g_Aliases[MAXMENUPOS][] = {
|
||||||
@ -281,7 +281,7 @@ new g_Aliases2[MAXMENUPOS][] = {
|
|||||||
new g_Autobuy[33][AUTOBUYLENGTH + 1]
|
new g_Autobuy[33][AUTOBUYLENGTH + 1]
|
||||||
//new g_Rebuy[33][AUTOBUYLENGTH + 1]
|
//new g_Rebuy[33][AUTOBUYLENGTH + 1]
|
||||||
|
|
||||||
setWeapon( a , action ){
|
setWeapon( a , action ) {
|
||||||
new b, m = g_Keys[a][0] * 8
|
new b, m = g_Keys[a][0] * 8
|
||||||
if (g_Keys[a][1] != -1) {
|
if (g_Keys[a][1] != -1) {
|
||||||
b = m + g_Keys[a][1]
|
b = m + g_Keys[a][1]
|
||||||
@ -298,7 +298,7 @@ setWeapon( a , action ){
|
|||||||
g_blockPos[ b ] = action
|
g_blockPos[ b ] = action
|
||||||
}
|
}
|
||||||
|
|
||||||
for(new i = 0; i < g_AliasBlockNum; ++i)
|
for (new i = 0; i < g_AliasBlockNum; ++i)
|
||||||
if ( g_AliasBlock[ i ] == a ){
|
if ( g_AliasBlock[ i ] == a ){
|
||||||
if ( !action || action == 2 ) {
|
if ( !action || action == 2 ) {
|
||||||
--g_AliasBlockNum
|
--g_AliasBlockNum
|
||||||
@ -311,58 +311,58 @@ setWeapon( a , action ){
|
|||||||
g_AliasBlock[ g_AliasBlockNum++ ] = a
|
g_AliasBlock[ g_AliasBlockNum++ ] = a
|
||||||
}
|
}
|
||||||
|
|
||||||
findMenuId( name[] ){
|
findMenuId( name[] ) {
|
||||||
for(new i = 0; i < 7 ; ++i)
|
for(new i = 0; i < 7 ; ++i)
|
||||||
if( equal( name , g_menusNames[i] ) )
|
if( equal( name , g_menusNames[i] ) )
|
||||||
return i
|
return i
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
findAliasId( name[] ){
|
findAliasId( name[] ) {
|
||||||
for(new i = 0; i < MAXMENUPOS ; ++i)
|
for(new i = 0; i < MAXMENUPOS ; ++i)
|
||||||
if( equal( name , g_Aliases[i] ) )
|
if( equal( name , g_Aliases[i] ) )
|
||||||
return i
|
return i
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
switchCommand( id, action ){
|
switchCommand( id, action ) {
|
||||||
new c = read_argc()
|
new c = read_argc()
|
||||||
if ( c < 3 ){
|
if ( c < 3 ) {
|
||||||
setc( g_blockPos, 112, action )
|
setc( g_blockPos, 112, action )
|
||||||
console_print( id , "Equipment and weapons have been %srestricted" , action ? "" : "un" )
|
console_print( id, "%L", id, action ? "EQ_WE_RES" : "EQ_WE_UNRES" )
|
||||||
g_Modified = true
|
g_Modified = true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new arg[32], a
|
new arg[32], a
|
||||||
new bool:found = false
|
new bool:found = false
|
||||||
for(new b = 2; b < c; ++b){
|
for (new b = 2; b < c; ++b) {
|
||||||
read_argv(b,arg,31)
|
read_argv(b,arg,31)
|
||||||
if ( (a = findMenuId( arg )) != -1 ){
|
if ( (a = findMenuId( arg )) != -1 ) {
|
||||||
c = g_menusSets[a][1]
|
c = g_menusSets[a][1]
|
||||||
for(new i = g_menusSets[a][0]; i < c; ++i)
|
for (new i = g_menusSets[a][0]; i < c; ++i)
|
||||||
setWeapon( i , action )
|
setWeapon( i , action )
|
||||||
console_print( id , "%s %s been %srestricted" , g_MenuTitle[a], (a<5) ? "have" : "has" , action ? "" : "un" )
|
console_print( id , "%s %L %L", g_MenuTitle[a], id, (a<5) ? "HAVE_BEEN" : "HAS_BEEN" , action ? "RESTRICTED" : "UNRESTRICTED" )
|
||||||
g_Modified = found = true
|
g_Modified = found = true
|
||||||
}
|
}
|
||||||
else if ( (a = findAliasId( arg )) != -1 ){
|
else if ( (a = findAliasId( arg )) != -1 ) {
|
||||||
g_Modified = found = true
|
g_Modified = found = true
|
||||||
setWeapon( a , action )
|
setWeapon( a , action )
|
||||||
console_print( id , "%s has been %srestricted" , g_WeaponNames[a], action ? "" : "un" )
|
console_print( id , "%s %L %L", g_WeaponNames[a], id, "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED " )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !found )
|
if ( !found )
|
||||||
console_print( id , "Couldn't find such equipment or weapon" )
|
console_print( id , "%L", id, "NO_EQ_WE" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
positionBlocked( a ) {
|
positionBlocked( a ) {
|
||||||
new m = g_Keys[a][0] * 8
|
new m = g_Keys[a][0] * 8
|
||||||
new d = ( g_Keys[a][1]==-1) ? 0 : g_blockPos[ m + g_Keys[a][1] ]
|
new d = ( g_Keys[a][1]==-1) ? 0 : g_blockPos[ m + g_Keys[a][1] ]
|
||||||
d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ]
|
d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ]
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdRest(id,level,cid){
|
public cmdRest(id,level,cid) {
|
||||||
if (!cmd_access(id,level,cid,1))
|
if (!cmd_access(id,level,cid,1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
new cmd[8]
|
new cmd[8]
|
||||||
@ -378,140 +378,146 @@ public cmdRest(id,level,cid){
|
|||||||
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1
|
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1
|
||||||
new end = start + 10
|
new end = start + 10
|
||||||
if (end > MAXMENUPOS) end = MAXMENUPOS
|
if (end > MAXMENUPOS) end = MAXMENUPOS
|
||||||
console_print(id, "^n----- Weapons Restriction: -----")
|
new lName[16],lValue[16],lStatus[16],lOnOf[16]
|
||||||
console_print(id, " %-32.31s %-10.9s %-9.8s","name","value","status")
|
format(lName,15,"%L",id,"NAME")
|
||||||
|
format(lValue,15,"%L",id,"VALUE")
|
||||||
|
format(lStatus,15,"%L",id,"STATUS")
|
||||||
|
format(lOnOff,15,"%L",id,positionBlocked(a) ? "ON" : "OFF")
|
||||||
|
console_print(id, "^n----- %L: -----", id, "WEAP_RES")
|
||||||
|
console_print(id, " %-32.31s %-10.9s %-9.8s",lName,lValue,lStatus)
|
||||||
if ( start != -1 ) {
|
if ( start != -1 ) {
|
||||||
for(new a = start; a < end; ++a){
|
for (new a = start; a < end; ++a) {
|
||||||
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1,
|
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1,
|
||||||
g_WeaponNames[a], g_Aliases[a], positionBlocked(a) ? "ON" : "OFF")
|
g_WeaponNames[a], g_Aliases[a], lOnOff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console_print(id,"----- Entries %i - %i of %i -----",start+1,end,MAXMENUPOS)
|
console_print(id,"----- %L -----",id,"ENTRIES_OF",start+1,end,MAXMENUPOS)
|
||||||
if (end < MAXMENUPOS)
|
if (end < MAXMENUPOS)
|
||||||
console_print(id,"----- Use 'amx_restrict list %i' for more -----",end+1)
|
console_print(id,"----- %L -----",id,"USE_MORE",end+1)
|
||||||
else
|
else
|
||||||
console_print(id,"----- Use 'amx_restrict list 1' for begin -----")
|
console_print(id,"----- %L -----",id,"USE_BEGIN")
|
||||||
}
|
}
|
||||||
else if ( equali( "save" , cmd ) ) {
|
else if ( equali( "save" , cmd ) ) {
|
||||||
if ( saveSettings( g_saveFile ) ){
|
if ( saveSettings( g_saveFile ) ){
|
||||||
console_print( id , "Configuration has been saved (file ^"%s^")" , g_saveFile )
|
console_print( id , "%L", id, "CONF_SAVED", g_saveFile )
|
||||||
g_Modified = false
|
g_Modified = false
|
||||||
}
|
}
|
||||||
else console_print( id , "Couldn't save configuration (file ^"%s^")" , g_saveFile )
|
else console_print( id, "%L", id, "COULDNT_SAVE", g_saveFile )
|
||||||
}
|
}
|
||||||
else if ( equali( "load" , cmd ) ) {
|
else if ( equali( "load" , cmd ) ) {
|
||||||
setc( g_blockPos, 112, 0 ) // Clear current settings
|
setc( g_blockPos, 112, 0 ) // Clear current settings
|
||||||
new arg1[64]
|
new arg1[64]
|
||||||
if ( read_argv(2, arg1 , 63 ) )
|
if ( read_argv(2, arg1 , 63 ) ) {
|
||||||
{
|
|
||||||
new configsdir[32]
|
new configsdir[32]
|
||||||
get_configsdir(configsdir,31)
|
get_configsdir(configsdir,31)
|
||||||
format(arg1,63,"%s/%s",configsdir,arg1)
|
format(arg1,63,"%s/%s",configsdir,arg1)
|
||||||
}
|
}
|
||||||
if ( loadSettings( arg1 ) ){
|
if ( loadSettings( arg1 ) ) {
|
||||||
console_print( id , "Configuration has been loaded (file ^"%s^")" , arg1 )
|
console_print( id, "%L", id, "CONF_LOADED", arg1 )
|
||||||
g_Modified = true
|
g_Modified = true
|
||||||
}
|
}
|
||||||
else console_print( id , "Couldn't load configuration (file ^"%s^")" , arg1 )
|
else console_print( id, "%L", id, "COULDNT_LOAD", arg1 )
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console_print(id,"Usage: amx_restrict <command> [value]")
|
console_print(id,"%L",id,"COM_USAGE")
|
||||||
console_print(id,"Commands:")
|
console_print(id,"%L",id,"COM_COMMANDS")
|
||||||
console_print(id,"^ton - set restriction on whole equipment")
|
console_print(id,"%L",id,"COM_ON")
|
||||||
console_print(id,"^toff - remove restriction from whole equipment")
|
console_print(id,"%L",id,"COM_OFF")
|
||||||
console_print(id,"^ton <value> [...] - set specified restriction")
|
console_print(id,"%L",id,"COM_ON")
|
||||||
console_print(id,"^toff <value> [...] - remove specified restriction")
|
console_print(id,"%L",id,"COM_OFF")
|
||||||
console_print(id,"^tlist - display list of available equipment and weapons")
|
console_print(id,"%L",id,"COM_LIST")
|
||||||
console_print(id,"^tsave - save restriction")
|
console_print(id,"%L",id,"COM_SAVE")
|
||||||
console_print(id,"^tload [file] - load restriction [from a file]")
|
console_print(id,"%L",id,"COM_LOAD")
|
||||||
console_print(id,"Available values to restrict are:^nammo, equip, pistol, shotgun, sub, rifle, machine")
|
console_print(id,"%L",id,"COM_VALUES")
|
||||||
console_print(id,"Type 'amx_restrict list' for more specified values")
|
console_print(id,"%L",id,"COM_TYPE")
|
||||||
}
|
}
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMenu(id,pos){
|
displayMenu(id,pos) {
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
new menubody[512], start = pos * 7
|
new menubody[512], start = pos * 7
|
||||||
if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0
|
if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0
|
||||||
new len = format(menubody,511,"\yRestrict Weapons\R%d/5^n\w^n",pos+1)
|
new len = format(menubody,511,"\y%L\R%d/5^n\w^n",id,"REST_WEAP",pos+1)
|
||||||
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
||||||
if (end > MAXMENUPOS) end = MAXMENUPOS
|
if (end > MAXMENUPOS) end = MAXMENUPOS
|
||||||
for(new a = start; a < end; ++a){
|
for (new a = start; a < end; ++a) {
|
||||||
keys |= (1<<k)
|
keys |= (1<<k)
|
||||||
len += format(menubody[len],511-len,g_MenuItem[a],++k,g_WeaponNames[a],
|
len += format(menubody[len],511-len,g_MenuItem[a],++k,g_WeaponNames[a],
|
||||||
positionBlocked(a) ? "ON" : "OFF" )
|
id, positionBlocked(a) ? "ON" : "OFF" )
|
||||||
}
|
}
|
||||||
len += format(menubody[len],511-len,"^n8. Save settings \y\R%s^n\w",g_Modified?"*":"")
|
len += format(menubody[len],511-len,"^n8. %L \y\R%s^n\w",id,"SAVE_SET",g_Modified?"*":"")
|
||||||
if (end != MAXMENUPOS){
|
if (end != MAXMENUPOS) {
|
||||||
format(menubody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
format(menubody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menubody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menubody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
show_menu(id,keys,menubody)
|
show_menu(id,keys,menubody,-1,"Restrict Weapons")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionMenu(id,key){
|
public actionMenu(id,key) {
|
||||||
switch(key){
|
switch (key) {
|
||||||
case 7: {
|
case 7: {
|
||||||
if (saveSettings(g_saveFile)){
|
if (saveSettings(g_saveFile)) {
|
||||||
g_Modified = false
|
g_Modified = false
|
||||||
client_print(id,print_chat,"* Configuration saved successfully")
|
client_print(id,print_chat,"* %L",id,"CONF_SAV_SUC")
|
||||||
}
|
}
|
||||||
else client_print(id,print_chat,"* Configuration saving failed!!!")
|
else client_print(id,print_chat,"* %L",id,"CONF_SAV_FAIL")
|
||||||
displayMenu(id,g_Position[id])
|
displayMenu(id,g_Position[id])
|
||||||
}
|
}
|
||||||
case 8: displayMenu(id,++g_Position[id])
|
case 8: displayMenu(id,++g_Position[id])
|
||||||
case 9: displayMenu(id,--g_Position[id])
|
case 9: displayMenu(id,--g_Position[id])
|
||||||
default: {
|
default: {
|
||||||
setWeapon( g_Position[id] * 7 + key , 2 )
|
setWeapon( g_Position[id] * 7 + key , 2 )
|
||||||
g_Modified = true
|
g_Modified = true
|
||||||
displayMenu(id,g_Position[id])
|
displayMenu(id,g_Position[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public client_command( id ){
|
public client_command( id ) {
|
||||||
if ( g_AliasBlockNum ) {
|
if ( g_AliasBlockNum ) {
|
||||||
new arg[13]
|
new arg[13]
|
||||||
|
|
||||||
if ( read_argv( 0, arg , 12 ) > 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */
|
if ( read_argv( 0, arg , 12 ) > 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
|
|
||||||
new a = 0
|
new a = 0
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ( equal( g_Aliases[g_AliasBlock[ a ]] , arg ) ||
|
if ( equal( g_Aliases[g_AliasBlock[ a ]] , arg ) ||
|
||||||
equal( g_Aliases2[g_AliasBlock[ a ]] , arg ) ) {
|
equal( g_Aliases2[g_AliasBlock[ a ]] , arg ) )
|
||||||
client_print(id,print_center,g_Restricted )
|
{
|
||||||
return PLUGIN_HANDLED
|
client_print(id,print_center,g_Restricted )
|
||||||
}
|
return PLUGIN_HANDLED
|
||||||
} while( ++a < g_AliasBlockNum )
|
}
|
||||||
}
|
} while( ++a < g_AliasBlockNum )
|
||||||
return PLUGIN_CONTINUE
|
}
|
||||||
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
// JGHG: Send weapon string to this function and it returns true if weapon is blocked or false if not blocked...
|
// JGHG: Send weapon string to this function and it returns true if weapon is blocked or false if not blocked...
|
||||||
stock WeaponIsBlocked(weapon[]) {
|
WeaponIsBlocked(weapon[]) {
|
||||||
for (new a = 0; a < g_AliasBlockNum; a++) {
|
for (new a = 0; a < g_AliasBlockNum; a++) {
|
||||||
server_print("%d", a)
|
server_print("%d", a)
|
||||||
server_print(weapon)
|
server_print(weapon)
|
||||||
server_print(g_Aliases[g_AliasBlock[ a ]])
|
server_print(g_Aliases[g_AliasBlock[ a ]])
|
||||||
server_print(g_Aliases2[g_AliasBlock[ a ]])
|
server_print(g_Aliases2[g_AliasBlock[ a ]])
|
||||||
|
|
||||||
if ( equal( g_Aliases[g_AliasBlock[ a ]] , weapon ) ||
|
if ( equal( g_Aliases[g_AliasBlock[ a ]] , weapon ) ||
|
||||||
equal( g_Aliases2[g_AliasBlock[ a ]] , weapon ) ) {
|
equal( g_Aliases2[g_AliasBlock[ a ]] , weapon ) )
|
||||||
return true // blocked
|
{
|
||||||
}
|
return true // blocked
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false // not blocked
|
return false // not blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
public blockcommand(id) {
|
public blockcommand(id) {
|
||||||
client_print(id,print_center, g_Restricted )
|
client_print(id,print_center, g_Restricted )
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdMenu(id,level,cid){
|
public cmdMenu(id,level,cid){
|
||||||
@ -540,13 +546,13 @@ public menuRifle(id,key) return checkRest(id,4,key)
|
|||||||
public menuMachine(id,key) return checkRest(id,5,key)
|
public menuMachine(id,key) return checkRest(id,5,key)
|
||||||
public menuItem(id,key) return checkRest(id,6,key)
|
public menuItem(id,key) return checkRest(id,6,key)
|
||||||
|
|
||||||
saveSettings(filename[]){
|
saveSettings(filename[]) {
|
||||||
if (file_exists(filename))
|
if (file_exists(filename))
|
||||||
delete_file(filename)
|
delete_file(filename)
|
||||||
if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
|
if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name"))
|
||||||
return 0
|
return 0
|
||||||
new text[64]
|
new text[64]
|
||||||
for(new a = 0; a < MAXMENUPOS; ++a){
|
for(new a = 0; a < MAXMENUPOS; ++a) {
|
||||||
if ( positionBlocked( a ) ) {
|
if ( positionBlocked( a ) ) {
|
||||||
format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a])
|
format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a])
|
||||||
write_file(filename,text)
|
write_file(filename,text)
|
||||||
@ -559,7 +565,7 @@ loadSettings(filename[]){
|
|||||||
if (!file_exists(filename)) return 0
|
if (!file_exists(filename)) return 0
|
||||||
new text[16]
|
new text[16]
|
||||||
new a, pos = 0
|
new a, pos = 0
|
||||||
while (read_file(filename,pos++,text,15, a )){
|
while (read_file(filename,pos++,text,15, a )) {
|
||||||
if ( text[0] == ';' || !a ) continue // line is a comment
|
if ( text[0] == ';' || !a ) continue // line is a comment
|
||||||
parse( text, text , 15 )
|
parse( text, text , 15 )
|
||||||
if ( (a = findAliasId( text )) != -1 )
|
if ( (a = findAliasId( text )) != -1 )
|
||||||
@ -570,125 +576,126 @@ loadSettings(filename[]){
|
|||||||
|
|
||||||
// JGHG
|
// JGHG
|
||||||
public fn_setautobuy(id) {
|
public fn_setautobuy(id) {
|
||||||
// Don't do anything if no items are blocked.
|
// Don't do anything if no items are blocked.
|
||||||
if (!g_AliasBlockNum)
|
if (!g_AliasBlockNum)
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
|
|
||||||
// Empty user's autobuy prefs. (unnecessary?)
|
// Empty user's autobuy prefs. (unnecessary?)
|
||||||
g_Autobuy[id][0] = '^0'
|
g_Autobuy[id][0] = '^0'
|
||||||
|
|
||||||
new argCount = read_argc()
|
new argCount = read_argc()
|
||||||
|
|
||||||
new arg[128]
|
new arg[128]
|
||||||
new autobuyLen = 0
|
new autobuyLen = 0
|
||||||
for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy"
|
for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy"
|
||||||
read_argv(i, arg, 127)
|
read_argv(i, arg, 127)
|
||||||
|
|
||||||
// Add this parameter to user's autobuy prefs
|
// Add this parameter to user's autobuy prefs
|
||||||
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg)
|
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg)
|
||||||
// If we detect more parameters, add a space
|
// If we detect more parameters, add a space
|
||||||
if (i + 1 < argCount)
|
if (i + 1 < argCount)
|
||||||
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ")
|
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip any blocked items
|
// Strip any blocked items
|
||||||
new strippedItems[AUTOBUYLENGTH + 1]
|
new strippedItems[AUTOBUYLENGTH + 1]
|
||||||
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
||||||
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
||||||
|
|
||||||
//server_print("Stripped items: ^"%s^"", strippedItems)
|
//server_print("Stripped items: ^"%s^"", strippedItems)
|
||||||
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Check g_Autobuy[id] for blocked items.
|
// Check g_Autobuy[id] for blocked items.
|
||||||
if (g_AliasBlockNum > 0) {
|
if (g_AliasBlockNum > 0) {
|
||||||
new blockedItem[AUTOBUYLENGTH + 1]
|
new blockedItem[AUTOBUYLENGTH + 1]
|
||||||
if (CheckBlockedItems(g_Autobuy[id], blockedItem)) {
|
if (CheckBlockedItems(g_Autobuy[id], blockedItem)) {
|
||||||
client_print(id, print_center, "%c%s is blocked!", blockedItem[0] < 'a' || blockedItem[0] > 'z' ? blockedItem[0] : blockedItem[0] - 32, blockedItem[1]) // Tell what item is blocked (if first char is a letter it will be capital)
|
client_print(id, print_center, "%c%s is blocked!", blockedItem[0] < 'a' || blockedItem[0] > 'z' ? blockedItem[0] : blockedItem[0] - 32, blockedItem[1]) // Tell what item is blocked (if first char is a letter it will be capital)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//return PLUGIN_CONTINUE
|
//return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if this strips any items, else false.
|
// Returns true if this strips any items, else false.
|
||||||
StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) {
|
StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) {
|
||||||
// First copy string
|
// First copy string
|
||||||
format(outString, AUTOBUYLENGTH, inString)
|
format(outString, AUTOBUYLENGTH, inString)
|
||||||
|
|
||||||
// Then strip those that are blocked.
|
// Then strip those that are blocked.
|
||||||
for (new i = 0; i < g_AliasBlockNum; i++) {
|
for (new i = 0; i < g_AliasBlockNum; i++) {
|
||||||
while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1)
|
while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1)
|
||||||
replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "")
|
replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "")
|
||||||
while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1)
|
while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1)
|
||||||
replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "")
|
replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We COULD trim white space from outString here, but I don't think it really is necessary currently...
|
// We COULD trim white space from outString here, but I don't think it really is necessary currently...
|
||||||
|
|
||||||
if (strlen(outString) < strlen(inString))
|
if (strlen(outString) < strlen(inString))
|
||||||
return true // outstring is shorter: we stripped items, return true
|
return true // outstring is shorter: we stripped items, return true
|
||||||
|
|
||||||
return false // else end here, return false, no items were stripped
|
return false // else end here, return false, no items were stripped
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if any of the items in items[] are blocked, else false.
|
// Returns true if any of the items in items[] are blocked, else false.
|
||||||
stock CheckBlockedItems(items[], blockedItem[AUTOBUYLENGTH + 1]) {
|
CheckBlockedItems(items[], blockedItem[AUTOBUYLENGTH + 1]) {
|
||||||
if (g_AliasBlockNum <= 0)
|
if (g_AliasBlockNum <= 0)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
new l_items[AUTOBUYLENGTH + 1]
|
new l_items[AUTOBUYLENGTH + 1]
|
||||||
format(l_items, AUTOBUYLENGTH, items)
|
format(l_items, AUTOBUYLENGTH, items)
|
||||||
|
|
||||||
new aValueWasParsed, parsedItem[128]
|
new aValueWasParsed, parsedItem[128]
|
||||||
do {
|
do {
|
||||||
aValueWasParsed = parse(l_items, parsedItem, 127)
|
aValueWasParsed = parse(l_items, parsedItem, 127)
|
||||||
if (strlen(parsedItem) == 0)
|
if (strlen(parsedItem) == 0)
|
||||||
return false // no more items
|
return false // no more items
|
||||||
|
|
||||||
if (aValueWasParsed) {
|
if (aValueWasParsed) {
|
||||||
replace(l_items, AUTOBUYLENGTH, parsedItem, "") // Remove first parameter
|
replace(l_items, AUTOBUYLENGTH, parsedItem, "") // Remove first parameter
|
||||||
|
|
||||||
if (WeaponIsBlocked(parsedItem)) {
|
if (WeaponIsBlocked(parsedItem)) {
|
||||||
format(blockedItem, AUTOBUYLENGTH, parsedItem)
|
format(blockedItem, AUTOBUYLENGTH, parsedItem)
|
||||||
return true // item is blocked, return true
|
return true // item is blocked, return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
}
|
} while (aValueWasParsed)
|
||||||
while (aValueWasParsed)
|
|
||||||
|
|
||||||
return false // no blocked items found
|
return false // no blocked items found
|
||||||
}
|
}
|
||||||
|
|
||||||
public fn_autobuy(id) {
|
public fn_autobuy(id) {
|
||||||
// Don't do anything if no items are blocked.
|
// Don't do anything if no items are blocked.
|
||||||
if (!g_AliasBlockNum)
|
if (!g_AliasBlockNum)
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
|
|
||||||
// Strip any blocked items
|
// Strip any blocked items
|
||||||
new strippedItems[AUTOBUYLENGTH + 1]
|
new strippedItems[AUTOBUYLENGTH + 1]
|
||||||
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
if (!StripBlockedItems(g_Autobuy[id], strippedItems))
|
||||||
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything...
|
||||||
|
|
||||||
//server_print("Stripped items: ^"%s^"", strippedItems)
|
//server_print("Stripped items: ^"%s^"", strippedItems)
|
||||||
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
engclient_cmd(id, "cl_setautobuy", strippedItems)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init() {
|
||||||
register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||||
|
register_dictionary("restmenu.txt")
|
||||||
|
register_dictionary("common.txt")
|
||||||
register_clcmd("buyammo1","ammoRest1")
|
register_clcmd("buyammo1","ammoRest1")
|
||||||
register_clcmd("buyammo2","ammoRest2")
|
register_clcmd("buyammo2","ammoRest2")
|
||||||
register_clcmd("cl_setautobuy", "fn_setautobuy")
|
register_clcmd("cl_setautobuy", "fn_setautobuy")
|
||||||
register_clcmd("cl_autobuy", "fn_autobuy")
|
register_clcmd("cl_autobuy", "fn_autobuy")
|
||||||
register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu")
|
register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu")
|
||||||
register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy")
|
register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy")
|
||||||
register_menucmd(register_menuid("\yRestrict Weapons"),1023,"actionMenu")
|
register_menucmd(register_menuid("Restrict Weapons"),1023,"actionMenu")
|
||||||
register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol")
|
register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol")
|
||||||
register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun")
|
register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun")
|
||||||
register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub")
|
register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub")
|
||||||
|
@ -45,35 +45,35 @@ new Float:g_xPos
|
|||||||
new g_Length
|
new g_Length
|
||||||
new g_Frequency
|
new g_Frequency
|
||||||
|
|
||||||
public plugin_init(){
|
public plugin_init() {
|
||||||
register_plugin("Scrolling Message",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("Scrolling Message",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||||
|
register_dictionary("scrollmsg.txt")
|
||||||
register_srvcmd("amx_scrollmsg","setMessage")
|
register_srvcmd("amx_scrollmsg","setMessage")
|
||||||
}
|
}
|
||||||
|
|
||||||
public showMsg(){
|
public showMsg() {
|
||||||
new a = g_startPos, i = 0
|
new a = g_startPos, i = 0
|
||||||
|
|
||||||
while( a < g_endPos )
|
while( a < g_endPos )
|
||||||
g_displayMsg[i++] = g_scrollMsg[a++]
|
g_displayMsg[i++] = g_scrollMsg[a++]
|
||||||
|
|
||||||
g_displayMsg[i] = 0
|
g_displayMsg[i] = 0
|
||||||
|
|
||||||
if (g_endPos < g_Length)
|
if (g_endPos < g_Length)
|
||||||
g_endPos++
|
g_endPos++
|
||||||
|
|
||||||
if (g_xPos > 0.35)
|
if (g_xPos > 0.35)
|
||||||
g_xPos -= 0.0063
|
g_xPos -= 0.0063
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
g_startPos++
|
g_startPos++
|
||||||
g_xPos = 0.35
|
g_xPos = 0.35
|
||||||
}
|
}
|
||||||
|
|
||||||
set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
|
set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
|
||||||
show_hudmessage(0,g_displayMsg)
|
show_hudmessage(0,g_displayMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
public msgInit(){
|
public msgInit() {
|
||||||
g_endPos = 1
|
g_endPos = 1
|
||||||
g_startPos = 0
|
g_startPos = 0
|
||||||
g_xPos = 0.65
|
g_xPos = 0.65
|
||||||
@ -81,9 +81,7 @@ public msgInit(){
|
|||||||
client_print(0,print_console,g_scrollMsg)
|
client_print(0,print_console,g_scrollMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
public setMessage(id,level,cid) {
|
public setMessage() {
|
||||||
if (!cmd_access(id,level,cid,3))
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
remove_task(123) /* remove current messaging */
|
remove_task(123) /* remove current messaging */
|
||||||
read_argv(1,g_scrollMsg,380)
|
read_argv(1,g_scrollMsg,380)
|
||||||
new hostname[64]
|
new hostname[64]
|
||||||
@ -96,14 +94,14 @@ public setMessage(id,level,cid) {
|
|||||||
if (g_Frequency > 0) {
|
if (g_Frequency > 0) {
|
||||||
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
|
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
|
||||||
if (g_Frequency < minimal) {
|
if (g_Frequency < minimal) {
|
||||||
console_print(id,"Minimal frequency for this message is %d seconds",minimal)
|
server_print("%L",LANG_SERVER,"MIN_FREQ",minimal)
|
||||||
g_Frequency = minimal
|
g_Frequency = minimal
|
||||||
}
|
}
|
||||||
console_print(id,"Scrolling message displaying frequency: %d:%02d minutes",
|
server_print("%L",LANG_SERVER,"MSG_FREQ")
|
||||||
g_Frequency/60,g_Frequency%60)
|
g_Frequency/60,g_Frequency%60)
|
||||||
set_task(float(g_Frequency),"msgInit",123,"",0,"b")
|
set_task(float(g_Frequency),"msgInit",123,"",0,"b")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id,"Scrolling message disabled")
|
server_print("%L",LANG_SERVER,"MSG_DISABLED")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
@ -45,8 +45,10 @@ new g_menuPosition[33]
|
|||||||
new g_fileToSave[64]
|
new g_fileToSave[64]
|
||||||
new bool:g_modified
|
new bool:g_modified
|
||||||
|
|
||||||
public plugin_precache(){
|
public plugin_precache() {
|
||||||
register_clcmd("amx_statscfgmenu","cmdCfgMenu",ADMIN_CFG,"- displays stats configuration menu")
|
register_clcmd("amx_statscfgmenu","cmdCfgMenu",ADMIN_CFG,"- displays stats configuration menu")
|
||||||
|
register_dictionary("statscfg.txt")
|
||||||
|
register_dictionary("common.txt")
|
||||||
register_concmd("amx_statscfg","cmdCfg",ADMIN_CFG,"- displays help for stats configuration")
|
register_concmd("amx_statscfg","cmdCfg",ADMIN_CFG,"- displays help for stats configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +60,10 @@ public plugin_init() {
|
|||||||
loadSettings(g_fileToSave)
|
loadSettings(g_fileToSave)
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCfg( id,level,cid ){
|
public cmdCfg( id,level,cid ) {
|
||||||
if (!cmd_access(id,level,cid,1))
|
if (!cmd_access(id,level,cid,1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new cmds[32]
|
new cmds[32]
|
||||||
read_argv(1,cmds,31)
|
read_argv(1,cmds,31)
|
||||||
new option = equali(cmds, "on" ) ? 1 : 0
|
new option = equali(cmds, "on" ) ? 1 : 0
|
||||||
@ -69,7 +71,7 @@ public cmdCfg( id,level,cid ){
|
|||||||
if ( read_argc() > 2 && option ) {
|
if ( read_argc() > 2 && option ) {
|
||||||
new var[32], enabled = 0
|
new var[32], enabled = 0
|
||||||
read_argv( 2 , var , 31 )
|
read_argv( 2 , var , 31 )
|
||||||
for( new a = 0; a < g_menuDataNum; ++a ) {
|
for ( new a = 0; a < g_menuDataNum; ++a ) {
|
||||||
if ( containi( g_menuDataVar[ a ] , var ) != -1 ) {
|
if ( containi( g_menuDataVar[ a ] , var ) != -1 ) {
|
||||||
g_modified = true
|
g_modified = true
|
||||||
++enabled
|
++enabled
|
||||||
@ -84,25 +86,25 @@ public cmdCfg( id,level,cid ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
console_print(id,"Total %d", enabled )
|
console_print(id,"%L", id, "TOTAL_NUM", enabled )
|
||||||
else
|
else
|
||||||
console_print(id,"Couldn't find option(s) with such variable (name ^"%s^")", var )
|
console_print(id,"%L",id,"NO_OPTION",var )
|
||||||
}
|
}
|
||||||
else if ( equali(cmds, "save" ) ) {
|
else if ( equali(cmds, "save" ) ) {
|
||||||
if ( saveSettings( g_fileToSave ) ){
|
if ( saveSettings( g_fileToSave ) ){
|
||||||
g_modified = false
|
g_modified = false
|
||||||
console_print(id,"Stats configuration saved successfully")
|
console_print(id,"%L",id,"CONF_SAVED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id,"Failed to save stats configuration!!!")
|
console_print(id,"%L",id,"CONF_FAILED")
|
||||||
}
|
}
|
||||||
else if ( equali(cmds, "load" ) ) {
|
else if ( equali(cmds, "load" ) ) {
|
||||||
if ( loadSettings( g_fileToSave ) ){
|
if ( loadSettings( g_fileToSave ) ){
|
||||||
g_modified = false
|
g_modified = false
|
||||||
console_print(id,"Stats configuration loaded successfully")
|
console_print(id,"%L",id,"CONF_LOADED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id,"Failed to load stats configuration!!!")
|
console_print(id,"%L",id,"CONF_FAIL_LOAD")
|
||||||
}
|
}
|
||||||
else if ( equali(cmds, "list" ) ) {
|
else if ( equali(cmds, "list" ) ) {
|
||||||
new arg1[8]
|
new arg1[8]
|
||||||
@ -111,87 +113,94 @@ public cmdCfg( id,level,cid ){
|
|||||||
if (start >= g_menuDataNum) start = g_menuDataNum - 1
|
if (start >= g_menuDataNum) start = g_menuDataNum - 1
|
||||||
new end = start + 10
|
new end = start + 10
|
||||||
if (end > g_menuDataNum) end = g_menuDataNum
|
if (end > g_menuDataNum) end = g_menuDataNum
|
||||||
console_print(id, "^n----- Stats Configuration: -----")
|
|
||||||
console_print(id, " %-29.28s %-24.23s %-9.8s","name","variable","status")
|
new lName[16],lVariable[16],lStatus[16]
|
||||||
|
format(lName,15,"%L",id,"NAME")
|
||||||
|
format(lVariable,15,"%L",id,"VARIABLE")
|
||||||
|
format(lStatus,15,"%L",id,"STATUS")
|
||||||
|
console_print(id, "^n----- %L: -----",id,"STATS_CONF")
|
||||||
|
console_print(id, " %-29.28s %-24.23s %-9.8s",lName,lVariable,lStatus)
|
||||||
if ( start != -1 ) {
|
if ( start != -1 ) {
|
||||||
for(new a = start; a < end; ++a){
|
new lOnOff[16]
|
||||||
|
for (new a = start; a < end; ++a) {
|
||||||
|
format(lOnOff,15,"%L",id,get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF")
|
||||||
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s",a + 1,
|
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s",a + 1,
|
||||||
g_menuData[a], g_menuDataVar[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF")
|
g_menuData[a], g_menuDataVar[a], lOnOff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console_print(id,"----- Entries %i - %i of %i -----",start+1,end,g_menuDataNum)
|
console_print(id,"----- %L -----",id,"ENTRIES_OF",start+1,end,g_menuDataNum)
|
||||||
if (end < g_menuDataNum)
|
if (end < g_menuDataNum)
|
||||||
console_print(id,"----- Use 'amx_statscfg list %i' for more -----",end+1)
|
console_print(id,"----- %L -----",id,"USE_MORE",end+1)
|
||||||
else
|
else
|
||||||
console_print(id,"----- Use 'amx_statscfg list 1' for begin -----")
|
console_print(id,"----- %L -----",id,"USE_BEGIN")
|
||||||
}
|
}
|
||||||
else if ( equali(cmds, "add" ) && read_argc() > 3 ) {
|
else if ( equali(cmds, "add" ) && read_argc() > 3 ) {
|
||||||
if ( g_menuDataNum < MAX_MENU_DATA ) {
|
if ( g_menuDataNum < MAX_MENU_DATA ) {
|
||||||
read_argv(2, g_menuData[g_menuDataNum] , 31 )
|
read_argv(2, g_menuData[g_menuDataNum] , 31 )
|
||||||
read_argv(3, g_menuDataVar[g_menuDataNum] , 31 )
|
read_argv(3, g_menuDataVar[g_menuDataNum] , 31 )
|
||||||
g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] )
|
g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] )
|
||||||
++g_menuDataNum
|
++g_menuDataNum
|
||||||
}
|
}
|
||||||
else console_print(id, "Can't add stats to the list, limit reached!")
|
else console_print(id, "%L",id,"CANT_ADD")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console_print(id,"Usage: amx_statscfg <command> [parameters] ...")
|
console_print(id,"%L",id,"COM_USAGE")
|
||||||
console_print(id,"Commands:")
|
console_print(id,"%L",id,"COM_COM")
|
||||||
console_print(id,"^ton <variable> - enable specified option")
|
console_print(id,"%L",id,"COM_ON")
|
||||||
console_print(id,"^toff <variable> - disable specified option")
|
console_print(id,"%L",id,"COM_OFF")
|
||||||
console_print(id,"^tsave - save stats configuration")
|
console_print(id,"%L",id,"COM_SAVE")
|
||||||
console_print(id,"^tload - load stats configuration")
|
console_print(id,"%L",id,"COM_LOAD")
|
||||||
console_print(id,"^tlist [id] - list stats status")
|
console_print(id,"%L",id,"COM_LIST")
|
||||||
console_print(id,"^tadd <name> <variable> - add stats to the list")
|
console_print(id,"%L",id,"COM_ADD")
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCfgMenu(id,level,cid){
|
public cmdCfgMenu(id,level,cid) {
|
||||||
if (cmd_access(id,level,cid,1))
|
if (cmd_access(id,level,cid,1))
|
||||||
displayCfgMenu(id,g_menuPosition[id] = 0)
|
displayCfgMenu(id,g_menuPosition[id] = 0)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCfgMenu(id,pos){
|
displayCfgMenu(id,pos) {
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
new menu_body[512], start = pos * 7
|
new menu_body[512], start = pos * 7
|
||||||
if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0
|
if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0
|
||||||
new len = format(menu_body,511,"\yStats Configuration\R%d/%d^n\w^n",
|
new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n",
|
||||||
pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
|
id,"STATS_CONF",pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
|
||||||
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
||||||
if (end > g_menuDataNum) end = g_menuDataNum
|
if (end > g_menuDataNum) end = g_menuDataNum
|
||||||
for(new a = start; a < end; ++a){
|
for (new a = start; a < end; ++a) {
|
||||||
keys |= (1<<k)
|
keys |= (1<<k)
|
||||||
len += format(menu_body[len],511-len,"%d. %s\y\R%s^n\w",++k,
|
len += format(menu_body[len],511-len,"%d. %s\y\R%L^n\w",++k,
|
||||||
g_menuData[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
|
g_menuData[a], id, get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
|
||||||
}
|
}
|
||||||
if ( g_menuDataNum == 0 )
|
if ( g_menuDataNum == 0 )
|
||||||
len += format(menu_body[len],511-len,"\dStats plugins are not^ninstalled on this server^n\w")
|
len += format(menu_body[len],511-len,"\d%L\w",id,"NO_STATS")
|
||||||
len += format(menu_body[len],511-len,"^n8. Save configuration\y\R%s^n\w",g_modified ? "*" : "")
|
len += format(menu_body[len],511-len,"^n8. %L\y\R%s^n\w",id,"SAVE_CONF",g_modified ? "*" : "")
|
||||||
if (end != g_menuDataNum){
|
if (end != g_menuDataNum) {
|
||||||
format(menu_body[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
format(menu_body[len],511-len,"^n9. %L...^n0. %s", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
show_menu(id,keys,menu_body)
|
show_menu(id,keys,menu_body,-1,"Stats Configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionCfgMenu(id,key){
|
public actionCfgMenu(id,key) {
|
||||||
switch(key){
|
switch(key) {
|
||||||
case 7:{
|
case 7: {
|
||||||
if (saveSettings(g_fileToSave)){
|
if (saveSettings(g_fileToSave)) {
|
||||||
g_modified = false
|
g_modified = false
|
||||||
client_print(id,print_chat,"* Configuration saved successfully")
|
client_print(id,print_chat,"* %L",id,"CONF_SAVED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(id,print_chat,"* Failed to save configuration!!!")
|
client_print(id,print_chat,"* %L",id,"CONF_FAILED")
|
||||||
displayCfgMenu(id,g_menuPosition[id])
|
displayCfgMenu(id,g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayCfgMenu(id,++g_menuPosition[id])
|
case 8: displayCfgMenu(id,++g_menuPosition[id])
|
||||||
case 9: displayCfgMenu(id,--g_menuPosition[id])
|
case 9: displayCfgMenu(id,--g_menuPosition[id])
|
||||||
default:{
|
default: {
|
||||||
g_modified = true
|
g_modified = true
|
||||||
new a = g_menuPosition[id] * 7 + key
|
new a = g_menuPosition[id] * 7 + key
|
||||||
set_xvar_num( g_menuDataId[ a ] , 1 - get_xvar_num( g_menuDataId[ a ] ) )
|
set_xvar_num( g_menuDataId[ a ] , 1 - get_xvar_num( g_menuDataId[ a ] ) )
|
||||||
@ -201,7 +210,7 @@ public actionCfgMenu(id,key){
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSettings(filename[]){
|
saveSettings(filename[]) {
|
||||||
if (file_exists(filename))
|
if (file_exists(filename))
|
||||||
delete_file(filename)
|
delete_file(filename)
|
||||||
if (!write_file(filename,";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
|
if (!write_file(filename,";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
|
||||||
@ -216,7 +225,7 @@ saveSettings(filename[]){
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(filename[]){
|
loadSettings(filename[]) {
|
||||||
if (!file_exists(filename))
|
if (!file_exists(filename))
|
||||||
return 0
|
return 0
|
||||||
new text[256], name[32]
|
new text[256], name[32]
|
||||||
|
@ -45,6 +45,8 @@ new g_coloredMenus
|
|||||||
|
|
||||||
public plugin_init() {
|
public plugin_init() {
|
||||||
register_plugin("Teleport Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("Teleport Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||||
|
register_dictionary("telemenu.txt")
|
||||||
|
register_dictionary("common.txt")
|
||||||
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")
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ public plugin_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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])
|
||||||
@ -72,7 +74,7 @@ public actionTelMenu(id,key) {
|
|||||||
get_user_name(player,name2,31)
|
get_user_name(player,name2,31)
|
||||||
|
|
||||||
if (!is_user_alive(player)) {
|
if (!is_user_alive(player)) {
|
||||||
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
|
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
displayTelMenu(id,g_menuPosition[id])
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
@ -95,9 +97,9 @@ public actionTelMenu(id,key) {
|
|||||||
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
|
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
||||||
|
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity")) {
|
||||||
case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2)
|
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_2",name,name2)
|
||||||
case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2)
|
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_1",name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
displayTelMenu(id,g_menuPosition[id])
|
||||||
@ -123,8 +125,8 @@ displayTelMenu(id,pos) {
|
|||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody,511, g_coloredMenus ?
|
||||||
"\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" ,
|
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" ,
|
||||||
pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
|
id, "TELE_MENU", pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
|
||||||
|
|
||||||
new end = start + 6
|
new end = start + 6
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
@ -156,30 +158,30 @@ displayTelMenu(id,pos) {
|
|||||||
}
|
}
|
||||||
else if ( g_menuOption[id] ) { // -1
|
else if ( g_menuOption[id] ) { // -1
|
||||||
if ( g_coloredMenus )
|
if ( g_coloredMenus )
|
||||||
len += format(menuBody[len],511-len,"^n\d7. Current Location^n\w")
|
len += format(menuBody[len],511-len,"^n\d7. %L^n\w",id,"CUR_LOC")
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n#. Current Location^n")
|
len += format(menuBody[len],511-len,"^n#. %L^n",id,"CUR_LOC")
|
||||||
}
|
}
|
||||||
else { // 0
|
else { // 0
|
||||||
keys |= MENU_KEY_7
|
keys |= MENU_KEY_7
|
||||||
len += format(menuBody[len],511-len,"^n7. Current Location^n")
|
len += format(menuBody[len],511-len,"^n7. %L^n",id,"CUR_LOC")
|
||||||
}
|
}
|
||||||
|
|
||||||
len += format(menuBody[len],511-len,"8. Save Location^n")
|
len += format(menuBody[len],511-len,"8. %L^n",id,"SAVE_LOC")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (end != g_menuPlayersNum[id]) {
|
||||||
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
|
format(menuBody[len],511-len,"^n9. %L...^n0. %s", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
|
format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
show_menu(id,keys,menuBody,-1,"Teleport Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdTelMenu(id,level,cid) {
|
public cmdTelMenu(id,level,cid) {
|
||||||
if (cmd_access(id,level,cid,1))
|
if (cmd_access(id,level,cid,1))
|
||||||
displayTelMenu(id,g_menuPosition[id] = 0)
|
displayTelMenu(id,g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
@ -41,6 +41,7 @@ new g_Switch
|
|||||||
|
|
||||||
public plugin_init() {
|
public plugin_init() {
|
||||||
register_plugin("TimeLeft",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("TimeLeft",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||||
|
register_dictionary("timeleft.txt")
|
||||||
register_cvar("amx_time_voice","1")
|
register_cvar("amx_time_voice","1")
|
||||||
register_srvcmd("amx_time_display","setDisplaying")
|
register_srvcmd("amx_time_display","setDisplaying")
|
||||||
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
|
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
|
||||||
@ -50,7 +51,7 @@ public plugin_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public sayTheTime(id){
|
public sayTheTime(id){
|
||||||
if ( get_cvar_num("amx_time_voice") ){
|
if ( get_cvar_num("amx_time_voice") ) {
|
||||||
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
|
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
|
||||||
get_time("%H",mhours,5)
|
get_time("%H",mhours,5)
|
||||||
get_time("%M",mmins,5)
|
get_time("%M",mmins,5)
|
||||||
@ -74,11 +75,11 @@ public sayTheTime(id){
|
|||||||
}
|
}
|
||||||
new ctime[64]
|
new ctime[64]
|
||||||
get_time("%m/%d/%Y - %H:%M:%S",ctime,63)
|
get_time("%m/%d/%Y - %H:%M:%S",ctime,63)
|
||||||
client_print(0,print_chat, "The time: %s",ctime )
|
client_print(0,print_chat, "%L: %s",LANG_PLAYER,"THE_TIME",ctime )
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
public sayTimeLeft(id){
|
public sayTimeLeft(id) {
|
||||||
if (get_cvar_float("mp_timelimit")) {
|
if (get_cvar_float("mp_timelimit")) {
|
||||||
new a = get_timeleft()
|
new a = get_timeleft()
|
||||||
if ( get_cvar_num("amx_time_voice") ) {
|
if ( get_cvar_num("amx_time_voice") ) {
|
||||||
@ -86,35 +87,35 @@ public sayTimeLeft(id){
|
|||||||
setTimeVoice( svoice , 127 , 0 , a )
|
setTimeVoice( svoice , 127 , 0 , a )
|
||||||
client_cmd( id , svoice )
|
client_cmd( id , svoice )
|
||||||
}
|
}
|
||||||
client_print(0,print_chat, "Time Left: %d:%02d", (a / 60) , (a % 60) )
|
client_print(0,print_chat, "%L: %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60) , (a % 60) )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(0,print_chat, "No Time Limit" )
|
client_print(0,print_chat, "%L",LANG_PLAYER,"NO_T_LIMIT" )
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeText(text[],len,tmlf){
|
setTimeText(text[],len,tmlf,id) {
|
||||||
new secs = tmlf % 60
|
new secs = tmlf % 60
|
||||||
new mins = tmlf / 60
|
new mins = tmlf / 60
|
||||||
if (secs == 0)
|
if (secs == 0)
|
||||||
format(text,len,"%d minute%s", mins , (mins > 1) ? "s" : "" )
|
format(text,len,"%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE" )
|
||||||
else if (mins == 0)
|
else if (mins == 0)
|
||||||
format(text,len,"%d second%s", secs,(secs > 1) ? "s" : "" )
|
format(text,len,"%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND" )
|
||||||
else
|
else
|
||||||
format(text,len,"%d minute%s %d second%s", mins , (mins > 1) ? "s" : "" ,secs ,(secs > 1) ? "s" : "" )
|
format(text,len,"%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND" )
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeVoice(text[],len,flags,tmlf){
|
setTimeVoice(text[],len,flags,tmlf) {
|
||||||
new temp[7][32]
|
new temp[7][32]
|
||||||
new secs = tmlf % 60
|
new secs = tmlf % 60
|
||||||
new mins = tmlf / 60
|
new mins = tmlf / 60
|
||||||
for(new a = 0;a < 7;++a)
|
for (new a = 0;a < 7;++a)
|
||||||
temp[a][0] = 0
|
temp[a][0] = 0
|
||||||
if (secs > 0){
|
if (secs > 0){
|
||||||
num_to_word(secs,temp[4],31)
|
num_to_word(secs,temp[4],31)
|
||||||
if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */
|
if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */
|
||||||
}
|
}
|
||||||
if (mins > 59){
|
if (mins > 59) {
|
||||||
new hours = mins / 60
|
new hours = mins / 60
|
||||||
num_to_word(hours,temp[0],31)
|
num_to_word(hours,temp[0],31)
|
||||||
if (!(flags & 8)) temp[1] = "hours "
|
if (!(flags & 8)) temp[1] = "hours "
|
||||||
@ -128,10 +129,10 @@ setTimeVoice(text[],len,flags,tmlf){
|
|||||||
return format(text,len,"spk ^"vox/%s%s%s%s%s%s%s^"", temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6] )
|
return format(text,len,"spk ^"vox/%s%s%s%s%s%s%s^"", temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6] )
|
||||||
}
|
}
|
||||||
|
|
||||||
findDispFormat(time){
|
findDispFormat(time) {
|
||||||
for(new i = 0;g_TimeSet[i][0];++i){
|
for(new i = 0;g_TimeSet[i][0];++i) {
|
||||||
if (g_TimeSet[i][1] & 16){
|
if (g_TimeSet[i][1] & 16) {
|
||||||
if (g_TimeSet[i][0] > time){
|
if (g_TimeSet[i][0] > time) {
|
||||||
if (!g_Switch) {
|
if (!g_Switch) {
|
||||||
g_CountDown = g_Switch = time
|
g_CountDown = g_Switch = time
|
||||||
remove_task(8648458)
|
remove_task(8648458)
|
||||||
@ -140,18 +141,18 @@ findDispFormat(time){
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_TimeSet[i][0] == time){
|
else if (g_TimeSet[i][0] == time) {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDisplaying(){
|
public setDisplaying() {
|
||||||
new arg[32], flags[32], num[32]
|
new arg[32], flags[32], num[32]
|
||||||
new argc = read_argc() - 1
|
new argc = read_argc() - 1
|
||||||
new i = 0
|
new i = 0
|
||||||
while (i < argc && i < 32){
|
while (i < argc && i < 32) {
|
||||||
read_argv(i+1,arg,31)
|
read_argv(i+1,arg,31)
|
||||||
parse(arg,flags,31,num,31)
|
parse(arg,flags,31,num,31)
|
||||||
g_TimeSet[i][0] = str_to_num(num)
|
g_TimeSet[i][0] = str_to_num(num)
|
||||||
@ -162,7 +163,7 @@ public setDisplaying(){
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public timeRemain(param[]){
|
public timeRemain(param[]) {
|
||||||
new gmtm = get_timeleft()
|
new gmtm = get_timeleft()
|
||||||
new tmlf = g_Switch ? --g_CountDown : gmtm
|
new tmlf = g_Switch ? --g_CountDown : gmtm
|
||||||
new stimel[12]
|
new stimel[12]
|
||||||
@ -174,21 +175,25 @@ public timeRemain(param[]){
|
|||||||
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (tmlf > 0 && g_LastTime != tmlf){
|
if (tmlf > 0 && g_LastTime != tmlf) {
|
||||||
g_LastTime = tmlf
|
g_LastTime = tmlf
|
||||||
new tm_set = findDispFormat(tmlf)
|
new tm_set = findDispFormat(tmlf)
|
||||||
if ( tm_set != -1){
|
if ( tm_set != -1){
|
||||||
new flags = g_TimeSet[tm_set][1]
|
new flags = g_TimeSet[tm_set][1]
|
||||||
new arg[128]
|
new arg[128]
|
||||||
if (flags & 1){
|
if (flags & 1) {
|
||||||
setTimeText(arg,127,tmlf)
|
new players[32],pnum
|
||||||
if (flags & 16)
|
get_players(players,pnum,"c")
|
||||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1)
|
for (new i=0;i<pnum;i++) {
|
||||||
else
|
setTimeText(arg,127,tmlf,players[i])
|
||||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1)
|
if (flags & 16)
|
||||||
show_hudmessage(0,arg)
|
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1)
|
||||||
|
else
|
||||||
|
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1)
|
||||||
|
show_hudmessage(players[i],arg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flags & 2){
|
if (flags & 2) {
|
||||||
setTimeVoice(arg,127,flags,tmlf)
|
setTimeVoice(arg,127,flags,tmlf)
|
||||||
client_cmd(0,arg)
|
client_cmd(0,arg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user