updated to use the multi-lingual system | better code style

This commit is contained in:
Felix Geyer 2004-08-06 18:40:41 +00:00
parent 80a32b6d08
commit a8dab8993e
6 changed files with 562 additions and 578 deletions

View File

@ -53,9 +53,12 @@ new g_clcmdNum
new g_coloredMenus
public plugin_init()
{
public plugin_init() {
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_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
@ -70,16 +73,15 @@ public plugin_init()
g_coloredMenus = colored_menus()
new clcmds_ini_file[64];
get_configsdir(clcmds_ini_file, 63);
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file);
new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63)
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file)
}
/* Ban menu */
public actionBanMenu(id,key)
{
public actionBanMenu(id,key) {
switch (key) {
case 7: {
++g_menuOption[id]
@ -109,8 +111,8 @@ public actionBanMenu(id,key)
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: ban %s",name2)
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2)
}
if (equal("4294967295",authid2)) { /* lan */
@ -129,9 +131,7 @@ public actionBanMenu(id,key)
return PLUGIN_HANDLED
}
displayBanMenu(id,pos) {
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -146,8 +146,8 @@ displayBanMenu(id,pos){
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -155,45 +155,40 @@ displayBanMenu(id,pos){
if (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]
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
if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else
len += format(menuBody[len],511-len,"#. %s^n",name)
}
else
{
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
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
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])
{
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
if (end != g_menuPlayersNum[id]) {
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
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)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdBanMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
g_menuOption[id] = 1
g_menuSettings[id] = 5
@ -204,8 +199,7 @@ public cmdBanMenu(id,level,cid)
/* Slap/Slay */
public actionSlapMenu(id,key)
{
public actionSlapMenu(id,key) {
switch (key) {
case 7: {
++g_menuOption[id]
@ -225,9 +219,8 @@ public actionSlapMenu(id,key)
new name2[32]
get_user_name(player,name2,31)
if (!is_user_alive(player))
{
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
if (!is_user_alive(player)) {
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
displaySlapMenu(id,g_menuPosition[id])
return PLUGIN_HANDLED
}
@ -242,16 +235,16 @@ public actionSlapMenu(id,key)
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 )
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 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",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,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,g_menuSettings[id])
}
}
else {
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: slay %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: slay %s",name2)
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2)
}
}
@ -268,7 +261,6 @@ public actionSlapMenu(id,key)
displaySlapMenu(id,pos) {
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -283,8 +275,8 @@ displaySlapMenu(id,pos){
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" ,
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -292,20 +284,17 @@ displaySlapMenu(id,pos){
if (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]
get_user_name(i,name,31)
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
if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team)
else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
}
else
{
@ -317,18 +306,17 @@ displaySlapMenu(id,pos){
}
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
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])
{
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
if (end != g_menuPlayersNum[id]) {
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
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)
@ -364,8 +352,8 @@ public actionKickMenu(id,key)
name,get_user_userid(id),authid, name2,userid2,authid2 )
switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: kick %s",name2)
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2)
}
server_cmd("kick #%d",userid2)
@ -377,9 +365,7 @@ public actionKickMenu(id,key)
return PLUGIN_HANDLED
}
displayKickMenu(id,pos) {
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -394,8 +380,8 @@ displayKickMenu(id,pos){
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
new end = start + 8
new keys = MENU_KEY_0
@ -403,13 +389,11 @@ displayKickMenu(id,pos){
if (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]
get_user_name(i,name,31)
if ( get_user_flags(i) & ADMIN_IMMUNITY )
{
if ( access(i,ADMIN_IMMUNITY) ) {
++b
if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
@ -417,25 +401,22 @@ displayKickMenu(id,pos){
len += format(menuBody[len],511-len,"#. %s^n",name)
}
else
{
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
if (end != g_menuPlayersNum[id])
{
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
if (end != g_menuPlayersNum[id]) {
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
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))
displayKickMenu(id,g_menuPosition[id] = 0)
@ -444,8 +425,7 @@ public cmdKickMenu(id,level,cid)
/* Team menu */
public actionTeamMenu(id,key)
{
public actionTeamMenu(id,key) {
switch (key) {
case 7:{
g_menuOption[id] = 1 - g_menuOption[id]
@ -465,8 +445,8 @@ public actionTeamMenu(id,key)
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" )
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 1: client_print(0,print_chat,"ADMIN: transfer %s to %s",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,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
}
new limitt = get_cvar_num("mp_limitteams")
@ -486,7 +466,6 @@ public actionTeamMenu(id,key)
displayTeamMenu(id,pos) {
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -501,8 +480,8 @@ displayTeamMenu(id,pos){
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -510,43 +489,38 @@ displayTeamMenu(id,pos){
if (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]
get_user_name(i,name,31)
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
if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team)
else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
}
else
{
else {
keys |= (1<<b)
len += format(menuBody[len],511-len, g_coloredMenus ?
"%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])
{
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
}
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
g_menuOption[id] = 0
@ -558,8 +532,7 @@ public cmdTeamMenu(id,level,cid)
/* Client cmds menu */
public actionClcmdMenu(id,key)
{
public actionClcmdMenu(id,key) {
switch (key) {
case 7:{
++g_menuOption[id]
@ -595,9 +568,7 @@ public actionClcmdMenu(id,key)
return PLUGIN_HANDLED
}
displayClcmdMenu(id,pos) {
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -612,8 +583,8 @@ displayClcmdMenu(id,pos){
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n",
pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -621,22 +592,18 @@ displayClcmdMenu(id,pos){
if (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]
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
if ( g_coloredMenus )
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else
len += format(menuBody[len],511-len,"#. %s^n",name)
}
else
{
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
@ -645,21 +612,20 @@ displayClcmdMenu(id,pos){
if ( g_menuSelectNum[id] )
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] )
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])
{
format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit")
if (end != g_menuPlayersNum[id]) {
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
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)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdClcmdMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new flags = get_user_flags(id)
@ -676,17 +642,14 @@ public cmdClcmdMenu(id,level,cid)
return PLUGIN_HANDLED
}
load_settings( szFilename[] )
{
load_settings( szFilename[] ) {
if ( !file_exists ( szFilename ) )
return 0
new text[256], szFlags[32], szAccess[32]
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 ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,

View File

@ -149,47 +149,47 @@ new g_WeaponNames[MAXMENUPOS][] = {
}
new g_MenuItem[MAXMENUPOS][] = {
"\yHandguns^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"\yHandguns^n\w^n%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w^n",
"\yShotguns^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"\yShotguns^n\w^n%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w^n",
"\ySub-Machine Guns^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w^n",
"\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w^n",
"\ySniper Rifles^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%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",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w^n",
"\yEquipment^n\w^n%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w^n",
"\yAmmunition^n\w^n%d. %s\y\R%s^n\w",
"%d. %s\y\R%s^n\w"
"\yAmmunition^n\w^n%d. %s\y\R%L^n\w",
"%d. %s\y\R%L^n\w"
}
new g_Aliases[MAXMENUPOS][] = {
@ -329,7 +329,7 @@ switchCommand( id, action ){
new c = read_argc()
if ( c < 3 ) {
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
}
else {
@ -341,17 +341,17 @@ switchCommand( id, action ){
c = g_menusSets[a][1]
for (new i = g_menusSets[a][0]; i < c; ++i)
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
}
else if ( (a = findAliasId( arg )) != -1 ) {
g_Modified = found = true
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 )
console_print( id , "Couldn't find such equipment or weapon" )
console_print( id , "%L", id, "NO_EQ_WE" )
}
}
@ -378,54 +378,58 @@ public cmdRest(id,level,cid){
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1
new end = start + 10
if (end > MAXMENUPOS) end = MAXMENUPOS
console_print(id, "^n----- Weapons Restriction: -----")
console_print(id, " %-32.31s %-10.9s %-9.8s","name","value","status")
new lName[16],lValue[16],lStatus[16],lOnOf[16]
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 ) {
for (new a = start; a < end; ++a) {
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)
console_print(id,"----- Use 'amx_restrict list %i' for more -----",end+1)
console_print(id,"----- %L -----",id,"USE_MORE",end+1)
else
console_print(id,"----- Use 'amx_restrict list 1' for begin -----")
console_print(id,"----- %L -----",id,"USE_BEGIN")
}
else if ( equali( "save" , cmd ) ) {
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
}
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 ) ) {
setc( g_blockPos, 112, 0 ) // Clear current settings
new arg1[64]
if ( read_argv(2, arg1 , 63 ) )
{
if ( read_argv(2, arg1 , 63 ) ) {
new configsdir[32]
get_configsdir(configsdir,31)
format(arg1,63,"%s/%s",configsdir,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
}
else console_print( id , "Couldn't load configuration (file ^"%s^")" , arg1 )
else console_print( id, "%L", id, "COULDNT_LOAD", arg1 )
}
else {
console_print(id,"Usage: amx_restrict <command> [value]")
console_print(id,"Commands:")
console_print(id,"^ton - set restriction on whole equipment")
console_print(id,"^toff - remove restriction from whole equipment")
console_print(id,"^ton <value> [...] - set specified restriction")
console_print(id,"^toff <value> [...] - remove specified restriction")
console_print(id,"^tlist - display list of available equipment and weapons")
console_print(id,"^tsave - save restriction")
console_print(id,"^tload [file] - load restriction [from a file]")
console_print(id,"Available values to restrict are:^nammo, equip, pistol, shotgun, sub, rifle, machine")
console_print(id,"Type 'amx_restrict list' for more specified values")
console_print(id,"%L",id,"COM_USAGE")
console_print(id,"%L",id,"COM_COMMANDS")
console_print(id,"%L",id,"COM_ON")
console_print(id,"%L",id,"COM_OFF")
console_print(id,"%L",id,"COM_ON")
console_print(id,"%L",id,"COM_OFF")
console_print(id,"%L",id,"COM_LIST")
console_print(id,"%L",id,"COM_SAVE")
console_print(id,"%L",id,"COM_LOAD")
console_print(id,"%L",id,"COM_VALUES")
console_print(id,"%L",id,"COM_TYPE")
}
return PLUGIN_HANDLED
}
@ -434,21 +438,21 @@ displayMenu(id,pos){
if (pos < 0) return
new menubody[512], start = pos * 7
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
if (end > MAXMENUPOS) end = MAXMENUPOS
for (new a = start; a < end; ++a) {
keys |= (1<<k)
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) {
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
}
else format(menubody[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
show_menu(id,keys,menubody)
else format(menubody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menubody,-1,"Restrict Weapons")
}
public actionMenu(id,key) {
@ -456,9 +460,9 @@ public actionMenu(id,key){
case 7: {
if (saveSettings(g_saveFile)) {
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])
}
case 8: displayMenu(id,++g_Position[id])
@ -483,7 +487,8 @@ public client_command( id ){
do {
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
}
@ -493,7 +498,7 @@ public client_command( id ){
}
// 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++) {
server_print("%d", a)
server_print(weapon)
@ -501,7 +506,8 @@ stock WeaponIsBlocked(weapon[]) {
server_print(g_Aliases2[g_AliasBlock[ a ]])
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
}
}
@ -636,7 +642,7 @@ StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) {
}
// 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)
return false
@ -659,8 +665,7 @@ stock CheckBlockedItems(items[], blockedItem[AUTOBUYLENGTH + 1]) {
}
else
break
}
while (aValueWasParsed)
} while (aValueWasParsed)
return false // no blocked items found
}
@ -682,13 +687,15 @@ public fn_autobuy(id) {
public plugin_init() {
register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("restmenu.txt")
register_dictionary("common.txt")
register_clcmd("buyammo1","ammoRest1")
register_clcmd("buyammo2","ammoRest2")
register_clcmd("cl_setautobuy", "fn_setautobuy")
register_clcmd("cl_autobuy", "fn_autobuy")
register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu")
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("BuyShotgun", 1 ),511,"menuShotgun")
register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub")

View File

@ -47,6 +47,7 @@ new g_Frequency
public plugin_init() {
register_plugin("Scrolling Message",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("scrollmsg.txt")
register_srvcmd("amx_scrollmsg","setMessage")
}
@ -63,8 +64,7 @@ public showMsg(){
if (g_xPos > 0.35)
g_xPos -= 0.0063
else
{
else {
g_startPos++
g_xPos = 0.35
}
@ -81,9 +81,7 @@ public msgInit(){
client_print(0,print_console,g_scrollMsg)
}
public setMessage(id,level,cid) {
if (!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
public setMessage() {
remove_task(123) /* remove current messaging */
read_argv(1,g_scrollMsg,380)
new hostname[64]
@ -96,14 +94,14 @@ public setMessage(id,level,cid) {
if (g_Frequency > 0) {
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
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
}
console_print(id,"Scrolling message displaying frequency: %d:%02d minutes",
server_print("%L",LANG_SERVER,"MSG_FREQ")
g_Frequency/60,g_Frequency%60)
set_task(float(g_Frequency),"msgInit",123,"",0,"b")
}
else
console_print(id,"Scrolling message disabled")
server_print("%L",LANG_SERVER,"MSG_DISABLED")
return PLUGIN_HANDLED
}

View File

@ -47,6 +47,8 @@ new bool:g_modified
public plugin_precache() {
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")
}
@ -84,25 +86,25 @@ public cmdCfg( id,level,cid ){
}
}
if ( enabled )
console_print(id,"Total %d", enabled )
console_print(id,"%L", id, "TOTAL_NUM", enabled )
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" ) ) {
if ( saveSettings( g_fileToSave ) ){
g_modified = false
console_print(id,"Stats configuration saved successfully")
console_print(id,"%L",id,"CONF_SAVED")
}
else
console_print(id,"Failed to save stats configuration!!!")
console_print(id,"%L",id,"CONF_FAILED")
}
else if ( equali(cmds, "load" ) ) {
if ( loadSettings( g_fileToSave ) ){
g_modified = false
console_print(id,"Stats configuration loaded successfully")
console_print(id,"%L",id,"CONF_LOADED")
}
else
console_print(id,"Failed to load stats configuration!!!")
console_print(id,"%L",id,"CONF_FAIL_LOAD")
}
else if ( equali(cmds, "list" ) ) {
new arg1[8]
@ -111,19 +113,26 @@ public cmdCfg( id,level,cid ){
if (start >= g_menuDataNum) start = g_menuDataNum - 1
new end = start + 10
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 ) {
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,
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)
console_print(id,"----- Use 'amx_statscfg list %i' for more -----",end+1)
console_print(id,"----- %L -----",id,"USE_MORE",end+1)
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 ) {
if ( g_menuDataNum < MAX_MENU_DATA ) {
@ -132,17 +141,17 @@ public cmdCfg( id,level,cid ){
g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[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 {
console_print(id,"Usage: amx_statscfg <command> [parameters] ...")
console_print(id,"Commands:")
console_print(id,"^ton <variable> - enable specified option")
console_print(id,"^toff <variable> - disable specified option")
console_print(id,"^tsave - save stats configuration")
console_print(id,"^tload - load stats configuration")
console_print(id,"^tlist [id] - list stats status")
console_print(id,"^tadd <name> <variable> - add stats to the list")
console_print(id,"%L",id,"COM_USAGE")
console_print(id,"%L",id,"COM_COM")
console_print(id,"%L",id,"COM_ON")
console_print(id,"%L",id,"COM_OFF")
console_print(id,"%L",id,"COM_SAVE")
console_print(id,"%L",id,"COM_LOAD")
console_print(id,"%L",id,"COM_LIST")
console_print(id,"%L",id,"COM_ADD")
}
return PLUGIN_HANDLED
@ -158,24 +167,24 @@ displayCfgMenu(id,pos){
if (pos < 0) return
new menu_body[512], start = pos * 7
if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0
new len = format(menu_body,511,"\yStats Configuration\R%d/%d^n\w^n",
pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n",
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
if (end > g_menuDataNum) end = g_menuDataNum
for (new a = start; a < end; ++a) {
keys |= (1<<k)
len += format(menu_body[len],511-len,"%d. %s\y\R%s^n\w",++k,
g_menuData[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
len += format(menu_body[len],511-len,"%d. %s\y\R%L^n\w",++k,
g_menuData[a], id, get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
}
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,"^n8. Save configuration\y\R%s^n\w",g_modified ? "*" : "")
len += format(menu_body[len],511-len,"\d%L\w",id,"NO_STATS")
len += format(menu_body[len],511-len,"^n8. %L\y\R%s^n\w",id,"SAVE_CONF",g_modified ? "*" : "")
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
}
else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit")
show_menu(id,keys,menu_body)
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menu_body,-1,"Stats Configuration")
}
public actionCfgMenu(id,key) {
@ -183,10 +192,10 @@ public actionCfgMenu(id,key){
case 7: {
if (saveSettings(g_fileToSave)) {
g_modified = false
client_print(id,print_chat,"* Configuration saved successfully")
client_print(id,print_chat,"* %L",id,"CONF_SAVED")
}
else
client_print(id,print_chat,"* Failed to save configuration!!!")
client_print(id,print_chat,"* %L",id,"CONF_FAILED")
displayCfgMenu(id,g_menuPosition[id])
}
case 8: displayCfgMenu(id,++g_menuPosition[id])

View File

@ -45,6 +45,8 @@ new g_coloredMenus
public plugin_init() {
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_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")
@ -72,7 +74,7 @@ public actionTelMenu(id,key) {
get_user_name(player,name2,31)
if (!is_user_alive(player)) {
client_print(id,print_chat,"That action can't be performed on dead client ^"%s^"",name2)
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
displayTelMenu(id,g_menuPosition[id])
return PLUGIN_HANDLED
}
@ -96,8 +98,8 @@ public actionTelMenu(id,key) {
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2)
case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2)
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_2",name,name2)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_1",name2)
}
displayTelMenu(id,g_menuPosition[id])
@ -123,8 +125,8 @@ displayTelMenu(id,pos) {
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" ,
pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" ,
id, "TELE_MENU", pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
new end = start + 6
new keys = MENU_KEY_0|MENU_KEY_8
@ -156,25 +158,25 @@ displayTelMenu(id,pos) {
}
else if ( g_menuOption[id] ) { // -1
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
len += format(menuBody[len],511-len,"^n#. Current Location^n")
len += format(menuBody[len],511-len,"^n#. %L^n",id,"CUR_LOC")
}
else { // 0
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]) {
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
}
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) {

View File

@ -41,6 +41,7 @@ new g_Switch
public plugin_init() {
register_plugin("TimeLeft",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("timeleft.txt")
register_cvar("amx_time_voice","1")
register_srvcmd("amx_time_display","setDisplaying")
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
@ -74,7 +75,7 @@ public sayTheTime(id){
}
new ctime[64]
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
}
@ -86,22 +87,22 @@ public sayTimeLeft(id){
setTimeVoice( svoice , 127 , 0 , a )
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
client_print(0,print_chat, "No Time Limit" )
client_print(0,print_chat, "%L",LANG_PLAYER,"NO_T_LIMIT" )
return PLUGIN_CONTINUE
}
setTimeText(text[],len,tmlf){
setTimeText(text[],len,tmlf,id) {
new secs = tmlf % 60
new mins = tmlf / 60
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)
format(text,len,"%d second%s", secs,(secs > 1) ? "s" : "" )
format(text,len,"%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND" )
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) {
@ -181,12 +182,16 @@ public timeRemain(param[]){
new flags = g_TimeSet[tm_set][1]
new arg[128]
if (flags & 1) {
setTimeText(arg,127,tmlf)
new players[32],pnum
get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) {
setTimeText(arg,127,tmlf,players[i])
if (flags & 16)
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(0,arg)
show_hudmessage(players[i],arg)
}
}
if (flags & 2) {
setTimeVoice(arg,127,flags,tmlf)