new cleaned-up version of the plugins (no more OLOcode :D)

This commit is contained in:
Borja Ferrer 2005-09-12 21:06:24 +00:00
parent 12bf140931
commit ddf3b6df32
19 changed files with 4609 additions and 3646 deletions

View File

@ -38,11 +38,13 @@
new g_msgChannel
#define MAX_CLR 10
new g_Colors[MAX_CLR][] = {"COL_WHITE", "COL_RED", "COL_GREEN", "COL_BLUE", "COL_YELLOW", "COL_MAGENTA", "COL_CYAN", "COL_ORANGE", "COL_OCEAN", "COL_MAROON"}
new g_Values[MAX_CLR][] = {{255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}}
new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}}
public plugin_init() {
public plugin_init()
{
register_plugin("Admin Chat", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminchat.txt")
register_dictionary("common.txt")
@ -55,17 +57,26 @@ public plugin_init() {
register_concmd("amx_csay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends center hud message to all players")
}
public cmdSayChat(id) {
if (!access(id,ADMIN_CHAT)) return PLUGIN_CONTINUE
public cmdSayChat(id)
{
if (!access(id, ADMIN_CHAT))
return PLUGIN_CONTINUE
new said[6], i = 0
read_argv(1, said, 5)
while (said[i] == '@')
i++
if ( !i || i > 3 ) return PLUGIN_CONTINUE
if (!i || i > 3)
return PLUGIN_CONTINUE
new message[192], a = 0
read_args(message, 191)
remove_quotes(message)
switch(said[i]){
switch(said[i])
{
case 'r': a = 1
case 'g': a = 2
case 'b': a = 3
@ -74,24 +85,28 @@ public cmdSayChat(id) {
case 'c': a = 6
case 'o': a = 7
}
new name[32], authid[32], userid
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
userid = get_user_userid(id)
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message[i + 1])
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")",
name,userid,authid,message[ i+1 ],"en",g_Colors[a])
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message[i + 1], "en", g_Colors[a])
if (++g_msgChannel > 6 || g_msgChannel < 3)
g_msgChannel = 3
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2],
g_Pos[i][0], verpos , 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel )
if ( get_cvar_num("amx_show_activity") == 2 ){
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
if (get_cvar_num("amx_show_activity") == 2)
{
show_hudmessage(0, "%s : %s", name, message[i + 1])
client_print(0, print_notify, "%s : %s", name, message[i + 1])
}
else{
} else {
show_hudmessage(0, "%s", message[i + 1])
client_print(0, print_notify, "%s", message[i + 1])
}
@ -99,54 +114,76 @@ public cmdSayChat(id) {
return PLUGIN_HANDLED
}
public cmdSayAdmin(id) {
public cmdSayAdmin(id)
{
new said[2]
read_argv(1, said, 1)
if (said[0]!='@') return PLUGIN_CONTINUE
if (said[0] != '@')
return PLUGIN_CONTINUE
new message[192], name[32], authid[32], userid
new players[32], inum
read_args(message, 191)
remove_quotes(message)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
userid = get_user_userid(id)
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message[1])
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message[1])
format(message, 191, "(ADMINS) %s : %s", name, message[1])
get_players(players, inum)
for (new i=0; i<inum; ++i){
for (new i = 0; i < inum; ++i)
{
if (players[i] != id && get_user_flags(players[i]) & ADMIN_CHAT)
client_print(players[i], print_chat, "%s", message)
}
client_print(id, print_chat, "%s", message)
return PLUGIN_HANDLED
}
public cmdChat(id,level,cid) {
public cmdChat(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new message[192], name[32], players[32], inum, authid[32], userid
read_args(message, 191)
remove_quotes(message)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
userid = get_user_userid(id)
get_players(players, inum)
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message)
format(message, 191, "(ADMINS) %s : %s", name, message)
console_print(id, "%s", message)
for (new i = 0; i < inum; ++i) {
for (new i = 0; i < inum; ++i)
{
if (access(players[i], ADMIN_CHAT))
client_print(players[i], print_chat, "%s", message)
}
return PLUGIN_HANDLED
}
public cmdSay(id,level,cid) {
public cmdSay(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new message[192], name[32], authid[32], userid
read_args(message, 191)
remove_quotes(message)
get_user_authid(id, authid, 31)
@ -154,59 +191,83 @@ public cmdSay(id,level,cid) {
userid = get_user_userid(id)
client_print(0, print_chat, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
console_print(id, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name, userid, authid, message)
log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")", name, userid, authid, message)
return PLUGIN_HANDLED
}
public cmdPsay(id,level,cid) {
public cmdPsay(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new name[32]
read_argv(1, name, 31)
new priv = cmd_target(id, name, 0)
if (!priv) return PLUGIN_HANDLED
if (!priv)
return PLUGIN_HANDLED
new length = strlen(name) + 1
new message[192], name2[32], authid[32], authid2[32], userid, userid2
get_user_authid(id, authid, 31)
get_user_name(id, name2, 31)
userid = get_user_userid(id)
read_args(message, 191)
if (message[0]=='"' && message[length]=='"'){ // HLSW fix
if (message[0] == '"' && message[length] == '"') // HLSW fix
{
message[0] = ' '
message[length] = ' '
length += 2
}
remove_quotes(message[length])
get_user_name(priv, name, 31)
if (id&&id!=priv) client_print(id,print_chat,"(%s) %s : %s",name,name2,message[length])
if (id && id != priv)
client_print(id, print_chat, "(%s) %s : %s", name, name2, message[length])
client_print(priv, print_chat, "(%s) %s : %s", name, name2, message[length])
console_print(id, "(%s) %s : %s", name, name2, message[length])
get_user_authid(priv, authid2, 31)
userid2 = get_user_userid(priv)
log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"",
name2,userid,authid,name,userid2,authid2,message[length])
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")",
name2,userid,authid,name,userid2,authid2,message[length])
log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"", name2, userid, authid, name, userid2, authid2, message[length])
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")", name2, userid, authid, name, userid2, authid2, message[length])
return PLUGIN_HANDLED
}
public cmdTsay(id,level,cid) {
public cmdTsay(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new cmd[16], color[16], color2[16], message[192], name[32], authid[32], userid = 0
read_argv(0, cmd, 15)
new bool:tsay = (tolower(cmd[4]) == 't')
read_args(message, 191)
remove_quotes(message)
parse(message, color, 15)
new found = 0, a = 0
new lang[3], langnum = get_langsnum()
for (new i=0;i<MAX_CLR;++i) {
for (new j=0;j<langnum;j++) {
for (new i = 0; i < MAX_CLR; ++i)
{
for (new j = 0; j < langnum; j++)
{
get_lang(j, lang)
format(color2, 15, "%L", lang, g_Colors[i])
if (equali(color,color2)) {
if (equali(color, color2))
{
a = i
found = 1
break
@ -215,28 +276,32 @@ public cmdTsay(id,level,cid) {
if (found == 1)
break
}
new length = found ? (strlen(color) + 1) : 0
if (++g_msgChannel > 6 || g_msgChannel < 3)
g_msgChannel = 3
new Float:verpos = (tsay ? 0.55 : 0.1) + float(g_msgChannel) / 35.0
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
userid = get_user_userid(id)
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
if ( get_cvar_num("amx_show_activity") == 2 ){
if (get_cvar_num("amx_show_activity") == 2)
{
show_hudmessage(0, "%s : %s", name, message[length])
client_print(0, print_notify, "%s : %s", name, message[length])
console_print(id, "%s : %s", name, message[length])
}
else{
} else {
show_hudmessage(0, "%s", message[length])
client_print(0, print_notify, "%s", message[length])
console_print(id, "%s", message[length])
}
log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"", name, userid, authid, cmd[4], message[length])
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")",
name,userid,authid,cmd,message[length],color2)
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")", name, userid, authid, cmd, message[length], color2)
return PLUGIN_HANDLED
}

View File

@ -36,6 +36,7 @@
#include <amxmisc>
#define MAXRCONCVARS 16
new g_cvarRcon[MAXRCONCVARS][32]
new g_cvarRconNum
new g_pauseCon
@ -43,7 +44,8 @@ new Float:g_pausAble
new bool:g_Paused
new g_addCvar[] = "amx_cvar add %s"
public plugin_init() {
public plugin_init()
{
register_plugin("Admin Commands", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("admincmd.txt")
register_dictionary("common.txt")
@ -67,7 +69,8 @@ public plugin_init() {
register_clcmd("pauseAck", "cmdLBack")
}
public plugin_cfg() {
public plugin_cfg()
{
// Cvars which can be changed only with rcon access
server_cmd(g_addCvar, "rcon_password")
server_cmd(g_addCvar, "amx_show_activity")
@ -79,14 +82,20 @@ public plugin_cfg() {
server_cmd(g_addCvar, "amx_conmotd_file")
}
public cmdKick(id,level,cid) {
public cmdKick(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, 1)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
new authid[32], authid2[32], name2[32], name[32], userid2, reason[32]
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(player, name2, 31)
@ -94,12 +103,15 @@ public cmdKick(id,level,cid) {
userid2 = get_user_userid(player)
read_argv(2, reason, 31)
remove_quotes(reason)
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")",
name,get_user_userid(id),authid,name2,userid2,authid2,reason)
switch (get_cvar_num("amx_show_activity")) {
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, reason)
switch (get_cvar_num("amx_show_activity"))
{
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)
}
if (is_user_bot(player))
server_cmd("kick #%d", userid2)
else
@ -109,78 +121,104 @@ public cmdKick(id,level,cid) {
else
server_cmd("kick #%d", userid2)
}
console_print(id, "[AMXX] Client ^"%s^" kicked", name2)
return PLUGIN_HANDLED
}
public cmdUnban(id,level,cid) {
public cmdUnban(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32], authid[32], name[32]
read_argv(1, arg, 31)
if (contain(arg,".")!=-1) {
if (contain(arg, ".") != -1)
{
server_cmd("removeip ^"%s^";writeip", arg)
console_print(id, "[AMXX] %L", id, "IP_REMOVED", arg)
}
else {
} else {
server_cmd("removeid %s;writeid", arg)
console_print(id, "[AMXX] %L", id, "AUTHID_REMOVED", arg)
}
get_user_name(id, name, 31)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_2", name, arg)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_1", arg)
}
get_user_authid(id, authid, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"",
name,get_user_userid(id),authid, arg )
log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", name, get_user_userid(id), authid, arg)
return PLUGIN_HANDLED
}
public cmdAddBan(id,level,cid) {
public cmdAddBan(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new arg[32], authid[32], name[32], minutes[32], reason[32]
read_argv(1, arg, 31)
read_argv(2, minutes, 31)
read_argv(3, reason, 31)
if (contain(arg,".")!=-1) {
if (contain(arg, ".") != -1)
{
server_cmd("addip ^"%s^" ^"%s^";wait;writeip", minutes, arg)
console_print(id, "[AMXX] Ip ^"%s^" added to ban list", arg)
}
else {
} else {
server_cmd("banid ^"%s^" ^"%s^";wait;writeid", minutes, arg)
console_print(id, "[AMXX] Authid ^"%s^" added to ban list", arg)
}
get_user_name(id, name, 31)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_2", name, arg)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_1", arg)
}
get_user_authid(id, authid, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")",
name,get_user_userid(id),authid, arg, minutes, reason )
log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, arg, minutes, reason)
return PLUGIN_HANDLED
}
public cmdBan(id,level,cid) {
public cmdBan(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new target[32], minutes[8], reason[64]
read_argv(1, target, 31)
read_argv(2, minutes, 7)
read_argv(3, reason, 63)
new player = cmd_target(id, target, 9)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
new authid[32], name2[32], authid2[32], name[32]
new userid2 = get_user_userid(player)
get_user_authid(player, authid2, 31)
get_user_authid(id, authid, 31)
get_user_name(player, name2, 31)
get_user_name(id, name, 31)
userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")",
name,get_user_userid(id),authid, name2,userid2,authid2,minutes,reason)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
new temp[64], banned[16], nNum = str_to_num(minutes)
if (nNum)
@ -196,55 +234,68 @@ public cmdBan(id,level,cid) {
server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, banned, temp, minutes, authid2)
new activity = get_cvar_num("amx_show_activity")
if (activity!=0) {
if (activity != 0)
{
new players[32], pnum, msg[256], len
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
len = format(msg, 255, "%L", players[i], "ADMIN")
if (activity == 1)
len += copy(msg[len], 255-len, ":")
else
len += format(msg[len], 255-len, " %s:", name)
len += format(msg[len], 255-len, " %L", players[i], "BAN")
len += format(msg[len], 255-len, " %s ", name2)
if (nNum)
format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes)
else
format(msg[len], 255-len, "%L", players[i], "PERM")
client_print(players[i], print_chat, msg)
}
}
console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
return PLUGIN_HANDLED
}
public cmdBanIP(id,level,cid) {
public cmdBanIP(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new target[32], minutes[8], reason[64]
read_argv(1, target, 31)
read_argv(2, minutes, 7)
read_argv(3, reason, 63)
new player = cmd_target(id, target, 9)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
new authid[32], name2[32], authid2[32], name[32]
new userid2 = get_user_userid(player)
get_user_authid(player, authid2, 31)
get_user_authid(id, authid, 31)
get_user_name(player, name2, 31)
get_user_name(id, name, 31)
userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")",
name,get_user_userid(id),authid, name2,userid2,authid2,minutes,reason)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
new temp[64], banned[16], nNum = str_to_num(minutes)
if (nNum)
format(temp, 63, "%L", player, "FOR_MIN", minutes)
else
format(temp, 63, "%L", player, "PERM")
format(banned, 15, "%L", player, "BANNED")
new address[32]
@ -256,128 +307,177 @@ public cmdBanIP(id,level,cid) {
server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, banned, temp, minutes, address)
new activity = get_cvar_num("amx_show_activity")
if (activity!=0) {
if (activity != 0)
{
new players[32], pnum, msg[256], len
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
len = format(msg, 255, "%L", players[i], "ADMIN")
if (activity == 1)
len += copy(msg[len], 255-len, ":")
else
len += format(msg[len], 255-len, " %s:", name)
len += format(msg[len], 255-len, " %L", players[i], "BAN")
len += format(msg[len], 255-len, " %s ", name2)
if (nNum)
format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes)
else
format(msg[len], 255-len, "%L", players[i], "PERM")
client_print(players[i], print_chat, msg)
}
}
console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
return PLUGIN_HANDLED
}
public cmdSlay(id,level,cid) {
public cmdSlay(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, 5)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
user_kill(player)
new authid[32], name2[32], authid2[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(player, authid2, 31)
get_user_name(player, name2, 31)
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")) {
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, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2)
}
console_print(id, "[AMXX] %L", id, "CLIENT_SLAYED", name2)
return PLUGIN_HANDLED
}
public cmdSlap(id,level,cid) {
public cmdSlap(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, 5)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
new spower[32], authid[32], name2[32], authid2[32], name[32]
read_argv(2, spower, 31)
new damage = str_to_num(spower)
user_slap(player, damage)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(player, authid2, 31)
get_user_name(player, name2, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid, damage,name2,get_user_userid(player),authid2 )
switch (get_cvar_num("amx_show_activity")) {
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, damage, name2, get_user_userid(player), authid2)
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_2", name, name2, damage)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_1", name2, damage)
}
console_print(id, "[AMXX] %L", id, "CLIENT_SLAPED", name2, damage)
return PLUGIN_HANDLED
}
public chMap(map[]) {
public chMap(map[])
{
server_cmd("changelevel %s", map)
}
public cmdMap(id,level,cid) {
public cmdMap(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32]
new arglen = read_argv(1, arg, 31)
if ( !is_map_valid(arg) ){
if (!is_map_valid(arg))
{
console_print(id, "[AMXX] %L", id, "MAP_NOT_FOUND")
return PLUGIN_HANDLED
}
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_2", name, arg)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_1", arg)
}
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, arg)
new _modName[10]
get_modname(_modName, 9)
if (!equal(_modName,"zp")) {
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
set_task(2.0, "chMap", 0, arg, arglen + 1)
return PLUGIN_HANDLED
}
onlyRcon( name[] ) {
onlyRcon(name[])
{
for (new a = 0; a < g_cvarRconNum; ++a)
if (equal(g_cvarRcon[a], name))
return 1
return 0
}
public cmdCvar(id,level,cid) {
public cmdCvar(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[32], arg2[64]
read_argv(1, arg, 31)
read_argv(2, arg2, 63)
if ( equal(arg,"add") && (get_user_flags(id) & ADMIN_RCON) ) {
if ( cvar_exists(arg2) ){
if (equal(arg, "add") && (get_user_flags(id) & ADMIN_RCON))
{
if (cvar_exists(arg2))
{
if (g_cvarRconNum < MAXRCONCVARS)
copy(g_cvarRcon[g_cvarRconNum++], 31, arg2)
else
@ -385,36 +485,49 @@ public cmdCvar(id,level,cid) {
}
return PLUGIN_HANDLED
}
if (!cvar_exists(arg)){
if (!cvar_exists(arg))
{
console_print(id, "[AMXX] %L", id, "UNKNOWN_CVAR", arg)
return PLUGIN_HANDLED
}
if ( onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON)){
if (onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON))
{
console_print(id, "[AMXX] %L", id, "CVAR_NO_ACC")
return PLUGIN_HANDLED
}
else if (equal(arg,"sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD)){
else if (equal(arg, "sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD))
{
console_print(id, "[AMXX] %L", id, "CVAR_NO_ACC")
return PLUGIN_HANDLED
}
if (read_argc() < 3){
if (read_argc() < 3)
{
get_cvar_string(arg, arg2, 63)
console_print(id, "[AMXX] %L", id, "CVAR_IS", arg, arg2)
return PLUGIN_HANDLED
}
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")",
name,get_user_userid(id),authid, arg,arg2)
log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", name, get_user_userid(id), authid, arg, arg2)
set_cvar_string(arg, arg2)
new activity = get_cvar_num("amx_show_activity")
if (activity!=0) {
if (activity != 0)
{
new players[32], pnum, admin[64], cvar_val[64], len
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
len = format(admin, 255, "%L", players[i], "ADMIN")
if (activity == 1)
len += copy(admin[len], 255-len, ":")
else
@ -424,15 +537,17 @@ public cmdCvar(id,level,cid) {
format(cvar_val, 63, "*** %L ***", players[i], "PROTECTED")
else
copy(cvar_val, 63, arg2)
client_print(players[i], print_chat, "%L", players[i], "SET_CVAR_TO", admin, arg, arg2)
}
}
console_print(id, "[AMXX] %L", id, "CVAR_CHANGED", arg, arg2)
return PLUGIN_HANDLED
}
public cmdPlugins(id,level,cid) {
public cmdPlugins(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -447,12 +562,15 @@ public cmdPlugins(id,level,cid) {
new num = get_pluginsnum()
new running = 0
console_print(id,"%L:",id,"LOADED_PLUGINS")
console_print(id, "%L:", id, "LOADED_PLUGINS")
console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
for (new i=0;i<num;i++) {
for (new i = 0; i <num; i++)
{
get_plugin(i, filename, 31, name, 31, version, 31, author, 31, status, 31)
console_print(id, "%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", name, version, author, filename, status)
if (equal(status, "running"))
running++
}
@ -461,7 +579,8 @@ public cmdPlugins(id,level,cid) {
return PLUGIN_HANDLED
}
public cmdModules(id,level,cid) {
public cmdModules(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -473,14 +592,20 @@ public cmdModules(id,level,cid) {
format(lAuthor, 31, "%L", id, "AUTHOR")
new num = get_modulesnum()
console_print(id, "%L:", id, "LOADED_MODULES")
console_print(id, "%-23.22s %-8.7s %-20.19s", lName, lVersion, lAuthor)
for (new i=0;i<num;i++) {
for (new i = 0; i < num; i++)
{
get_module(i, name, 31, author, 31, version, 31, status)
switch (status) {
switch (status)
{
case module_loaded: copy(sStatus, 15, "running")
default: copy(sStatus, 15, "error")
}
console_print(id, "%-23.22s %-8.7s %-20.19s", name, version, author)
}
console_print(id, "%L", id, "NUM_MODULES", num)
@ -488,24 +613,32 @@ public cmdModules(id,level,cid) {
return PLUGIN_HANDLED
}
public cmdCfg(id,level,cid) {
public cmdCfg(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[128]
read_argv(1, arg, 127)
if (!file_exists(arg)) {
if (!file_exists(arg))
{
console_print(id, "[AMXX] %L", id, "FILE_NOT_FOUND", arg)
return PLUGIN_HANDLED
}
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" execute cfg (file ^"%s^")",
name,get_user_userid(id),authid, arg)
log_amx("Cmd: ^"%s<%d><%s><>^" execute cfg (file ^"%s^")", name, get_user_userid(id), authid, arg)
console_print(id, "[AMXX] Executing file ^"%s^"", arg)
server_cmd("exec %s", arg)
switch(get_cvar_num("amx_show_activity")) {
switch(get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_2", name, arg)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_1", arg)
}
@ -513,133 +646,179 @@ public cmdCfg(id,level,cid) {
return PLUGIN_HANDLED
}
public cmdLBack() {
public cmdLBack()
{
new paused[16]
format(paused, 15, "%L", g_pauseCon, g_Paused ? "UNPAUSED" : "PAUSED")
set_cvar_float("pausable", g_pausAble)
console_print(g_pauseCon, "[AMXX] Server %s", paused)
if (g_Paused) g_Paused = false
else g_Paused = true
if (g_Paused)
g_Paused = false
else
g_Paused = true
return PLUGIN_HANDLED
}
public cmdPause(id,level,cid) {
public cmdPause(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new authid[32], name[32], slayer = id
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
g_pausAble = get_cvar_float("pausable")
if (!slayer) slayer = find_player("h")
if (!slayer) {
if (!slayer)
slayer = find_player("h")
if (!slayer)
{
console_print(id, "[AMXX] %L", id, "UNABLE_PAUSE")
return PLUGIN_HANDLED
}
set_cvar_float("pausable", 1.0)
client_cmd(slayer, "pause;pauseAck")
log_amx("Cmd: ^"%s<%d><%s><>^" %s server",
name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" )
log_amx("Cmd: ^"%s<%d><%s><>^" %s server", name, get_user_userid(id), authid, g_Paused ? "unpause" : "pause")
new pausing[16]
format(pausing, 15, "%L", id, g_Paused ? "UNPAUSING" : "PAUSING")
console_print(id, "[AMXX] %L", id, pausing)
new activity = get_cvar_num("amx_show_activity")
if (activity!=0) {
if (activity != 0)
{
new players[32], pnum, msg[128], len
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
len = format(msg, 127, "%L", players[i], "ADMIN")
if (activity == 1)
len += copy(msg[len], 127-len, ":")
else
len += format(msg[len], 127-len, " %s: ", name)
format(msg[len], 127-len, "%L", players[i], g_Paused ? "UNPAUSE" : "PAUSE")
client_print(players[i], print_chat, "%s server", msg)
}
}
g_pauseCon = id
return PLUGIN_HANDLED
}
public cmdRcon(id,level,cid) {
public cmdRcon(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[128], authid[32], name[32]
read_args(arg, 127)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")",
name,get_user_userid(id),authid, arg)
log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")", name, get_user_userid(id), authid, arg)
console_print(id, "[AMXX] %L", id, "COM_SENT_SERVER", arg)
server_cmd("%s", arg)
return PLUGIN_HANDLED
}
public cmdWho(id,level,cid) {
public cmdWho(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new players[32], inum, cl_on_server[64], authid[32], name[32], flags, sflags[32]
new lImm[16], lRes[16], lAccess[16], lYes[16], lNo[16]
format(lImm, 15, "%L", id, "IMMU")
format(lRes, 15, "%L", id, "RESERV")
format(lAccess, 15, "%L", id, "ACCESS")
format(lYes, 15, "%L", id, "YES")
format(lNo, 15, "%L", id, "NO")
get_players(players, inum)
format(cl_on_server, 63, "%L", id, "CLIENTS_ON_SERVER")
console_print(id,"^n%s:^n # %-16.15s %-20s %-8s %-4.3s %-4.3s %s",
cl_on_server,"nick","authid","userid",lImm,lRes,lAccess)
for (new a = 0; a < inum; ++a) {
console_print(id, "^n%s:^n # %-16.15s %-20s %-8s %-4.3s %-4.3s %s", cl_on_server, "nick", "authid", "userid", lImm, lRes, lAccess)
for (new a = 0; a < inum; ++a)
{
get_user_authid(players[a], authid, 31)
get_user_name(players[a], name, 31)
flags = get_user_flags(players[a])
get_flags(flags, sflags, 31)
console_print(id, "%2d %-16.15s %-20s %-8d %-6.5s %-6.5s %s", players[a], name, authid,
get_user_userid(players[a]),(flags&ADMIN_IMMUNITY)?lYes:lNo,
(flags&ADMIN_RESERVATION)?lYes:lNo,sflags)
get_user_userid(players[a]), (flags&ADMIN_IMMUNITY) ? lYes : lNo, (flags&ADMIN_RESERVATION) ? lYes : lNo, sflags)
}
console_print(id, "%L", id, "TOTAL_NUM", inum)
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" ask for players list", name, get_user_userid(id), authid)
return PLUGIN_HANDLED
}
hasTag(name[],tags[4][32],tagsNum) {
hasTag(name[], tags[4][32], tagsNum)
{
for (new a = 0; a < tagsNum; ++a)
if (contain(name, tags[a]) != -1)
return a
return -1
}
public cmdLeave(id,level,cid) {
public cmdLeave(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new argnum = read_argc()
new ltags[4][32]
new ltagsnum = 0
for (new a=1;a<5;++a){
for (new a = 1; a < 5; ++a)
{
if (a < argnum)
read_argv(a, ltags[ltagsnum++], 31)
else
ltags[ltagsnum++][0] = 0
}
new nick[32], ires, pnum = get_maxplayers() + 1, count = 0, lReason[128]
for (new b=1;b<pnum;++b){
for (new b = 1; b < pnum; ++b)
{
if (!is_user_connected(b) && !is_user_connecting(b)) continue
get_user_name(b, nick, 31)
ires = hasTag(nick, ltags, ltagsnum)
if (ires!=-1){
if (ires != -1)
{
console_print(id, "[AMXX] %L", id, "SKIP_MATCH", nick, ltags[ires])
continue
}
if (get_user_flags(b)&ADMIN_IMMUNITY){
if (get_user_flags(b) & ADMIN_IMMUNITY)
{
console_print(id, "[AMXX] %L", id, "SKIP_IMM", nick)
continue
}
console_print(id, "[AMXX] %L", id, "KICK_PL", nick)
if (is_user_bot(b))
server_cmd("kick #%d", get_user_userid(b))
else
@ -649,14 +828,17 @@ public cmdLeave(id,level,cid) {
}
count++
}
console_print(id, "[AMXX] %L", id, "KICKED_CLIENTS", count)
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Kick: ^"%s<%d><%s><>^" leave some group (tag1 ^"%s^") (tag2 ^"%s^") (tag3 ^"%s^") (tag4 ^"%s^")",
name,get_user_userid(id),authid,ltags[0],ltags[1],ltags[2],ltags[3] )
log_amx("Kick: ^"%s<%d><%s><>^" leave some group (tag1 ^"%s^") (tag2 ^"%s^") (tag3 ^"%s^") (tag4 ^"%s^")", name, get_user_userid(id), authid, ltags[0], ltags[1], ltags[2], ltags[3])
switch(get_cvar_num("amx_show_activity")) {
switch(get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_2", name, ltags[0], ltags[1], ltags[2], ltags[3])
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_1", ltags[0], ltags[1], ltags[2], ltags[3])
}
@ -664,7 +846,8 @@ public cmdLeave(id,level,cid) {
return PLUGIN_HANDLED
}
public cmdNick(id,level,cid) {
public cmdNick(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
@ -674,7 +857,9 @@ public cmdNick(id,level,cid) {
read_argv(2, arg2, 31)
new player = cmd_target(id, arg1, 1)
if (!player) return PLUGIN_HANDLED
if (!player)
return PLUGIN_HANDLED
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
@ -683,14 +868,13 @@ public cmdNick(id,level,cid) {
client_cmd(player, "name ^"%s^"", arg2)
log_amx("Cmd: ^"%s<%d><%s><>^" change nick to ^"%s^" ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid,arg2,name2,get_user_userid(player),authid2 )
log_amx("Cmd: ^"%s<%d><%s><>^" change nick to ^"%s^" ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, arg2, 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, "%L", LANG_PLAYER, "ADMIN_NICK_2", name, name2, arg2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_NICK_1", name2, arg2)
}
console_print(id, "[AMXX] %L", id, "CHANGED_NICK", name2, arg2)
return PLUGIN_HANDLED

View File

@ -37,29 +37,34 @@
#define DISPLAY_MSG // Comment to disable message on join
#define HELPAMOUNT 10 // Number of commands per page
public plugin_init() {
public plugin_init()
{
register_plugin("Admin Help", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminhelp.txt")
register_concmd("amx_help", "cmdHelp", 0, "<page> [nr of cmds (only for server)] - displays this help")
}
#if defined DISPLAY_MSG
public client_putinserver(id) {
public client_putinserver(id)
{
if (is_user_bot(id))
return
set_task(15.0, "dispInfo", id)
}
public client_disconnect(id) {
public client_disconnect(id)
{
remove_task(id)
}
#endif
public cmdHelp(id,level,cid) {
public cmdHelp(id, level, cid)
{
new arg1[8], flags = get_user_flags(id)
new start = read_argv(1, arg1, 7) ? str_to_num(arg1) : 1
new lHelpAmount = HELPAMOUNT
if (id == 0 && read_argc() == 3)
lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
@ -72,16 +77,19 @@ public cmdHelp(id,level,cid) {
start = clcmdsnum - 1
console_print(id, "^n----- %L -----", id, "HELP_COMS")
new info[128], cmd[32], eflags
new end = start + lHelpAmount // HELPAMOUNT
if (end > clcmdsnum)
end = clcmdsnum
for (new i = start; i < end; i++) {
for (new i = start; i < end; i++)
{
get_concmd(i, cmd, 31, eflags, info, 127, flags, id)
console_print(id, "%3d: %s %s", i + 1, cmd, info)
}
console_print(id, "----- %L -----", id, "HELP_ENTRIES", start + 1, end, clcmdsnum)
if (end < clcmdsnum)
@ -93,16 +101,21 @@ public cmdHelp(id,level,cid) {
}
#if defined DISPLAY_MSG
public dispInfo(id) {
public dispInfo(id)
{
client_print(id, print_chat, "%L", id, "TYPE_HELP")
new nextmap[32]
get_cvar_string("amx_nextmap", nextmap, 31)
if (get_cvar_float("mp_timelimit")) {
if (get_cvar_float("mp_timelimit"))
{
new timeleft = get_timeleft()
if (timeleft > 0) {
if (timeleft > 0)
{
client_print(id, print_chat, "%L", id, "TIME_INFO_1", timeleft / 60, timeleft % 60, nextmap)
}
else {
} else {
client_print(id, print_chat, "%L", id, "TIME_INFO_2", nextmap)
}
}

View File

@ -40,15 +40,14 @@
new g_cmdLoopback[16]
public plugin_init() {
public plugin_init()
{
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminslots.txt")
register_dictionary("common.txt")
register_cvar("amx_reservation", "1")
format( g_cmdLoopback, 15, "amxres%c%c%c%c" ,
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
format(g_cmdLoopback, 15, "amxres%c%c%c%c", random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'))
register_clcmd(g_cmdLoopback, "ackSignal")
#if defined HIDE_RESERVED_SLOTS
@ -59,13 +58,15 @@ public plugin_init() {
#endif
}
public ackSignal(id) {
public ackSignal(id)
{
new lReason[64]
format(lReason, 63, "%L", id, "DROPPED_RES")
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
}
public client_authorized(id) {
public client_authorized(id)
{
new maxplayers = get_maxplayers()
new players = get_playersnum(1)
new limit = maxplayers - get_cvar_num("amx_reservation")
@ -87,8 +88,8 @@ public client_authorized(id) {
public client_disconnect(id)
{
new maxplayers = get_maxplayers()
setVisibleSlots( get_playersnum(1) - 1 , maxplayers ,
maxplayers - get_cvar_num("amx_reservation") )
setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_cvar_num("amx_reservation"))
return PLUGIN_CONTINUE
}

View File

@ -48,7 +48,8 @@ new g_execLen
new bool:g_execResult
new Float:g_voteRatio
public plugin_init() {
public plugin_init()
{
register_plugin("Admin Votes", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminvote.txt")
register_dictionary("common.txt")
@ -64,26 +65,36 @@ public plugin_init() {
register_concmd("amx_voteban", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
register_concmd("amx_vote", "cmdVote", ADMIN_VOTE, "<question> <answer#1> <answer#2>")
register_concmd("amx_cancelvote", "cmdCancelVote", ADMIN_VOTE, "- cancels last vote")
g_coloredMenus = colored_menus()
}
public cmdCancelVote(id,level,cid) {
public cmdCancelVote(id, level, cid)
{
if (!cmd_access(id, level, cid, 0))
return PLUGIN_HANDLED
if ( task_exists( 99889988 , 1 ) ) {
if (task_exists(99889988, 1))
{
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid)
new players[32], pnum, lTag[16], activity = get_cvar_num("amx_show_activity")
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum;i ++)
{
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
switch (activity) {
switch (activity)
{
case 2: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name)
case 1: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag)
}
}
console_print(id, "%L", id, "VOTING_CANC")
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTING_CANC")
remove_task(99889988, 1)
@ -98,59 +109,84 @@ public cmdCancelVote(id,level,cid) {
public delayedExec(cmd[])
server_cmd(cmd)
public autoRefuse() {
public autoRefuse()
{
log_amx("Vote: %L", "en", "RES_REF")
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_REF")
}
public actionResult(id,key) {
public actionResult(id, key)
{
remove_task(4545454)
switch (key) {
case 0: {
switch (key)
{
case 0:
{
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
log_amx("Vote: %L", "en", "RES_ACCEPTED")
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_ACCEPTED")
}
case 1: autoRefuse()
}
return PLUGIN_HANDLED
}
public checkVotes() {
public checkVotes()
{
new best = 0
if ( !g_yesNoVote ) {
if (!g_yesNoVote)
{
for (new a = 0; a < 4; ++a)
if (g_voteCount[a] > g_voteCount[best])
best = a
}
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
new iRatio = votesNum ? floatround(g_voteRatio * float(votesNum), floatround_ceil) : 1
new iResult = g_voteCount[best]
new players[32], pnum, i
get_players(players, pnum, "c")
if ( iResult < iRatio ) {
if (iResult < iRatio)
{
new lVotingFailed[64]
for (i=0;i<pnum;i++) {
for (i = 0; i < pnum; i++)
{
format(lVotingFailed, 63, "%L", players[i], "VOTING_FAILED")
if (g_yesNoVote)
client_print(players[i],print_chat,"%L",players[i],"VOTING_RES_1",
lVotingFailed,g_voteCount[0],g_voteCount[1],iRatio)
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_1", lVotingFailed, g_voteCount[0], g_voteCount[1], iRatio)
else
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_2", lVotingFailed, iResult, iRatio)
}
format(lVotingFailed, 63, "%L", "en", "VOTING_FAILED")
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")", lVotingFailed, iResult, iRatio)
return PLUGIN_CONTINUE
}
g_execLen = format(g_Execute, 255, g_Answer, g_optionName[best]) + 1
if (g_execResult) {
if (g_execResult)
{
g_execResult = false
if ( is_user_connected(g_voteCaller) ) {
if (is_user_connected(g_voteCaller))
{
new menuBody[512], lTheResult[32], lYes[16], lNo[16]
format(lTheResult, 31, "%L", g_voteCaller, "THE_RESULT")
format(lYes, 15, "%L", g_voteCaller, "YES")
format(lNo, 15, "%L", g_voteCaller, "NO")
new len = format(menuBody, 511, g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
format(menuBody[len], 511 - len, "^n1. %s^n2. %s", lYes, lNo)
show_menu(g_voteCaller, 0x03, menuBody, 10, "The result: ")
@ -159,110 +195,143 @@ public checkVotes() {
else
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
}
new lVotingSuccess[32]
for (i=0;i<pnum;i++) {
for (i = 0; i < pnum; i++)
{
format(lVotingSuccess, 31, "%L", players[i], "VOTING_SUCCESS")
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_3", lVotingSuccess, iResult, iRatio, g_Execute)
}
format(lVotingSuccess, 31, "%L", "en", "VOTING_SUCCESS")
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult, iRatio, g_Execute)
return PLUGIN_CONTINUE
}
public voteCount(id,key) {
if ( get_cvar_num("amx_vote_answers") ) {
public voteCount(id, key)
{
if (get_cvar_num("amx_vote_answers"))
{
new name[32]
get_user_name(id, name, 31)
if (g_yesNoVote)
client_print(0, print_chat, "%L", LANG_PLAYER, key ? "VOTED_AGAINST" : "VOTED_FOR", name)
else
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTED_FOR_OPT", name, key + 1)
}
++g_voteCount[key]
return PLUGIN_HANDLED
}
public cmdVoteMap(id,level,cid) {
public cmdVoteMap(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()) {
if (voting > get_gametime())
{
console_print(id, "%L", id, "ALREADY_VOTING")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED
}
new argc = read_argc()
if (argc > 5) argc = 5
g_validMaps = 0
g_optionName[0][0] = 0
g_optionName[1][0] = 0
g_optionName[2][0] = 0
g_optionName[3][0] = 0
for (new i = 1; i < argc; ++i) {
for (new i = 1; i < argc; ++i)
{
read_argv(i, g_optionName[g_validMaps], 31)
if (is_map_valid(g_optionName[g_validMaps]))
g_validMaps++
}
if (g_validMaps == 0) {
if (g_validMaps == 0)
{
new lMaps[16]
format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
return PLUGIN_HANDLED
}
new menu_msg[256], len = 0
new keys = 0
if (g_validMaps > 1) {
if (g_validMaps > 1)
{
keys = MENU_KEY_0
len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
new temp[128]
for (new a = 0; a < g_validMaps; ++a) {
for (new a = 0; a < g_validMaps; ++a)
{
format(temp, 127, "%d. %s^n", a+1, g_optionName[a])
len += copy(menu_msg[len], 255-len, temp)
keys |= (1<<a)
}
format(menu_msg[len], 255-len, "^n0. %L", LANG_SERVER, "NONE")
g_yesNoVote = 0
}
else {
} else {
new lChangeMap[32], lYes[16], lNo[16]
format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
format(lYes, 15, "%L", LANG_SERVER, "YES")
format(lNo, 15, "%L", LANG_SERVER, "NO")
format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s"
: "%s %s?^n^n1. %s^n2. %s",lChangeMap,g_optionName[0],lYes,lNo)
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
keys = MENU_KEY_1|MENU_KEY_2
g_yesNoVote = 1
}
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
if (argc == 2)
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")",
name,get_user_userid(id),authid,g_optionName[0])
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
else
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
name,get_user_userid(id),authid,g_optionName[0],g_optionName[1],g_optionName[2],g_optionName[3])
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3])
new lTag[16], activity = get_cvar_num("amx_show_activity")
if (activity>0) {
if (activity > 0)
{
new players[32], pnum
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
switch (activity) {
case 2: client_print(players[i],print_chat,"%L",
players[i],"ADMIN_VOTE_MAP_2",lTag,name)
case 1: client_print(players[i],print_chat,"%L",
players[i],"ADMIN_VOTE_MAP_1",lTag)
switch (activity)
{
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_2", lTag, name)
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_1", lTag)
}
}
}
g_execResult = true
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
g_voteRatio = get_cvar_float("amx_votemap_ratio")
g_Answer = "changelevel %s"
@ -271,45 +340,60 @@ public cmdVoteMap(id,level,cid) {
g_voteCaller = id
console_print(id, "%L", id, "VOTING_STARTED")
g_voteCount = {0, 0, 0, 0}
return PLUGIN_HANDLED
}
public cmdVote(id,level,cid) {
public cmdVote(id, level, cid)
{
if (!cmd_access(id, level, cid, 4))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()) {
if (voting > get_gametime())
{
console_print(id, "%L", id, "ALREADY_VOTING")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED
}
new quest[48]
read_argv(1, quest, 47)
if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)||
(contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1))
if ((contain(quest, "sv_password") != -1) || (contain(quest, "rcon_password") != -1) || (contain(quest, "kick") != -1) ||
(contain(quest, "addip") != -1) || (contain(quest, "ban") != -1))
{
console_print(id, "%L", id, "VOTING_FORBIDDEN")
return PLUGIN_HANDLED
}
read_argv(2, g_optionName[0], 31)
read_argv(3, g_optionName[1], 31)
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")",
name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1])
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1])
new activity = get_cvar_num("amx_show_activity")
if (activity>0) {
if (activity > 0)
{
new players[32], pnum, lTag[16]
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
switch (activity) {
switch (activity)
{
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_2", lTag, name)
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_1", lTag)
}
@ -317,12 +401,15 @@ public cmdVote(id,level,cid) {
}
new menu_msg[256], lVote[16]
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
new keys = MENU_KEY_1|MENU_KEY_2
format(menu_msg,255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s"
: "%s: %s^n^n1. %s^n2. %s",lVote,quest,g_optionName[0],g_optionName[1])
format(menu_msg, 255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s" : "%s: %s^n^n1. %s^n2. %s", lVote, quest, g_optionName[0], g_optionName[1])
g_execResult = false
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
g_voteRatio = get_cvar_float("amx_vote_ratio")
format(g_Answer, 127, "%s - %%s", quest)
@ -332,30 +419,45 @@ public cmdVote(id,level,cid) {
console_print(id, "%L", id, "VOTING_STARTED")
g_voteCount = {0, 0, 0, 0}
g_yesNoVote = 0
return PLUGIN_HANDLED
}
public cmdVoteKickBan(id,level,cid) {
public cmdVoteKickBan(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new Float:voting = get_cvar_float("amx_last_voting")
if (voting > get_gametime()) {
if (voting > get_gametime())
{
console_print(id, "%L", id, "ALREADY_VOTING")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED
}
new cmd[32]
read_argv(0, cmd, 31)
new voteban = equal(cmd, "amx_voteban")
new arg[32]
read_argv(1, arg, 31)
new player = cmd_target(id, arg, 1)
if (!player) return PLUGIN_HANDLED
if (voteban && is_user_bot(player)) {
if (!player)
return PLUGIN_HANDLED
if (voteban && is_user_bot(player))
{
new imname[32]
get_user_name(player, imname, 31)
console_print(id, "%L", id, "ACTION_PERFORMED", imname)
return PLUGIN_HANDLED
@ -363,44 +465,49 @@ public cmdVoteKickBan(id,level,cid) {
new keys = MENU_KEY_1|MENU_KEY_2
new menu_msg[256], lYes[16], lNo[16], lKickBan[16]
format(lYes, 15, "%L", LANG_SERVER, "YES")
format(lNo, 15, "%L", LANG_SERVER, "NO")
format(lKickBan, 15, "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
ucfirst(lKickBan)
get_user_name(player, arg, 31)
format(menu_msg,255,g_coloredMenus ?
"\y%s %s?\w^n^n1. %s^n2. %s" :
"%s %s?^n^n1. %s^n2. %s",
lKickBan, arg, lYes, lNo)
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
g_yesNoVote = 1
if (voteban)
get_user_authid(player, g_optionName[0], 31)
else
num_to_str(get_user_userid(player), g_optionName[0], 31)
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",
name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg)
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg)
new activity = get_cvar_num("amx_show_activity")
if (activity>0) {
if (activity > 0)
{
new players[32], pnum, lTag[16]
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
for (new i = 0; i < pnum; i++)
{
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "USER")
format(lKickBan, 15, "%L", players[i], voteban ? "BAN" : "KICK")
switch (activity) {
case 2: client_print(players[i],print_chat,"%L",
players[i],"ADMIN_VOTE_FOR_2",lTag,name,lKickBan,arg)
case 1: client_print(players[i],print_chat,"%L",
players[i],"ADMIN_VOTE_FOR_1",lTag,lKickBan,arg)
switch (activity)
{
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_2", lTag, name, lKickBan, arg)
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_1", lTag, lKickBan, arg)
}
}
}
g_execResult = true
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
g_Answer = voteban ? "banid 30.0 %s kick" : "kick #%s"
@ -409,5 +516,6 @@ public cmdVoteKickBan(id,level,cid) {
g_voteCaller = id
console_print(id, "%L", id, "VOTING_STARTED")
g_voteCount = {0, 0, 0, 0}
return PLUGIN_HANDLED
}

View File

@ -37,7 +37,8 @@
new Float:g_Flooding[33] = {0.0, ...}
new g_Flood[33] = {0, ...}
public plugin_init() {
public plugin_init()
{
register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("antiflood.txt")
register_clcmd("say", "chkFlood")
@ -45,22 +46,26 @@ public plugin_init() {
register_cvar("amx_flood_time", "0.75")
}
public chkFlood(id) {
public chkFlood(id)
{
new Float:maxChat = get_cvar_float("amx_flood_time")
if ( maxChat ) {
if (maxChat)
{
new Float:nexTime = get_gametime()
if ( g_Flooding[id] > nexTime ) {
if (g_Flood[id] >= 3) {
if (g_Flooding[id] > nexTime)
{
if (g_Flood[id] >= 3)
{
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
g_Flooding[id] = nexTime + maxChat + 3.0
return PLUGIN_HANDLED
}
g_Flood[id]++
}
else {
if (g_Flood[id])
else if (g_Flood[id])
{
g_Flood[id]--
}

View File

@ -39,25 +39,29 @@
#define MAX_CMDS_LAYERS 3
new g_cmdMenuName[ MAX_CMDS_LAYERS ][] = {
new g_cmdMenuName[MAX_CMDS_LAYERS][] =
{
"CMD_MENU",
"CONF_MENU",
"SPE_MENU"
}
new g_cmdMenuCmd[ MAX_CMDS_LAYERS ][] = {
new g_cmdMenuCmd[MAX_CMDS_LAYERS][] =
{
"amx_cmdmenu",
"amx_cfgmenu",
"amx_speechmenu"
}
new g_cmdMenuCfg[ MAX_CMDS_LAYERS ][] = {
new g_cmdMenuCfg[MAX_CMDS_LAYERS][] =
{
"cmds.ini",
"configs.ini",
"speech.ini"
}
new g_cmdMenuHelp[ MAX_CMDS_LAYERS ][] = {
new g_cmdMenuHelp[MAX_CMDS_LAYERS][] =
{
"- displays commands menu",
"- displays configs menu",
"- displays speech menu"
@ -86,15 +90,19 @@ new g_menuLayer[33]
new g_coloredMenus
public plugin_init() {
public plugin_init()
{
register_plugin("Commands Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("cmdmenu.txt")
register_dictionary("common.txt")
new configsDir[64], config[64]
get_configsdir(configsDir, 63)
for (new a = 0; a < MAX_CMDS_LAYERS; ++a) {
for (new a = 0; a < MAX_CMDS_LAYERS; ++a)
{
new MenuName[64]
format(MenuName, 63, "%L", "en", g_cmdMenuName[a])
register_menucmd(register_menuid(MenuName), 1023, "actionCmdMenu")
register_clcmd(g_cmdMenuCmd[a], "cmdCmdMenu", ADMIN_MENU, g_cmdMenuHelp[a])
@ -114,28 +122,36 @@ public plugin_init() {
/* Commands menu */
public actionCmdMenu(id,key) {
switch (key) {
public actionCmdMenu(id, key)
{
switch (key)
{
case 8: displayCmdMenu(id, ++g_menuPosition[id])
case 9: displayCmdMenu(id, --g_menuPosition[id])
default:{
default:
{
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
new flags = g_cmdMisc[option][1]
if (flags & 1)
server_cmd(g_cmdCmd[option])
else if (flags & 2)
client_cmd(id, g_cmdCmd[option])
else if (flags & 4)
client_cmd(0, g_cmdCmd[option])
if ( flags & 8 ) displayCmdMenu(id,g_menuPosition[id])
if (flags & 8)
displayCmdMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayCmdMenu(id,pos) {
if (pos < 0) return
displayCmdMenu(id, pos)
{
if (pos < 0)
return
new menuBody[512]
new b = 0
@ -144,68 +160,71 @@ displayCmdMenu(id,pos) {
if (start >= g_menuSelectNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511,g_coloredMenus ?
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" , id, g_cmdMenuName[ g_menuLayer[id] ],
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, g_cmdMenuName[g_menuLayer[id]], pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
if (end > g_menuSelectNum[id])
end = g_menuSelectNum[id]
for(new a = start; a < end; ++a) {
if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' ) {
for (new a = start; a < end; ++a)
{
if (g_cmdCmd[g_menuSelect[id][a]][0] == '-')
{
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%s^n\w", g_cmdName[g_menuSelect[id][a]])
else
len += format(menuBody[len], 511-len, "%s^n", g_cmdName[g_menuSelect[id][a]])
++b
}
else {
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_cmdName[g_menuSelect[id][a]])
}
}
if (end != g_menuSelectNum[id]) {
if (end != g_menuSelectNum[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. %L", id, pos ? "BACK" : "EXIT" )
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
new MenuName[64]
format(MenuName, 63, "%L", "en", g_cmdMenuName[g_menuLayer[id]])
show_menu(id, keys, menuBody, -1, MenuName)
}
public cmdCmdMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdCmdMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new szCmd[32]
read_argv(0, szCmd, 31)
new lvl = 0
while( lvl < MAX_CMDS_LAYERS ) {
while (lvl < MAX_CMDS_LAYERS)
{
if (equal(g_cmdMenuCmd[lvl], szCmd))
break
++lvl
}
g_menuLayer[id] = lvl
new flags = get_user_flags(id)
g_menuSelectNum[id] = 0
new a = lvl * MAX_CMDS
new d, c = 0
while( c < g_cmdNum[ lvl ] ) {
while (c < g_cmdNum[lvl])
{
d = a + c
if ( g_cmdMisc[ d ][0] & flags ) {
if (g_cmdMisc[d][0] & flags)
{
g_menuSelect[id][g_menuSelectNum[id]++] = d
}
@ -217,22 +236,23 @@ public cmdCmdMenu(id,level,cid) {
return PLUGIN_HANDLED
}
loadCmdSettings( szFilename[], level ) {
loadCmdSettings(szFilename[], level)
{
if (!file_exists(szFilename))
return 0
new text[256], szFlags[32], szAccess[32]
new a, pos = 0, c, d = level * MAX_CMDS
while ( g_cmdNum[ level ] < MAX_CMDS && read_file (szFilename,pos++,text,255,a) ) {
while (g_cmdNum[level] < MAX_CMDS && read_file(szFilename, pos++, text, 255, a))
{
if (text[0] == ';') continue
c = d + g_cmdNum[level]
if ( parse( text , g_cmdName[ c ] , 31 ,
g_cmdCmd[ c ] ,63,szFlags,31,szAccess,31 ) > 3 ) {
while ( replace( g_cmdCmd[ c ] ,63,"\'","^"") ) {
if (parse(text, g_cmdName[c], 31, g_cmdCmd[c], 63, szFlags, 31, szAccess, 31) > 3)
{
while (replace(g_cmdCmd[c], 63, "\'", "^""))
{
// do nothing
}
@ -245,49 +265,54 @@ loadCmdSettings( szFilename[], level ) {
return 1
}
/* Cvars menu */
public actionCvarMenu(id,key) {
switch (key){
public actionCvarMenu(id, key)
{
switch (key)
{
case 8: displayCvarMenu(id, ++g_menuPosition[id])
case 9: displayCvarMenu(id, --g_menuPosition[id])
default: {
default:
{
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
new szValue[32]
get_cvar_string(g_cvarNames[option], szValue, 31)
new end = g_cvarMisc[option][2]
new start = g_cvarMisc[option][1]
for (new i = start ; ; ++i ) {
if ( i < end ) {
for (new i = start; ; ++i)
{
if (i < end)
{
if (equal(szValue, g_cvarCmd[i]))
{
if (++i >= end)
{
i = start
}
set_cvar_string(g_cvarNames[option], g_cvarCmd[i])
break
}
}
else {
} else {
set_cvar_string(g_cvarNames[option], g_cvarCmd[start])
break
}
}
displayCvarMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayCvarMenu(id,pos) {
if (pos < 0) return
displayCvarMenu(id, pos)
{
if (pos < 0)
return
new menuBody[512]
new b = 0
@ -296,9 +321,7 @@ displayCvarMenu(id,pos) {
if (start >= g_menuSelectNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n",
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
new len = format(menuBody, 511, g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
@ -307,29 +330,35 @@ displayCvarMenu(id,pos) {
if (end > g_menuSelectNum[id])
end = g_menuSelectNum[id]
for(new a = start; a < end; ++a) {
for (new a = start; a < end; ++a)
{
get_cvar_string(g_cvarNames[g_menuSelect[id][a]], szValue, 31)
keys |= (1<<b)
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "%d. %s\R%s^n\w", b, g_cvarNames[g_menuSelect[id][a]], szValue)
else
len += format(menuBody[len], 511-len, "%d. %s %s^n", b, g_cvarNames[g_menuSelect[id][a]], szValue)
}
if (end != g_menuSelectNum[id]) {
if (end != g_menuSelectNum[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. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody)
}
public cmdCvarMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdCvarMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new flags = get_user_flags(id)
g_menuSelectNum[id] = 0
for (new a = 0; a < g_cvarNum; ++a)
@ -341,15 +370,18 @@ public cmdCvarMenu(id,level,cid) {
return PLUGIN_HANDLED
}
loadCvarSettings( szFilename[] ) {
loadCvarSettings(szFilename[])
{
if (!file_exists(szFilename))
return 0
new text[256], szValues[12][32]
new inum, a, pos = 0
new cvar_values = MAX_CVARS * 5
// a b c d
while ( g_cvarNum < MAX_CVARS && read_file (szFilename,pos++,text,255,a) ) {
while (g_cvarNum < MAX_CVARS && read_file(szFilename, pos++, text, 255, a))
{
if (text[0] == ';') continue
inum = parse(text, g_cvarNames[g_cvarNum], 31,
@ -359,13 +391,13 @@ loadCvarSettings( szFilename[] ) {
szValues[9], 31, szValues[10], 31, szValues[11], 31)
inum -= 2
if (inum < 2) continue
g_cvarMisc[g_cvarNum][1] = g_cvarCmdNum
for ( a = 0 ; a < inum && g_cvarCmdNum < cvar_values ; ++a ) {
while ( replace( szValues[ a ] ,31 , "\'" , "^"" ) ) {
for (a = 0; a < inum && g_cvarCmdNum < cvar_values; ++a)
{
while (replace(szValues[a], 31, "\'", "^""))
{
// do nothing
}
@ -376,7 +408,6 @@ loadCvarSettings( szFilename[] ) {
g_cvarMisc[g_cvarNum][2] = g_cvarCmdNum
g_cvarMisc[g_cvarNum][0] = read_flags(szValues[inum])
g_cvarNum++
}
return 1

View File

@ -45,56 +45,79 @@ new g_Messages[MAX_MESSAGES][384]
new g_MessagesNum
new g_Current
public plugin_init() {
public plugin_init()
{
register_plugin("Info. Messages", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("imessage.txt")
register_dictionary("common.txt")
register_srvcmd("amx_imessage", "setMessage")
register_cvar("amx_freq_imessage", "10")
new lastinfo[8]
get_localinfo("lastinfomsg", lastinfo, 7)
g_Current = str_to_num(lastinfo)
set_localinfo("lastinfomsg", "")
}
public infoMessage() {
public infoMessage()
{
if (g_Current >= g_MessagesNum)
g_Current = 0
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2],
X_POS, Y_POS, 0, 0.5, HOLD_TIME , 2.0, 2.0, 1)
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, 1)
show_hudmessage(0, g_Messages[g_Current])
client_print(0, print_console, g_Messages[g_Current])
++g_Current
new Float:freq_im = get_cvar_float("amx_freq_imessage")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
if (freq_im > 0.0)
set_task(freq_im, "infoMessage", 12345)
}
public setMessage() {
if (g_MessagesNum >= MAX_MESSAGES) {
public setMessage()
{
if (g_MessagesNum >= MAX_MESSAGES)
{
server_print("%L", LANG_SERVER, "INF_REACH")
return PLUGIN_HANDLED
}
remove_task(12345)
read_argv(1, g_Messages[g_MessagesNum], 380)
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_Messages[g_MessagesNum], 380, "%hostname%", hostname)
while (replace(g_Messages[g_MessagesNum], 380, "\n", "^n")) {}
new mycol[12]
read_argv(2, mycol, 11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
mycol[6] = 0
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
g_MessagesNum++
new Float:freq_im = get_cvar_float("amx_freq_imessage")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
if (freq_im > 0.0)
set_task(freq_im, "infoMessage", 12345)
return PLUGIN_HANDLED
}
public plugin_end() {
public plugin_end()
{
new lastinfo[8]
num_to_str(g_Current, lastinfo, 7)
set_localinfo("lastinfomsg", lastinfo)
}

View File

@ -50,11 +50,14 @@ new g_lastMap[32]
new g_coloredMenus
new bool:g_selected = false
public plugin_init() {
public plugin_init()
{
register_plugin("Nextmap Chooser", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("mapchooser.txt")
register_dictionary("common.txt")
new MenuName[64]
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
register_menucmd(register_menuid(MenuName), (-1^(-1<<(SELECTMAPS+2))), "countVote")
register_cvar("amx_extendmap_max", "90")
@ -69,6 +72,7 @@ public plugin_init() {
new maps_ini_file[64]
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, 63)
if (loadSettings(maps_ini_file))
@ -77,100 +81,132 @@ public plugin_init() {
g_coloredMenus = colored_menus()
}
public checkVotes() {
public checkVotes()
{
new b = 0
for (new a = 0; a < g_mapVoteNum; ++a)
if (g_voteCount[b] < g_voteCount[a])
b = a
if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {
if (g_voteCount[SELECTMAPS] > g_voteCount[b])
{
new mapname[32]
get_mapname(mapname, 31)
new Float:steptime = get_cvar_float("amx_extendmap_step")
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime)
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
mapname , steptime )
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime)
return
}
if (g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b])
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]])
new smap[32]
get_cvar_string("amx_nextmap", smap, 31)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap)
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
}
public countVote(id,key) {
if ( get_cvar_float("amx_vote_answers") ) {
public countVote(id, key)
{
if (get_cvar_float("amx_vote_answers"))
{
new name[32]
get_user_name(id, name, 31)
if (key == SELECTMAPS)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name)
else if (key < SELECTMAPS)
client_print(0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapName[g_nextName[key]])
}
++g_voteCount[key]
return PLUGIN_HANDLED
}
bool:isInMenu(id) {
bool:isInMenu(id)
{
for (new a = 0; a < g_mapVoteNum; ++a)
if (id == g_nextName[a])
return true
return false
}
public voteNextmap() {
public voteNextmap()
{
new winlimit = get_cvar_num("mp_winlimit")
new maxrounds = get_cvar_num("mp_maxrounds")
if ( winlimit ) {
if (winlimit)
{
new c = winlimit - 2
if ( (c > g_teamScore[0]) && (c > g_teamScore[1]) ) {
if ((c > g_teamScore[0]) && (c > g_teamScore[1]))
{
g_selected = false
return
}
}
else if ( maxrounds ) {
if ( (maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]) ){
else if (maxrounds)
{
if ((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]))
{
g_selected = false
return
}
}
else {
} else {
new timeleft = get_timeleft()
if (timeleft<1||timeleft>129){
if (timeleft < 1 || timeleft > 129)
{
g_selected = false
return
}
}
if (g_selected)
return
g_selected = true
new menu[512], a, mkeys = (1<<SELECTMAPS + 1)
new pos = format(menu, 511, g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
for (g_mapVoteNum = 0; g_mapVoteNum < dmax; ++g_mapVoteNum)
{
a = random_num(0, g_mapNums - 1)
while (isInMenu(a))
if (++a >= g_mapNums) a = 0
g_nextName[g_mapVoteNum] = a
pos += format(menu[pos], 511, "%d. %s^n", g_mapVoteNum + 1, g_mapName[a])
mkeys |= (1<<g_mapVoteNum)
g_voteCount[g_mapVoteNum] = 0
}
menu[pos++] = '^n'
g_voteCount[SELECTMAPS] = 0
g_voteCount[SELECTMAPS + 1] = 0
new mapname[32]
get_mapname(mapname, 31)
if ( (winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))) {
if ((winlimit + maxrounds) == 0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))
{
pos += format(menu[pos], 511, "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname)
mkeys |= (1<<SELECTMAPS)
}
format(menu[pos], 511, "%d. %L", SELECTMAPS+2, LANG_SERVER, "NONE")
new MenuName[64]
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
show_menu(0, mkeys, menu, 15, MenuName)
set_task(15.0, "checkVotes")
@ -179,34 +215,39 @@ public voteNextmap() {
log_amx("Vote: Voting for the nextmap started")
}
loadSettings(filename[]) {
if (!file_exists(filename)) return 0
loadSettings(filename[])
{
if (!file_exists(filename))
return 0
new szText[32]
new a, pos = 0
new currentMap[32]
get_mapname(currentMap, 31)
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) ) {
if ( szText[0] != ';'
&& parse(szText, g_mapName[g_mapNums] ,31 )
&& is_map_valid( g_mapName[g_mapNums] )
&& !equali( g_mapName[g_mapNums] ,g_lastMap)
&& !equali( g_mapName[g_mapNums] ,currentMap) )
while ((g_mapNums < MAX_MAPS) && read_file(filename, pos++, szText, 31, a))
{
if (szText[0] != ';' && parse(szText, g_mapName[g_mapNums], 31) && is_map_valid(g_mapName[g_mapNums])
&& !equali(g_mapName[g_mapNums], g_lastMap) && !equali(g_mapName[g_mapNums], currentMap))
++g_mapNums
}
return g_mapNums
}
public team_score() {
public team_score()
{
new team[2]
read_data(1, team, 1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}
public plugin_end() {
public plugin_end()
{
new current_map[32]
get_mapname(current_map, 31)
set_localinfo("lastMap", current_map)
}

View File

@ -50,7 +50,8 @@ new g_coloredMenus
new g_choosed
public plugin_init() {
public plugin_init()
{
register_plugin("Maps Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("mapsmenu.txt")
register_dictionary("common.txt")
@ -66,103 +67,135 @@ public plugin_init() {
new maps_ini_file[64];
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
format(maps_ini_file, 63, "mapcycle.txt")
load_settings(maps_ini_file)
g_coloredMenus = colored_menus()
}
public autoRefuse() {
public autoRefuse()
{
log_amx("Vote: %L", "en", "RESULT_REF")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_REF")
}
public actionResult(id,key) {
public actionResult(id, key)
{
remove_task(4545454)
switch (key){
case 0: {
switch (key)
{
case 0:
{
new _modName[10]
get_modname(_modName, 9)
if (!equal(_modName,"zp")) {
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1)
log_amx("Vote: %L", "en", "RESULT_ACC")
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_ACC")
}
case 1: autoRefuse()
}
return PLUGIN_HANDLED
}
public checkVotes( id ) {
public checkVotes(id)
{
id -= 34567
new num, ppl[32], a = 0
get_players(ppl, num, "c")
if (num == 0) num = 1
g_choosed = -1
for (new i = 0; i < g_voteSelectedNum[id]; ++i)
if (g_voteCount[a] < g_voteCount[i])
a = i
if ( 100 * g_voteCount[a] / num > 50 ) {
if (100 * g_voteCount[a] / num > 50)
{
g_choosed = g_voteSelected[id][a]
client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", g_mapName[g_choosed])
log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", g_mapName[g_choosed])
}
if ( g_choosed != -1 ) {
if ( is_user_connected( id ) ) {
if (g_choosed != -1)
{
if (is_user_connected(id))
{
new menuBody[512]
new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", g_mapName[g_choosed])
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO")
show_menu(id, 0x03, menuBody, 10, "The winner: ")
set_task(10.0, "autoRefuse", 4545454)
}
else {
} else {
new _modName[10]
get_modname(_modName, 9)
if (!equal(_modName,"zp")) {
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1)
}
}
else {
} else {
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTE_FAILED")
log_amx("Vote: %L", "en", "VOTE_FAILED")
}
remove_task(34567 + id)
}
public voteCount(id,key) {
if (key > 3) {
public voteCount(id, key)
{
if (key > 3)
{
client_print(0, print_chat, "%L", LANG_PLAYER, "VOT_CANC")
remove_task(34567 + id)
set_cvar_float("amx_last_voting", get_gametime())
log_amx("Vote: Cancel vote session")
return PLUGIN_HANDLED
}
if (get_cvar_float("amx_vote_answers")) {
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"%L", LANG_PLAYER, "X_VOTED_FOR", name , key + 1 )
}
++g_voteCount[key]
return PLUGIN_HANDLED
}
isMapSelected( id , pos ) {
if (get_cvar_float("amx_vote_answers"))
{
new name[32]
get_user_name(id, name, 31)
client_print(0, print_chat, "%L", LANG_PLAYER, "X_VOTED_FOR", name, key + 1)
}
++g_voteCount[key]
return PLUGIN_HANDLED
}
isMapSelected(id, pos)
{
for (new a = 0; a < g_voteSelectedNum[id]; ++a)
if (g_voteSelected[id][a] == pos)
return 1
return 0
}
displayVoteMapsMenu(id,pos) {
displayVoteMapsMenu(id, pos)
{
if (pos < 0)
return
@ -171,38 +204,38 @@ displayVoteMapsMenu(id,pos) {
if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"VOTEMAP_MENU",pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) )
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 7) ? 1 : 0)))
new end = start + 7, keys = MENU_KEY_0
if (end > g_mapNums)
end = g_mapNums
for (new a = start; a < end; ++a) {
if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) ) {
for (new a = start; a < end; ++a)
{
if (g_voteSelectedNum[id] == 4 || isMapSelected(id, pos * 7 + b))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_mapName[a])
else
len += format(menuBody[len], 511-len, "#. %s^n", g_mapName[a])
}
else {
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_mapName[a])
}
}
if ( g_voteSelectedNum[id] ) {
if (g_voteSelectedNum[id])
{
keys |= MENU_KEY_8
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "START_VOT")
}
else
len += format(menuBody[len],511-len, g_coloredMenus ?
"^n\d8. %L^n\w" : "^n#. %L^n",id,"START_VOT")
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")
if (end != g_mapNums) {
if (end != g_mapNums)
{
len += format(menuBody[len], 511-len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
@ -214,7 +247,8 @@ displayVoteMapsMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n^n")
for (new c = 0; c < 4; c++) {
for (new c = 0; c < 4; c++)
{
if (c < g_voteSelectedNum[id])
len += format(menuBody[len], 511-len, "%s^n", g_mapName[g_voteSelected[id][c]])
else
@ -227,22 +261,23 @@ displayVoteMapsMenu(id,pos) {
show_menu(id, keys, menuBody, -1, menuName)
}
public cmdVoteMapMenu(id,level,cid) {
public cmdVoteMapMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
if ( get_cvar_float("amx_last_voting") > get_gametime() ) {
if (get_cvar_float("amx_last_voting") > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}
g_voteSelectedNum[id] = 0
if ( g_mapNums ) {
if (g_mapNums)
{
displayVoteMapsMenu(id, g_menuPosition[id] = 0)
}
else {
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}
@ -250,14 +285,15 @@ public cmdVoteMapMenu(id,level,cid) {
return PLUGIN_HANDLED
}
public cmdMapsMenu(id,level,cid) {
public cmdMapsMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
if ( g_mapNums ) {
if (g_mapNums)
{
displayMapsMenu(id, g_menuPosition[id] = 0)
}
else {
} else {
console_print(id, "%L", id, "NO_MAPS_MENU")
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
}
@ -268,16 +304,22 @@ public cmdMapsMenu(id,level,cid) {
public delayedChange(mapname[])
server_cmd("changelevel %s", mapname)
public actionVoteMapMenu(id,key) {
switch (key) {
case 7: {
public actionVoteMapMenu(id, key)
{
switch (key)
{
case 7:
{
new Float:voting = get_cvar_float("amx_last_voting")
if ( voting > get_gametime() ) {
if (voting > get_gametime())
{
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
return PLUGIN_HANDLED
}
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
{
client_print(id, print_chat, "%L", id, "VOT_NOW_ALLOW")
return PLUGIN_HANDLED
}
@ -296,20 +338,20 @@ public actionVoteMapMenu(id,key) {
get_players(players, pnum)
if ( g_voteSelectedNum[id] > 1 ) {
len = format(menuBody,511,g_coloredMenus ?
"\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
for (new c = 0; c < g_voteSelectedNum[id] ; ++c) {
if (g_voteSelectedNum[id] > 1)
{
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{
len += format(menuBody[len], 511, "%d. %s^n", c + 1, g_mapName[g_voteSelected[id][c]])
keys |= (1<<c)
}
keys |= (1<<8)
len += format(menuBody[len], 511, "^n9. None^n")
}
else {
len = format(menuBody,511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n"
: "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", g_mapName[ g_voteSelected[id][ 0 ] ],
id, "YES", id, "NO")
} else {
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", g_mapName[g_voteSelected[id][0]], id, "YES", id, "NO")
keys = MENU_KEY_1|MENU_KEY_2
}
@ -325,10 +367,12 @@ public actionVoteMapMenu(id,key) {
show_menu(id, keys, menuBody, iVoteTime, menuName)
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_V_MAP_2", name)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_V_MAP_1")
}
@ -342,51 +386,56 @@ public actionVoteMapMenu(id,key) {
}
case 8: displayVoteMapsMenu(id, ++g_menuPosition[id])
case 9: displayVoteMapsMenu(id, --g_menuPosition[id])
default: {
default:
{
g_voteSelected[id][g_voteSelectedNum[id]++] = g_menuPosition[id] * 7 + key
displayVoteMapsMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
public actionMapsMenu(id,key) {
switch (key) {
public actionMapsMenu(id, key)
{
switch (key)
{
case 8: displayMapsMenu(id, ++g_menuPosition[id])
case 9: displayMapsMenu(id, --g_menuPosition[id])
default:
{
new a = g_menuPosition[id] * 8 + key
new _modName[10]
get_modname(_modName, 9)
if (!equal(_modName,"zp")) {
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
message_end()
}
new authid[32], name[32]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_2", name, g_mapName[a])
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_1", g_mapName[a])
}
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"",
name,get_user_userid(id),authid, g_mapName[ a ] )
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, g_mapName[a])
set_task(2.0, "delayedChange", 0, g_mapName[a], strlen(g_mapName[a]) + 1)
/* displayMapsMenu(id, g_menuPosition[id]) */
}
}
return PLUGIN_HANDLED
}
displayMapsMenu(id,pos) {
displayMapsMenu(id, pos)
{
if (pos < 0)
return
@ -397,26 +446,26 @@ displayMapsMenu(id,pos) {
if (start >= g_mapNums)
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"CHANGLE_MENU",pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) )
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
if (end > g_mapNums)
end = g_mapNums
for (new a = start; a < end; ++a) {
for (new a = start; a < end; ++a)
{
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_mapName[a])
}
if (end != g_mapNums) {
if (end != g_mapNums)
{
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. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
new menuName[64]
format(menuName, 63, "%L", "en", "CHANGLE_MENU")
@ -424,18 +473,18 @@ displayMapsMenu(id,pos) {
show_menu(id, keys, menuBody, -1, menuName)
}
load_settings(filename[]) {
load_settings(filename[])
{
if (!file_exists(filename))
return 0
new text[256]
new a, pos = 0
while ( g_mapNums < MAX_MAPS && read_file(filename,pos++,text,255,a) ) {
while (g_mapNums < MAX_MAPS && read_file(filename, pos++, text, 255, a))
{
if (text[0] == ';') continue
if (parse(text, g_mapName[g_mapNums], 31) < 1) continue
if (!is_map_valid(g_mapName[g_mapNums])) continue
g_mapNums++

View File

@ -63,55 +63,68 @@ new g_clientMenuPlugin[MAXMENUS][STRINGSIZE]
// menuCmd: Command that should be executed to start menu
// menuAccess: Access required for menu
// menuPlugin: The exact case-insensitive name of plugin holding the menu command
public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
if (g_menusNumber + 1 == MAXMENUS) {
public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
{
if (g_menusNumber + 1 == MAXMENUS)
{
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
return
}
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
g_menuBodyPhrase[g_menusNumber] = false
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
g_menuAccess[g_menusNumber] = menuAccess
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
g_menusNumber++
server_print("Menu item %d added to Menus Front-End: ^"%s^" from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
}
public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
if (g_menusNumber + 1 == MAXMENUS) {
public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
{
if (g_menusNumber + 1 == MAXMENUS)
{
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
return
}
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
g_menuBodyPhrase[g_menusNumber] = true
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
g_menuAccess[g_menusNumber] = menuAccess
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
g_menusNumber++
//server_print("Menu item %d added to Menus Front-End: ^"%s^" (LANG) from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
}
public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
if (g_clientMenusNumber + 1 == MAXMENUS) {
public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
{
if (g_clientMenusNumber + 1 == MAXMENUS)
{
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
return
}
copy(g_clientMenuBody[g_clientMenusNumber], STRINGLENGTH, menuBody)
g_clientMenuBodyPhrase[g_clientMenusNumber] = false
copy(g_clientMenuCmd[g_clientMenusNumber], STRINGLENGTH, menuCmd)
g_clientMenuAccess[g_clientMenusNumber] = menuAccess
copy(g_clientMenuPlugin[g_clientMenusNumber], STRINGLENGTH, menuPlugin)
g_clientMenusNumber++
server_print("Client menu item %d added to Client Menus Front-End: ^"%s^" from plugin ^"%s^"", g_clientMenusNumber, menuBody, menuPlugin)
}
AddDefaultMenus() {
AddDefaultMenus()
{
AddMenuLang("KICK_PLAYER", "amx_kickmenu", ADMIN_KICK, "Players Menu")
AddMenuLang("BAN_PLAYER", "amx_banmenu", ADMIN_BAN, "Players Menu")
AddMenuLang("SLAP_SLAY", "amx_slapmenu", ADMIN_SLAY, "Players Menu")
@ -130,24 +143,32 @@ AddDefaultMenus() {
AddMenuLang("TELE_PLAYER", "amx_teleportmenu", ADMIN_LEVEL_A, "Teleport Menu")
}
public actionMenu(id,key) {
switch (key) {
public actionMenu(id, key)
{
switch (key)
{
case 8: displayMenu(id, ++g_menuPosition[id])
case 9: displayMenu(id, --g_menuPosition[id])
default: client_cmd(id, g_menuCmd[g_menuPosition[id] * 8 + key])
}
return PLUGIN_HANDLED
}
public clientActionMenu(id,key) {
switch (key) {
public clientActionMenu(id, key)
{
switch (key)
{
case 8: clientDisplayMenu(id, ++g_clientMenuPosition[id])
case 9: clientDisplayMenu(id, --g_clientMenuPosition[id])
default: client_cmd(id, g_clientMenuCmd[g_clientMenuPosition[id] * 8 + key])
}
return PLUGIN_HANDLED
}
displayMenu(id, pos) {
displayMenu(id, pos)
{
if (pos < 0)
return
@ -159,6 +180,7 @@ displayMenu(id, pos) {
start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511,
g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos + 1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
new end = start + MENUITEMSPERPAGE
@ -169,23 +191,26 @@ displayMenu(id, pos) {
new flags = get_user_flags(id)
for (new a = start; a < end; ++a) {
if ( (flags & g_menuAccess[a]) && ( is_plugin_loaded(g_menuPlugin[a])!=-1 ) ) {
for (new a = start; a < end; ++a)
{
if ((flags & g_menuAccess[a]) && (is_plugin_loaded(g_menuPlugin[a]) != -1))
{
keys |= (1<<b)
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_menuBody[a])
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_menuBody[a])
}
else {
} else {
++b
if ( g_coloredMenus ) {
if (g_coloredMenus)
{
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_menuBody[a])
else
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_menuBody[a])
}
else {
} else {
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "#. %L^n", id, g_menuBody[a])
else
@ -194,17 +219,19 @@ displayMenu(id, pos) {
}
}
if (end != g_menusNumber ) { // MENUS_NUMBER
if (end != g_menusNumber) // MENUS_NUMBER
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else {
} else {
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
}
show_menu(id, keys, menuBody)
}
clientDisplayMenu(id,pos) {
clientDisplayMenu(id, pos)
{
if (pos < 0)
return
@ -215,8 +242,7 @@ clientDisplayMenu(id,pos) {
if (start >= g_clientMenusNumber) // MENUS_NUMBER
start = pos = g_clientMenuPosition[id] = 0
new len = format(menuBody,511,
g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos+1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
new len = format(menuBody, 511, g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
new end = start + MENUITEMSPERPAGE
new keys = MENU_KEY_0
@ -226,23 +252,26 @@ clientDisplayMenu(id,pos) {
new flags = get_user_flags(id)
for (new a = start; a < end; ++a) {
if ( (flags & g_clientMenuAccess[a]) && ( is_plugin_loaded(g_clientMenuPlugin[a])!=-1 ) ) {
for (new a = start; a < end; ++a)
{
if ((flags & g_clientMenuAccess[a]) && (is_plugin_loaded(g_clientMenuPlugin[a]) != -1))
{
keys |= (1<<b)
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_clientMenuBody[a])
}
else {
} else {
++b
if ( g_coloredMenus ) {
if (g_coloredMenus)
{
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
else
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
}
else {
} else {
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "#. %L^n", id, g_clientMenuBody[a])
else
@ -251,7 +280,8 @@ clientDisplayMenu(id,pos) {
}
}
if (end != g_clientMenusNumber ) { // MENUS_NUMBER
if (end != g_clientMenusNumber) // MENUS_NUMBER
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
@ -262,20 +292,23 @@ clientDisplayMenu(id,pos) {
show_menu(id, keys, menuBody)
}
public cmdMenu(id,level,cid) {
public cmdMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED
}
public clientCmdMenu(id,level,cid) {
public clientCmdMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
clientDisplayMenu(id, g_clientMenuPosition[id] = 0)
return PLUGIN_HANDLED
}
public addmenuitem_cmd(id, level, cid) {
public addmenuitem_cmd(id, level, cid)
{
if (!cmd_access(id, level, cid, 5))
return PLUGIN_HANDLED
@ -287,12 +320,13 @@ public addmenuitem_cmd(id, level, cid) {
menuAccess = read_flags(flags)
read_argv(4, menuPlugin, STRINGLENGTH)
AddMenu(menuBody, menuCmd, menuAccess, menuPlugin)
return PLUGIN_HANDLED
}
public addclientmenuitem_cmd(id, level, cid) {
public addclientmenuitem_cmd(id, level, cid)
{
if (!cmd_access(id, level, cid, 5))
return PLUGIN_HANDLED
@ -304,15 +338,14 @@ public addclientmenuitem_cmd(id, level, cid) {
menuAccess = read_flags(flags)
read_argv(4, menuPlugin, STRINGLENGTH)
AddClientMenu(menuBody, menuCmd, menuAccess, menuPlugin)
return PLUGIN_HANDLED
}
public plugin_init() {
public plugin_init()
{
register_plugin("Menus Front-End", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("menufront.txt")
register_dictionary("common.txt")

View File

@ -47,6 +47,7 @@ public plugin_init()
register_dictionary("multilingual.txt")
register_dictionary("common.txt")
register_dictionary("languages.txt")
register_cvar("amx_language", "en", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
//Set to zero to disable client effects
register_cvar("amx_client_languages", "1")
@ -55,13 +56,15 @@ public plugin_init()
register_menu("Language Menu", 1023, "actionMenu")
new lang[3]
if ( vaultdata_exists("server_language") ) {
if (vaultdata_exists("server_language"))
{
get_vaultdata("server_language", lang, 2)
}
else {
} else {
copy(lang, 2, "en")
set_vaultdata("server_language", lang)
}
set_cvar_string("amx_language", lang)
g_langNum = get_langsnum()
@ -70,12 +73,14 @@ public plugin_init()
}
#if defined DISPLAY_MSG
public client_putinserver(id) {
public client_putinserver(id)
{
if (get_cvar_num("amx_client_languages") && !is_user_bot(id))
set_task(10.0, "dispInfo", id)
}
public client_disconnect(id) {
public client_disconnect(id)
{
remove_task(id)
}
@ -86,14 +91,16 @@ public dispInfo(id)
}
#endif
public cmdLang(id,level,cid) {
public cmdLang(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new arg[3]
read_argv(1, arg, 2)
if ( !lang_exists(arg) ) {
if (!lang_exists(arg))
{
console_print(id, "[AMXX] %L", id, "LANG_NOT_EXISTS")
return PLUGIN_HANDLED
}
@ -116,7 +123,6 @@ public cmdLangMenu(id,level,cid)
}
get_user_info(id, "lang", buffer, 2)
g_menuLang[id][0] = get_lang_id(buffer)
g_menuLang[id][1] = g_serverLang
@ -129,22 +135,26 @@ showMenu(id)
{
if (!get_cvar_num("amx_client_languages"))
return PLUGIN_HANDLED
new menuBody[512], pLang[3]
get_lang(g_menuLang[id][0], pLang)
new len = format(menuBody, 511, (g_coloredMenus ? "\y%L\w^n^n" : "%L^n^n"), id, "LANG_MENU")
len += format(menuBody[len], 511-len, (g_coloredMenus ? "1. %L\R\r%L\w^n" : "1. %L %L^n"), id, "PERSO_LANG", pLang, "LANG_NAME")
if ( access(id,ADMIN_CFG) ) {
if (access(id, ADMIN_CFG))
{
new sLang[3]
get_lang(g_menuLang[id][1], sLang)
len += format(menuBody[len], 511-len, (g_coloredMenus ? "2. %L\R\r%L\w^n^n" : "2. %L %L^n^n"), id, "SERVER_LANG", sLang, "LANG_NAME")
len += format(menuBody[len], 511-len, "3. %L", id, "SAVE_LANG")
}
else {
} else {
len += format(menuBody[len], 511-len, "^n2. %L", id, "SAVE_LANG")
}
format(menuBody[len], 511-len, "^n^n0. %L", id, "EXIT")
show_menu(id, MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3, menuBody, -1, "Language Menu")
@ -152,35 +162,42 @@ showMenu(id)
return 1
}
public actionMenu(id,key) {
public actionMenu(id, key)
{
if (!get_cvar_num("amx_client_languages"))
return 0
new isAdmin = access(id, ADMIN_CFG)
if ( key==0 ) {
if (key == 0)
{
if (g_menuLang[id][0] < (g_langNum-1))
g_menuLang[id][0]++
else
g_menuLang[id][0] = 0
showMenu(id)
}
if ( isAdmin && (key==1) ) {
if (isAdmin && (key == 1))
{
if (g_menuLang[id][1] < (g_langNum - 1))
g_menuLang[id][1]++
else
g_menuLang[id][1] = 0
showMenu(id)
}
new pLang[3], pLang_old[3], sLang[3], sLang_old[3], lName[64]
get_lang(g_menuLang[id][0], pLang)
get_lang(g_menuLang[id][1], sLang)
get_user_info(id, "lang", pLang_old, 2)
get_lang(g_serverLang, sLang_old)
if ( isAdmin && (key==2) && !equali(sLang,sLang_old) ) {
if (isAdmin && (key == 2) && !equali(sLang, sLang_old))
{
set_vaultdata("server_language", sLang)
set_cvar_string("amx_language", sLang)
g_serverLang = g_menuLang[id][1]
@ -188,7 +205,8 @@ public actionMenu(id,key) {
client_print(id, print_chat, "%L", pLang, "SET_LANG_SERVER", lName)
}
if ( !equali(pLang,pLang_old) && ( ( isAdmin && (key==2) ) || ( !isAdmin && (key==1) ) ) ) {
if (!equali(pLang, pLang_old) && ((isAdmin && (key == 2)) || (!isAdmin && (key == 1))))
{
client_cmd(id, "setinfo ^"lang^" ^"%s^"", pLang)
format(lName, 63, "%L", pLang, "LANG_NAME")
client_print(id, print_chat, "%L", pLang, "SET_LANG_USER", lName)
@ -197,9 +215,12 @@ public actionMenu(id,key) {
return 0
}
get_lang_id(lang[]) {
get_lang_id(lang[])
{
new tLang[3]
for (new i=0;i<g_langNum;i++) {
for (new i = 0; i < g_langNum; i++)
{
get_lang(i, tLang)
if (equali(tLang, lang))
return i

View File

@ -43,7 +43,8 @@ new g_nextMap[32]
new g_mapCycle[32]
new g_pos
public plugin_init() {
public plugin_init()
{
register_plugin("NextMap", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("nextmap.txt")
register_event("30", "changeMap", "a")
@ -51,6 +52,7 @@ public plugin_init() {
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
new szString[32], szString2[32], szString3[8]
get_localinfo("lastmapcycle", szString, 31)
parse(szString, szString2, 31, szString3, 7)
g_pos = str_to_num(szString3)
@ -65,28 +67,36 @@ public plugin_init() {
set_localinfo("lastmapcycle", szString3)
}
getNextMapName(szArg[],iMax) {
getNextMapName(szArg[], iMax)
{
new len = get_cvar_string("amx_nextmap", szArg, iMax)
if (is_map_valid(szArg)) return len
len = copy(szArg, iMax, g_nextMap)
set_cvar_string("amx_nextmap", g_nextMap)
return len
}
public sayNextMap() {
public sayNextMap()
{
new name[32]
getNextMapName(name, 31)
client_print(0, print_chat, "%L %s", LANG_PLAYER, "NEXT_MAP", name)
}
public delayedChange( param[] ) {
public delayedChange(param[])
{
set_cvar_float("mp_chattime", get_cvar_float("mp_chattime") - 2.0)
server_cmd("changelevel %s", param)
}
public changeMap() {
public changeMap()
{
new string[32]
new Float:chattime = get_cvar_float("mp_chattime")
set_cvar_float("mp_chattime", chattime + 2.0) // make sure mp_chattime is long
new len = getNextMapName(string, 31) + 1
set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay
@ -95,66 +105,88 @@ public changeMap() {
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
#if defined OBEY_MAPCYCLE
readMapCycle(szFileName[], szNext[], iNext ) {
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32]
if ( file_exists( szFileName ) ) {
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue
if ( !iMaps ) copy( szFirst, 31, szBuffer )
if ( ++iMaps > g_pos ) {
if (!iMaps)
copy(szFirst, 31, szBuffer)
if (++iMaps > g_pos)
{
copy(szNext, iNext, szBuffer)
g_pos = iMaps
return
}
}
}
if ( !iMaps ) {
if (!iMaps)
{
log_amx(g_warning, szFileName)
get_mapname(szFirst, 31)
}
copy(szNext, iNext, szFirst)
g_pos = 1
}
#else
readMapCycle(szFileName[], szNext[], iNext ) {
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32], szCurrent[32]
get_mapname(szCurrent, 31)
new a = g_pos
if ( file_exists( szFileName ) ) {
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue
if ( !iMaps ) {
if (!iMaps)
{
iMaps = 1
copy(szFirst, 31, szBuffer)
}
if ( iMaps == 1 ) {
if ( equali( szCurrent , szBuffer ) ) {
if (iMaps == 1)
{
if (equali(szCurrent, szBuffer))
{
if (a-- == 0)
iMaps = 2
}
}
else {
} else {
if (equali(szCurrent, szBuffer))
++g_pos
else
g_pos = 0
copy(szNext, iNext, szBuffer)
return
}
}
}
if ( !iMaps ) {
if (!iMaps)
{
log_amx(g_warning, szFileName)
copy(szNext, iNext, szCurrent)
}
else copy( szNext ,iNext , szFirst )
else
copy(szNext, iNext, szFirst)
g_pos = 0
}
#endif

View File

@ -50,11 +50,13 @@ new g_addCmd[] = "amx_pausecfg add ^"%s^""
new g_system[MAX_SYSTEM]
new g_systemNum
public plugin_init() {
public plugin_init()
{
register_plugin("Pause Plugins", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("pausecfg.txt")
register_dictionary("common.txt")
register_dictionary("admincmd.txt")
register_concmd("amx_pausecfg", "cmdPlugin", ADMIN_CFG, "- list commands for pause/unpause managment")
register_clcmd("amx_pausecfgmenu", "cmdMenu", ADMIN_CFG, "- pause/unpause plugins with menu")
#if defined DIRECT_ONOFF
@ -62,6 +64,7 @@ public plugin_init() {
register_concmd("amx_on", "cmdON", ADMIN_CFG, "- unpauses some plugins")
#endif
register_menucmd(register_menuid("Pause/Unpause Plugins"), 1023, "actionMenu")
g_coloredMenus = colored_menus()
get_configsdir(g_fileToSave, 63);
format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave);
@ -70,23 +73,27 @@ public plugin_init() {
}
#if defined DIRECT_ONOFF
public cmdOFF(id,level,cid) {
public cmdOFF(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
pausePlugins(id)
return PLUGIN_HANDLED
}
public cmdON(id,level,cid) {
public cmdON(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
unpausePlugins(id)
return PLUGIN_HANDLED
}
#endif
public plugin_cfg() {
public plugin_cfg()
{
loadSettings(g_fileToSave)
// Put here titles of plugins which you don't want to pause
server_cmd(g_addCmd, "Admin Base")
server_cmd(g_addCmd, "Admin Base (SQL)")
@ -96,262 +103,359 @@ public plugin_cfg() {
server_cmd(g_addCmd, "Slots Reservation")
}
public actionMenu(id,key) {
switch (key) {
case 6: {
if (file_exists(g_fileToSave)){
public actionMenu(id, key)
{
switch (key)
{
case 6:
{
if (file_exists(g_fileToSave))
{
delete_file(g_fileToSave)
client_print(id, print_chat, "* %L", id, "PAUSE_CONF_CLEARED")
}
else
client_print(id, print_chat, "* %L", id, "PAUSE_ALR_CLEARED")
displayMenu(id, g_menuPos[id])
}
case 7: {
if (saveSettings(g_fileToSave)){
case 7:
{
if (saveSettings(g_fileToSave))
{
g_Modified = 0
client_print(id, print_chat, "* %L", id, "PAUSE_CONF_SAVED")
}
else
client_print(id, print_chat, "* %L", id, "PAUSE_SAVE_FAILED")
displayMenu(id, g_menuPos[id])
}
case 8: displayMenu(id, ++g_menuPos[id])
case 9: displayMenu(id, --g_menuPos[id])
default:{
default:
{
new option = g_menuPos[id] * 6 + key
new file[32], status[2]
get_plugin(option, file, 31, status, 0, status, 0, status, 0, status, 1)
switch( status[0] ) {
switch (status[0])
{
case 'r': pause("ac", file)
case 'p': {
case 'p':
{
g_Modified = 1
pause("dc", file)
}
case 's': {
case 's':
{
g_Modified = 1
unpause("ac", file)
}
}
displayMenu(id, g_menuPos[id])
}
}
return PLUGIN_HANDLED
}
getStatus( id, code, &statusCode, lStatus[], lLen ) {
switch (code) {
case 'r': {
getStatus(id, code, &statusCode, lStatus[], lLen)
{
switch (code)
{
case 'r':
{
statusCode = 'O'
format(lStatus, lLen, "%L", id, "ON")
}
case 's': {
case 's':
{
statusCode = 'S'
format(lStatus, lLen, "%L", id, "STOPPED")
}
case 'p': {
case 'p':
{
statusCode = 'O'
format(lStatus, lLen, "%L", id, "OFF")
}
case 'b': {
case 'b':
{
statusCode = 'E'
format(lStatus, lLen, "%L", id, "ERROR")
}
default: {
default:
{
statusCode = 'L'
format(lStatus, lLen, "%L", id, "LOCKED")
}
}
}
isSystem( id ) {
isSystem(id)
{
for (new a = 0; a < g_systemNum; ++a)
if (g_system[a] == id)
return 1
return 0
}
displayMenu(id, pos) {
displayMenu(id, pos)
{
if (pos < 0) return
new filename[32], title[32], status[8], statusCode
new datanum = get_pluginsnum()
new menu_body[512], start = pos * 6, k = 0
if (start >= datanum) start = pos = g_menuPos[id] = 0
new len = format(menu_body,511,
g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"PAUSE_UNPAUSE",pos + 1,((datanum/6)+((datanum%6)?1:0)))
if (start >= datanum)
start = pos = g_menuPos[id] = 0
new len = format(menu_body, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "PAUSE_UNPAUSE", pos + 1, ((datanum / 6) + ((datanum % 6) ? 1 : 0)))
new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7
if (end > datanum) end = datanum
for (new a = start; a < end; ++a) {
if (end > datanum)
end = datanum
for (new a = start; a < end; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
getStatus(id, status[0], statusCode, status, 7)
if ( isSystem( a ) || (statusCode!='O'&&statusCode!='S')) {
if ( g_coloredMenus ) {
if (isSystem(a) || (statusCode != 'O' && statusCode != 'S'))
{
if (g_coloredMenus)
{
len += format(menu_body[len], 511-len, "\d%d. %s\R%s^n\w", ++k, title, status)
}
else{
} else {
++k
len += format(menu_body[len], 511-len, "#. %s %s^n", title, status)
}
}
else{
} else {
keys |= (1<<k)
len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++k, title, status)
}
}
len += format(menu_body[len], 511-len, "^n7. %L^n", id, "CLEAR_STOPPED")
len += format(menu_body[len],511-len,g_coloredMenus ? "8. %L \y\R%s^n\w"
: "8. %L %s^n", id, "SAVE_STOPPED", g_Modified ? "*" : "")
if (end != datanum){
len += format(menu_body[len], 511-len, g_coloredMenus ? "8. %L \y\R%s^n\w" : "8. %L %s^n", id, "SAVE_STOPPED", g_Modified ? "*" : "")
if (end != datanum)
{
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
else
format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menu_body, -1, "Pause/Unpause Plugins")
}
public cmdMenu(id,level,cid) {
public cmdMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayMenu(id, g_menuPos[id] = 0)
return PLUGIN_HANDLED
}
pausePlugins(id) {
pausePlugins(id)
{
new filename[32], title[32], status[2]
new count = 0, imax = get_pluginsnum()
for (new a=0;a<imax;++a){
for (new a = 0; a < imax; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
if ( !isSystem( a ) && status[0]=='r' && pause("ac",filename) ) {
if (!isSystem(a) && status[0] == 'r' && pause("ac", filename))
{
//console_print(id, "Pausing %s (file ^"%s^")", title, filename)
++count
}
}
console_print(id, "%L", id, (count == 1) ? "PAUSED_PLUGIN" : "PAUSED_PLUGINS", count)
}
unpausePlugins(id) {
unpausePlugins(id)
{
new filename[32], title[32], status[2]
new count = 0, imax = get_pluginsnum()
for (new a=0;a<imax;++a){
for (new a = 0; a < imax; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
if ( !isSystem( a ) && status[0]=='p' && unpause("ac",filename) ) {
if (!isSystem(a) && status[0] == 'p' && unpause("ac", filename))
{
//console_print(id, "Unpausing %s (file ^"%s^")", title, filename)
++count
}
}
console_print(id, "%L", id, (count == 1) ? "UNPAUSED_PLUGIN" : "UNPAUSED_PLUGINS", count)
}
findPluginByFile(arg[32],&len) {
findPluginByFile(arg[32], &len)
{
new name[32], title[32], status[2]
new inum = get_pluginsnum()
for(new a = 0; a < inum; ++a){
for (new a = 0; a < inum; ++a)
{
get_plugin(a, name, 31, title, 31, status, 0, status, 0, status, 1)
if ( equali(name,arg,len) && (status[0]=='r'||status[0]=='p'||status[0]=='s') ){
if (equali(name, arg, len) && (status[0] == 'r' || status[0] == 'p' || status[0] == 's'))
{
len = copy(arg, 31, name)
return a
}
}
return -1
}
findPluginByTitle(name[],file[],len) {
findPluginByTitle(name[], file[], len)
{
new title[32], status[2]
new inum = get_pluginsnum()
for (new a = 0; a < inum; ++a) {
for (new a = 0; a < inum; ++a)
{
get_plugin(a, file, len, title, 31, status, 0, status, 0, status, 1)
if (equali(title, name))
return a
}
return -1
}
public cmdPlugin(id,level,cid) {
public cmdPlugin(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new cmds[32]
read_argv(1, cmds, 31)
if ( equal(cmds, "add" ) && read_argc() > 2 ) {
if (equal(cmds, "add") && read_argc() > 2)
{
read_argv(2, cmds, 31)
new file[2]
if ( (g_system[ g_systemNum ] = findPluginByTitle( cmds , file , 0 )) != -1 ) {
if ((g_system[g_systemNum] = findPluginByTitle(cmds, file, 0)) != -1)
{
if (g_systemNum < MAX_SYSTEM)
g_systemNum++
else
console_print(id, "%L", id, "CANT_MARK_MORE")
}
}
else if ( equal(cmds, "off" ) ) {
else if (equal(cmds, "off"))
{
pausePlugins(id)
}
else if ( equal(cmds, "on" ) ) {
else if (equal(cmds, "on"))
{
unpausePlugins(id)
}
else if ( equal(cmds, "save" ) ) {
if (saveSettings(g_fileToSave)) {
else if (equal(cmds, "save"))
{
if (saveSettings(g_fileToSave))
{
g_Modified = 0
console_print(id, "%L", id, "PAUSE_CONF_SAVED")
}
else
console_print(id, "%L", id, "PAUSE_SAVE_FAILED")
}
else if ( equal(cmds, "clear" ) ) {
if (file_exists(g_fileToSave)){
else if (equal(cmds, "clear"))
{
if (file_exists(g_fileToSave))
{
delete_file(g_fileToSave)
console_print(id, "%L", id, "PAUSE_CONF_CLEARED")
}
else
console_print(id, "%L", id, "PAUSE_ALR_CLEARED")
}
else if ( equal(cmds, "pause" ) ) {
else if (equal(cmds, "pause"))
{
new arg[32], a, len = read_argv(2, arg, 31)
if (len && ((a = findPluginByFile(arg, len)) != -1) && !isSystem(a) && pause("ac", arg))
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "PAUSED")
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
else
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
}
else if ( equal(cmds, "enable" ) ) {
else if (equal(cmds, "enable"))
{
new arg[32], a, len = read_argv(2, arg, 31)
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && unpause("ac", arg))
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "UNPAUSED")
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
else
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
}
else if ( equal(cmds, "stop" ) ) {
else if (equal(cmds, "stop"))
{
new arg[32], a, len = read_argv(2, arg, 31)
if ( len && (a = findPluginByFile(arg,len)) != -1 && !isSystem( a ) && pause("dc",arg)){
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && pause("dc", arg))
{
g_Modified = 1
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "STOPPED")
}
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
else
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
}
else if ( equal(cmds, "list" ) ) {
else if (equal(cmds, "list"))
{
new lName[32], lVersion[32], lAuthor[32], lFile[32], lStatus[32]
format(lName, 31, "%L", id, "NAME")
format(lVersion, 31, "%L", id, "VERSION")
format(lAuthor, 31, "%L", id, "AUTHOR")
format(lFile, 31, "%L", id, "FILE")
format(lStatus, 31, "%L", id, "STATUS")
new arg1[8], running = 0
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
if (--start < 0) start = 0
if (--start < 0)
start = 0
new plgnum = get_pluginsnum()
if (start >= plgnum) start = plgnum - 1
if (start >= plgnum)
start = plgnum - 1
console_print(id, "^n----- %L -----", id, "PAUSE_LOADED")
console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
new plugin[32], title[32], version[16], author[32], status[16]
new end = start + 10
if (end > plgnum) end = plgnum
for (new a = start; a < end; ++a) {
for (new a = start; a < end; ++a)
{
get_plugin(a, plugin, 31, title, 31, version, 15, author, 31, status, 15)
if (status[0] == 'r') ++running
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", a + 1, title, version, author, plugin, status)
}
console_print(id, "----- %L -----", id, "PAUSE_ENTRIES", start + 1, end, plgnum, running)
if (end < plgnum)
console_print(id, "----- %L -----", id, "PAUSE_USE_MORE", end + 1)
else
console_print(id, "----- %L -----", id, "PAUSE_USE_BEGIN")
}
else {
} else {
console_print(id, "%L", id, "PAUSE_USAGE")
console_print(id, "%L:", id, "PAUSE_COMMANDS")
console_print(id, "%L", id, "COM_PAUSE_OFF")
@ -364,33 +468,47 @@ public cmdPlugin(id,level,cid) {
console_print(id, "%L", id, "COM_PAUSE_LIST")
console_print(id, "%L", id, "COM_PAUSE_ADD")
}
return PLUGIN_HANDLED
}
saveSettings(filename[]) {
saveSettings(filename[])
{
if (file_exists(filename))
delete_file(filename)
new text[256], file[32], title[32], status[2]
new inum = get_pluginsnum()
if (!write_file(filename, ";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename"))
return 0
for (new a = 0; a < inum; ++a) {
for (new a = 0; a < inum; ++a)
{
get_plugin(a, file, 31, title, 31, status, 0, status, 0, status, 1)
if ( status[0] == 's' ){
if (status[0] == 's')
{
format(text, 255, "^"%s^" ;%s", title, file)
write_file(filename, text)
}
}
return 1
}
loadSettings(filename[]) {
if (!file_exists(filename)) return 0
loadSettings(filename[])
{
if (!file_exists(filename))
return 0
new name[256], file[32], i, pos = 0
while (read_file(filename,pos++,name,255,i)){
if ( name[0]!= ';' && parse(name,name,31) &&
(i = findPluginByTitle( name , file , 31 ) != -1) )
while (read_file(filename, pos++, name, 255, i))
{
if (name[0] != ';' && parse(name, name, 31) && (i = findPluginByTitle(name, file, 31) != -1))
pause("dc", file)
}
return 1
}

View File

@ -61,9 +61,9 @@ public plugin_natives()
set_native_filter("native_filter")
}
public plugin_init() {
public plugin_init()
{
register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("common.txt")
register_dictionary("admincmd.txt")
register_dictionary("plmenu.txt")
@ -95,6 +95,7 @@ public module_filter(const module[])
{
if (equali(module, "cstrike"))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
@ -108,15 +109,19 @@ public native_filter(const name[], index, trap)
/* Ban menu */
public actionBanMenu(id,key) {
switch (key) {
case 7: {
/* BEGIN OF CHANGES BY MISTAGEE
ADDED A FEW MORE OPTIONS */
public actionBanMenu(id, key)
{
switch (key)
{
case 7:
{
/* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
++g_menuOption[id]
g_menuOption[id] %= 7
switch(g_menuOption[id]){
switch (g_menuOption[id])
{
case 0: g_menuSettings[id] = 0
case 1: g_menuSettings[id] = 5
case 2: g_menuSettings[id] = 10
@ -130,29 +135,35 @@ public actionBanMenu(id,key) {
}
case 8: 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 name[32], name2[32], authid[32], authid2[32]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
new userid2 = get_user_userid(player)
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] )
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])
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
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)
}
/* ---------- check for Steam ID added by MistaGee --------------------
IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */
if ( (equal("4294967295",authid2)) || (equal("HLTV",authid2)) || (equali("VALVE_ID_LAN",authid2))) { /* lan or HLTV!*/ /* END OF MODIFICATIONS BY MISTAGEE */
if ((equal("4294967295", authid2)) || (equal("HLTV", authid2)) || (equali("VALVE_ID_LAN", authid2))) /* lan or HLTV!*/
{
/* END OF MODIFICATIONS BY MISTAGEE */
new ipa[32]
get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
}
else
@ -163,11 +174,14 @@ public actionBanMenu(id,key) {
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayBanMenu(id,pos) {
if (pos < 0) return
displayBanMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -180,28 +194,27 @@ displayBanMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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) || access(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)
}
@ -212,16 +225,19 @@ displayBanMenu(id,pos) {
else
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")
keys |= MENU_KEY_9
}
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
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))
return PLUGIN_HANDLED
@ -234,27 +250,35 @@ public cmdBanMenu(id,level,cid) {
/* Slap/Slay */
public actionSlapMenu(id,key) {
switch (key) {
case 7: {
public actionSlapMenu(id, key)
{
switch (key)
{
case 7:
{
++g_menuOption[id]
g_menuOption[id] %= 4
switch (g_menuOption[id]) {
switch (g_menuOption[id])
{
case 1: g_menuSettings[id] = 0
case 2: g_menuSettings[id] = 1
case 3: g_menuSettings[id] = 5
}
displaySlapMenu(id, g_menuPosition[id])
}
case 8: 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 name2[32]
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)
displaySlapMenu(id, g_menuPosition[id])
return PLUGIN_HANDLED
@ -266,18 +290,20 @@ public actionSlapMenu(id,key) {
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
if ( g_menuOption[id] ) {
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")) {
if (g_menuOption[id])
{
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, "%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")) {
} 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, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2)
}
@ -291,12 +317,14 @@ public actionSlapMenu(id,key) {
displaySlapMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displaySlapMenu(id,pos) {
if (pos < 0) return
displaySlapMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -309,25 +337,26 @@ displaySlapMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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_cstrike)
{
if (cs_get_user_team(i) == CS_TEAM_T)
{
copy(team, 3, "TE")
} else if (cs_get_user_team(i) == CS_TEAM_CT) {
}
else if (cs_get_user_team(i) == CS_TEAM_CT)
{
copy(team, 3, "CT")
} else {
get_user_team(i, team, 3)
@ -336,19 +365,17 @@ displaySlapMenu(id,pos) {
get_user_team(i, team, 3)
}
if ( !is_user_alive(i) || access(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
{
} 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, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
}
}
@ -357,18 +384,21 @@ displaySlapMenu(id,pos) {
else
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")
keys |= MENU_KEY_9
}
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
}
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_menuSettings[id] = 0
@ -382,23 +412,26 @@ public cmdSlapMenu(id,level,cid)
public actionKickMenu(id, key)
{
switch (key) {
switch (key)
{
case 8: 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 authid[32], authid2[32], name[32], name2[32]
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
get_user_name(player, name2, 31)
new userid2 = get_user_userid(player)
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid, name2,userid2,authid2 )
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", 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, "%L", LANG_PLAYER, "ADMIN_KICK_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_1", name2)
}
@ -409,11 +442,14 @@ public actionKickMenu(id,key)
displayKickMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayKickMenu(id,pos) {
if (pos < 0) return
displayKickMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -426,44 +462,45 @@ displayKickMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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 ( access(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)
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 (end != g_menuPlayersNum[id]) {
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. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
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)
@ -472,26 +509,31 @@ public cmdKickMenu(id,level,cid) {
/* Team menu */
public actionTeamMenu(id,key) {
switch (key) {
case 7:{
public actionTeamMenu(id, key)
{
switch (key)
{
case 7:
{
g_menuOption[id] = 1 - g_menuOption[id]
displayTeamMenu(id, g_menuPosition[id])
}
case 8: 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 authid[32], authid2[32], name[32], name2[32]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
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" )
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")
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
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")
}
@ -502,6 +544,7 @@ public actionTeamMenu(id,key) {
cs_reset_user_model(player)
} else {
new limit_setting = get_cvar_num("mp_limitteams")
set_cvar_num("mp_limitteams", 0)
engclient_cmd(player, "jointeam", g_menuOption[id] ? "1" : "2")
engclient_cmd(player, "joinclass", "1")
@ -511,12 +554,14 @@ public actionTeamMenu(id,key) {
displayTeamMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayTeamMenu(id,pos) {
if (pos < 0) return
displayTeamMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -529,25 +574,28 @@ displayTeamMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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_cstrike)
{
iteam = _:cs_get_user_team(i)
if (iteam == 1) {
if (iteam == 1)
{
copy(team, 3, "TE")
} else if (iteam == 2) {
}
else if (iteam == 2)
{
copy(team, 3, "CT")
} else {
get_user_team(i, team, 3)
@ -556,17 +604,17 @@ displayTeamMenu(id,pos) {
iteam = get_user_team(i, team, 3)
}
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(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, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
}
}
@ -577,13 +625,16 @@ displayTeamMenu(id,pos) {
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. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Team Menu")
}
public cmdTeamMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdTeamMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 0
@ -594,44 +645,58 @@ public cmdTeamMenu(id,level,cid) {
/* Client cmds menu */
public actionClcmdMenu(id,key) {
switch (key) {
case 7:{
public actionClcmdMenu(id, key)
{
switch (key)
{
case 7:
{
++g_menuOption[id]
g_menuOption[id] %= g_menuSelectNum[id]
displayClcmdMenu(id, g_menuPosition[id])
}
case 8: 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 flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
if (is_user_connected(player)) {
if (is_user_connected(player))
{
new command[64], authid[32], name[32], userid[32]
copy(command, 63, g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player, authid, 31)
get_user_name(player, name, 31)
num_to_str(get_user_userid(player), userid, 31)
replace(command, 63, "%userid%", userid)
replace(command, 63, "%authid%", authid)
replace(command, 63, "%name%", name)
if (flags & 1) {
if (flags & 1)
{
server_cmd(command)
server_exec()
}
else if (flags & 2)
} else if (flags & 2)
client_cmd(id, command)
else if (flags & 4)
client_cmd(player, command)
}
if (flags & 8) displayClcmdMenu(id,g_menuPosition[id])
if (flags & 8)
displayClcmdMenu(id, g_menuPosition[id])
}
}
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])
@ -644,28 +709,27 @@ displayClcmdMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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] || access(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)
}
@ -676,16 +740,19 @@ displayClcmdMenu(id,pos) {
else
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")
keys |= MENU_KEY_9
}
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
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))
return PLUGIN_HANDLED
@ -704,20 +771,22 @@ 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 ,
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
if (parse(text, g_clcmdName[g_clcmdNum], 31, 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
}

View File

@ -45,14 +45,16 @@ new Float:g_xPos
new g_Length
new g_Frequency
public plugin_init() {
public plugin_init()
{
register_plugin("Scrolling Message", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("scrollmsg.txt")
register_dictionary("common.txt")
register_srvcmd("amx_scrollmsg", "setMessage")
}
public showMsg() {
public showMsg()
{
new a = g_startPos, i = 0
while (a < g_endPos)
@ -65,7 +67,8 @@ public showMsg() {
if (g_xPos > 0.35)
g_xPos -= 0.0063
else {
else
{
g_startPos++
g_xPos = 0.35
}
@ -74,35 +77,48 @@ public showMsg() {
show_hudmessage(0, g_displayMsg)
}
public msgInit() {
public msgInit()
{
g_endPos = 1
g_startPos = 0
g_xPos = 0.65
set_task(SPEED, "showMsg", 123, "", 0, "a", g_Length + 48)
client_print(0, print_console, g_scrollMsg)
}
public setMessage() {
public setMessage()
{
remove_task(123) /* remove current messaging */
read_argv(1, g_scrollMsg, 380)
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_scrollMsg, 380, "%hostname%", hostname)
g_Length = strlen(g_scrollMsg)
new mytime[32]
read_argv(2, mytime, 31)
g_Frequency = str_to_num(mytime)
if (g_Frequency > 0) {
if (g_Frequency > 0)
{
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
if (g_Frequency < minimal) {
if (g_Frequency < minimal)
{
server_print("%L", LANG_SERVER, "MIN_FREQ", minimal)
g_Frequency = minimal
}
server_print("%L",LANG_SERVER,"MSG_FREQ",
g_Frequency/60,g_Frequency%60)
server_print("%L", LANG_SERVER, "MSG_FREQ", g_Frequency / 60, g_Frequency % 60)
set_task(float(g_Frequency), "msgInit", 123, "", 0, "b")
}
else
server_print("%L", LANG_SERVER, "MSG_DISABLED")
return PLUGIN_HANDLED
}

View File

@ -45,105 +45,137 @@ new g_menuPosition[33]
new g_fileToSave[64]
new bool:g_modified
public plugin_precache() {
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")
}
public plugin_init() {
public plugin_init()
{
register_plugin("Stats Configuration", AMXX_VERSION_STR, "AMXX Dev Team")
register_menucmd(register_menuid("Stats Configuration"), 1023, "actionCfgMenu")
get_configsdir(g_fileToSave, 63)
format(g_fileToSave, 63, "%s/stats.ini", g_fileToSave)
loadSettings(g_fileToSave)
}
public cmdCfg( id,level,cid ) {
public cmdCfg(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new cmds[32]
read_argv(1, cmds, 31)
new option = equali(cmds, "on") ? 1 : 0
if ( !option ) option = equali(cmds, "off" ) ? 2 : 0
if ( read_argc() > 2 && option ) {
if (!option)
option = equali(cmds, "off") ? 2 : 0
if (read_argc() > 2 && option)
{
new var[32], enabled = 0
read_argv(2, var, 31)
for ( new a = 0; a < g_menuDataNum; ++a ) {
if ( containi( g_menuDataVar[ a ] , var ) != -1 ) {
for (new a = 0; a < g_menuDataNum; ++a)
{
if (containi(g_menuDataVar[a], var) != -1)
{
g_modified = true
++enabled
if ( option == 1 ) {
if (option == 1)
{
set_xvar_num(g_menuDataId[a], 1)
console_print(id, "%L: %s", id, "STATS_ENABLED", g_menuData[a])
}
else {
} else {
set_xvar_num(g_menuDataId[a], 0)
console_print(id, "%L: %s", id, "STATS_DISABLED", g_menuData[a])
}
}
}
if (enabled)
console_print(id, "%L", id, "TOTAL_NUM", enabled)
else
console_print(id, "%L", id, "NO_OPTION", var)
}
else if ( equali(cmds, "save" ) ) {
if ( saveSettings( g_fileToSave ) ){
else if (equali(cmds, "save"))
{
if (saveSettings(g_fileToSave))
{
g_modified = false
console_print(id, "%L", id, "STATS_CONF_SAVED")
}
else
console_print(id, "%L", id, "STATS_CONF_FAILED")
}
else if ( equali(cmds, "load" ) ) {
if ( loadSettings( g_fileToSave ) ){
else if (equali(cmds, "load"))
{
if (loadSettings(g_fileToSave))
{
g_modified = false
console_print(id, "%L", id, "STATS_CONF_LOADED")
}
else
console_print(id, "%L", id, "STATS_CONF_FAIL_LOAD")
}
else if ( equali(cmds, "list" ) ) {
else if (equali(cmds, "list"))
{
new arg1[8]
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
if (--start < 0) start = 0
if (start >= g_menuDataNum) start = g_menuDataNum - 1
if (start >= g_menuDataNum)
start = g_menuDataNum - 1
new end = start + 10
if (end > g_menuDataNum) end = g_menuDataNum
if (end > g_menuDataNum)
end = g_menuDataNum
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)
{
new lOnOff[16]
for (new a = start; a < end; ++a) {
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], lOnOff)
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s", a + 1, g_menuData[a], g_menuDataVar[a], lOnOff)
}
}
console_print(id, "----- %L -----", id, "STATS_ENTRIES_OF", start + 1, end, g_menuDataNum)
if (end < g_menuDataNum)
console_print(id, "----- %L -----", id, "STATS_USE_MORE", end + 1)
else
console_print(id, "----- %L -----", id, "STATS_USE_BEGIN")
}
else if ( equali(cmds, "add" ) && read_argc() > 3 ) {
if ( g_menuDataNum < MAX_MENU_DATA ) {
else if (equali(cmds, "add") && read_argc() > 3)
{
if (g_menuDataNum < MAX_MENU_DATA)
{
read_argv(2, g_menuData[g_menuDataNum], 31)
read_argv(3, g_menuDataVar[g_menuDataNum], 31)
g_menuDataId[g_menuDataNum] = get_xvar_id(g_menuDataVar[g_menuDataNum])
++g_menuDataNum
}
else console_print(id, "%L",id,"CANT_ADD_STATS")
}
else {
else
console_print(id, "%L", id, "CANT_ADD_STATS")
} else {
console_print(id, "%L", id, "COM_STATS_USAGE")
console_print(id, "%L", id, "COM_STATS_COM")
console_print(id, "%L", id, "COM_STATS_ON")
@ -157,84 +189,122 @@ public cmdCfg( id,level,cid ) {
return PLUGIN_HANDLED
}
public cmdCfgMenu(id,level,cid) {
public cmdCfgMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayCfgMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED
}
displayCfgMenu(id,pos) {
if (pos < 0) return
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,"\y%L\R%d/%d^n\w^n",
id,"STATS_CONF",pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
if (start >= g_menuDataNum)
start = pos = g_menuPosition[id] = 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) {
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%L^n\w",++k,
g_menuData[a], id, 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, "\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) {
if (end != g_menuDataNum)
{
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
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) {
switch(key) {
case 7: {
if (saveSettings(g_fileToSave)) {
public actionCfgMenu(id, key)
{
switch (key)
{
case 7:
{
if (saveSettings(g_fileToSave))
{
g_modified = false
client_print(id, print_chat, "* %L", id, "STATS_CONF_SAVED")
}
else
client_print(id, print_chat, "* %L", id, "STATS_CONF_FAILED")
displayCfgMenu(id, g_menuPosition[id])
}
case 8: displayCfgMenu(id, ++g_menuPosition[id])
case 9: displayCfgMenu(id, --g_menuPosition[id])
default: {
default:
{
g_modified = true
new a = g_menuPosition[id] * 7 + key
set_xvar_num(g_menuDataId[a], 1 - get_xvar_num(g_menuDataId[a]))
displayCfgMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
saveSettings(filename[]) {
saveSettings(filename[])
{
if (file_exists(filename))
delete_file(filename)
if (!write_file(filename, ";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
return 0
new text[256]
for(new a = 0; a < g_menuDataNum; ++a){
if ( get_xvar_num( g_menuDataId[ a ] ) ) {
for (new a = 0; a < g_menuDataNum; ++a)
{
if (get_xvar_num(g_menuDataId[a]))
{
format(text, 255, "%-24.23s ;%s", g_menuDataVar[a], g_menuData[a])
write_file(filename, text)
}
}
return 1
}
loadSettings(filename[]) {
loadSettings(filename[])
{
if (!file_exists(filename))
return 0
new text[256], name[32]
new len, pos = 0, xid
while (read_file(filename,pos++,text,255,len)) {
while (read_file(filename, pos++, text, 255, len))
{
if (text[0] == ';') continue // line is a comment
parse(text, name, 31)
if ((xid = get_xvar_id(name)) != -1)
set_xvar_num(xid, 1)
}
return 1
}

View File

@ -43,7 +43,8 @@ new g_menuOption[33] = { -1 , ... }
new g_menuOrgin[33][3]
new g_coloredMenus
public plugin_init() {
public plugin_init()
{
register_plugin("Teleport Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("telemenu.txt")
register_dictionary("common.txt")
@ -53,37 +54,45 @@ public plugin_init() {
g_coloredMenus = colored_menus()
}
public actionTelMenu(id,key) {
switch (key) {
case 6: {
public actionTelMenu(id, key)
{
switch (key)
{
case 6:
{
g_menuOption[id] = 1 - g_menuOption[id]
displayTelMenu(id, g_menuPosition[id])
}
case 7: {
case 7:
{
if (g_menuOption[id] < 0) /* unlocking position for the first time */
g_menuOption[id] = 0
get_user_origin(id, g_menuOrgin[id])
displayTelMenu(id, g_menuPosition[id])
}
case 8: displayTelMenu(id, ++g_menuPosition[id])
case 9: displayTelMenu(id, --g_menuPosition[id])
default: {
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
new name2[32]
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)
displayTelMenu(id, g_menuPosition[id])
return PLUGIN_HANDLED
}
if (g_menuOption[id] > 0) {
if (g_menuOption[id] > 0)
{
set_user_origin(player, g_menuOrgin[id])
}
else {
} else {
new origin[3]
get_user_origin(id, origin)
set_user_origin(player, origin)
}
@ -94,10 +103,10 @@ public actionTelMenu(id,key) {
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
switch (get_cvar_num("amx_show_activity")) {
switch (get_cvar_num("amx_show_activity"))
{
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)
}
@ -105,10 +114,12 @@ public actionTelMenu(id,key) {
displayTelMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayTelMenu(id,pos) {
displayTelMenu(id, pos)
{
if (pos < 0)
return
@ -124,52 +135,52 @@ displayTelMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ?
"\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 len = format(menuBody, 511, g_coloredMenus ? "\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
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 ( blockMenu || !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) {
if (blockMenu || !is_user_alive(i) || (get_user_flags(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_menuOption[id] > 0 ) { // 1
if (g_menuOption[id] > 0) // 1
{
keys |= MENU_KEY_7
len += format(menuBody[len],511-len,"^n7. To location: %d %d %d^n",
g_menuOrgin[id][0],g_menuOrgin[id][1] ,g_menuOrgin[id][2])
len += format(menuBody[len], 511-len, "^n7. To location: %d %d %d^n", g_menuOrgin[id][0], g_menuOrgin[id][1], g_menuOrgin[id][2])
}
else if ( g_menuOption[id] ) { // -1
else if (g_menuOption[id]) // -1
{
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "^n\d7. %L^n\w", id, "CUR_LOC")
else
len += format(menuBody[len], 511-len, "^n#. %L^n", id, "CUR_LOC")
}
else { // 0
} else { // 0
keys |= MENU_KEY_7
len += format(menuBody[len], 511-len, "^n7. %L^n", id, "CUR_LOC")
}
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. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
@ -179,7 +190,8 @@ displayTelMenu(id,pos) {
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))
displayTelMenu(id, g_menuPosition[id] = 0)

View File

@ -39,7 +39,8 @@ new g_LastTime
new g_CountDown
new g_Switch
public plugin_init() {
public plugin_init()
{
register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("timeleft.txt")
register_cvar("amx_time_voice", "1")
@ -47,42 +48,59 @@ public plugin_init() {
register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
}
public sayTheTime(id){
if ( get_cvar_num("amx_time_voice") ) {
public sayTheTime(id)
{
if (get_cvar_num("amx_time_voice"))
{
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
get_time("%H", mhours, 5)
get_time("%M", mmins, 5)
new mins = str_to_num(mmins)
new hrs = str_to_num(mhours)
if (mins)
num_to_word(mins, wmins, 31)
else
wmins[0] = 0
if (hrs < 12)
wpm = "am "
else {
else
{
if (hrs > 12) hrs -= 12
wpm = "pm "
}
if (hrs)
num_to_word(hrs, whours, 31)
else
whours = "twelve "
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
}
new ctime[64]
get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
client_print(0, print_chat, "%L: %s", LANG_PLAYER, "THE_TIME", ctime)
return PLUGIN_CONTINUE
}
public sayTimeLeft(id) {
if (get_cvar_float("mp_timelimit")) {
public sayTimeLeft(id)
{
if (get_cvar_float("mp_timelimit"))
{
new a = get_timeleft()
if ( get_cvar_num("amx_time_voice") ) {
if (get_cvar_num("amx_time_voice"))
{
new svoice[128]
setTimeVoice(svoice, 127, 0, a)
client_cmd(id, svoice)
@ -91,12 +109,15 @@ public sayTimeLeft(id) {
}
else
client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
return PLUGIN_CONTINUE
}
setTimeText(text[],len,tmlf,id) {
setTimeText(text[], len, tmlf, id)
{
new secs = tmlf % 60
new mins = tmlf / 60
if (secs == 0)
format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
else if (mins == 0)
@ -105,95 +126,146 @@ setTimeText(text[],len,tmlf,id) {
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 secs = tmlf % 60
new mins = tmlf / 60
for (new a = 0;a < 7;++a)
temp[a][0] = 0
if (secs > 0){
if (secs > 0)
{
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
num_to_word(hours, temp[0], 31)
if (!(flags & 8)) temp[1] = "hours "
if (!(flags & 8))
temp[1] = "hours "
mins = mins % 60
}
if (mins > 0) {
if (mins > 0)
{
num_to_word(mins, temp[2], 31)
if (!(flags & 8)) temp[3] = "minutes "
if (!(flags & 8))
temp[3] = "minutes "
}
if (!(flags & 4)) temp[6] = "remaining "
if (!(flags & 4))
temp[6] = "remaining "
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) {
for(new i = 0;g_TimeSet[i][0];++i) {
if (g_TimeSet[i][1] & 16) {
if (g_TimeSet[i][0] > time) {
if (!g_Switch) {
findDispFormat(time)
{
for (new i = 0; g_TimeSet[i][0]; ++i)
{
if (g_TimeSet[i][1] & 16)
{
if (g_TimeSet[i][0] > time)
{
if (!g_Switch)
{
g_CountDown = g_Switch = time
remove_task(8648458)
set_task(1.0, "timeRemain", 34543, "", 0, "b")
}
return i
}
}
else if (g_TimeSet[i][0] == time) {
else if (g_TimeSet[i][0] == time)
{
return i
}
}
return -1
}
public setDisplaying() {
public setDisplaying()
{
new arg[32], flags[32], num[32]
new argc = read_argc() - 1
new i = 0
while (i < argc && i < 32) {
while (i < argc && i < 32)
{
read_argv(i + 1, arg, 31)
parse(arg, flags, 31, num, 31)
g_TimeSet[i][0] = str_to_num(num)
g_TimeSet[i][1] = read_flags(flags)
i++
}
g_TimeSet[i][0] = 0
return PLUGIN_HANDLED
}
public timeRemain(param[]) {
public timeRemain(param[])
{
new gmtm = get_timeleft()
new tmlf = g_Switch ? --g_CountDown : gmtm
new stimel[12]
format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
set_cvar_string("amx_timeleft", stimel)
if ( g_Switch && gmtm > g_Switch ) {
if (g_Switch && gmtm > g_Switch)
{
remove_task(34543)
g_Switch = 0
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
return
}
if (tmlf > 0 && g_LastTime != tmlf) {
if (tmlf > 0 && g_LastTime != tmlf)
{
g_LastTime = tmlf
new tm_set = findDispFormat(tmlf)
if ( tm_set != -1){
if (tm_set != -1)
{
new flags = g_TimeSet[tm_set][1]
new arg[128]
if (flags & 1) {
if (flags & 1)
{
new players[32], pnum
get_players(players, pnum, "c")
for (new i=0;i<pnum;i++) {
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(players[i], arg)
}
}
if (flags & 2) {
if (flags & 2)
{
setTimeVoice(arg, 127, flags, tmlf)
client_cmd(0, arg)
}