Merge pull request #87 from xPaw/what-is-this

Instead of assigning FCVAR_PROTECTED to cvars after startup, register cv...
This commit is contained in:
Vincent Herbet 2014-07-28 23:41:40 +02:00
commit b4365e3fb9
7 changed files with 27 additions and 39 deletions

View File

@ -69,16 +69,16 @@ public plugin_init()
#endif
register_dictionary("admin.txt")
register_dictionary("common.txt")
amx_mode=register_cvar("amx_mode", "1")
amx_password_field=register_cvar("amx_password_field", "_pw")
amx_default_access=register_cvar("amx_default_access", "")
amx_mode=register_cvar("amx_mode", "1", FCVAR_PROTECTED)
amx_password_field=register_cvar("amx_password_field", "_pw", FCVAR_PROTECTED)
amx_default_access=register_cvar("amx_default_access", "", FCVAR_PROTECTED)
register_cvar("amx_vote_ratio", "0.02")
register_cvar("amx_vote_time", "10")
register_cvar("amx_vote_answers", "1")
register_cvar("amx_vote_delay", "60")
register_cvar("amx_last_voting", "0")
register_cvar("amx_show_activity", "2")
register_cvar("amx_show_activity", "2", FCVAR_PROTECTED)
register_cvar("amx_votekick_ratio", "0.40")
register_cvar("amx_voteban_ratio", "0.40")
register_cvar("amx_votemap_ratio", "0.40")
@ -87,13 +87,13 @@ public plugin_init()
#if defined USING_SQL
register_srvcmd("amx_sqladmins", "adminSql")
register_cvar("amx_sql_table", "admins")
register_cvar("amx_sql_table", "admins", FCVAR_PROTECTED)
#endif
register_cvar("amx_sql_host", "127.0.0.1")
register_cvar("amx_sql_user", "root")
register_cvar("amx_sql_pass", "")
register_cvar("amx_sql_db", "amx")
register_cvar("amx_sql_type", "mysql")
register_cvar("amx_sql_host", "127.0.0.1", FCVAR_PROTECTED)
register_cvar("amx_sql_user", "root", FCVAR_PROTECTED)
register_cvar("amx_sql_pass", "", FCVAR_PROTECTED)
register_cvar("amx_sql_db", "amx", FCVAR_PROTECTED)
register_cvar("amx_sql_type", "mysql", FCVAR_PROTECTED)
register_concmd("amx_reloadadmins", "cmdReload", ADMIN_CFG)
register_concmd("amx_addadmin", "addadminfn", ADMIN_RCON, "<playername|auth> <accessflags> [password] [authtype] - add specified player as an admin to users.ini")

View File

@ -70,7 +70,7 @@ public plugin_init()
if (amx_show_activity == 0)
{
amx_show_activity = register_cvar("amx_show_activity", "2");
amx_show_activity = register_cvar("amx_show_activity", "2", FCVAR_PROTECTED);
}
new str[1]

View File

@ -42,7 +42,6 @@ new g_pauseCon
new Float:g_pausAble
new bool:g_Paused
new bool:g_PauseAllowed = false
new g_addCvar[] = "amx_cvar add %s"
new pausable;
new rcon_password;
@ -162,8 +161,7 @@ public plugin_init()
register_dictionary("admincmd.txt")
register_dictionary("common.txt")
register_dictionary("adminhelp.txt")
register_concmd("amx_kick", "cmdKick", ADMIN_KICK, "<name or #userid> [reason]")
register_concmd("amx_ban", "cmdBan", ADMIN_BAN|ADMIN_BAN_TEMP, "<name or #userid> <minutes> [reason]")
register_concmd("amx_banip", "cmdBanIP", ADMIN_BAN|ADMIN_BAN_TEMP, "<name or #userid> <minutes> [reason]")
@ -188,33 +186,19 @@ public plugin_init()
register_clcmd("amx_showrcon", "cmdShowRcon", ADMIN_RCON, "<command line>")
register_clcmd("pauseAck", "cmdLBack")
rcon_password=get_cvar_pointer("rcon_password");
pausable=get_cvar_pointer("pausable");
timelimit=get_cvar_pointer( "mp_timelimit" );
p_amx_tempban_maxtime = register_cvar("amx_tempban_maxtime", "4320");
p_amx_tempban_maxtime = register_cvar("amx_tempban_maxtime", "4320", FCVAR_PROTECTED);
g_tempBans = TrieCreate();
}
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")
server_cmd(g_addCvar, "amx_mode")
server_cmd(g_addCvar, "amx_password_field")
server_cmd(g_addCvar, "amx_default_access")
server_cmd(g_addCvar, "amx_reserved_slots")
server_cmd(g_addCvar, "amx_reservation")
server_cmd(g_addCvar, "amx_sql_table");
server_cmd(g_addCvar, "amx_sql_host");
server_cmd(g_addCvar, "amx_sql_user");
server_cmd(g_addCvar, "amx_sql_pass");
server_cmd(g_addCvar, "amx_sql_db");
server_cmd(g_addCvar, "amx_sql_type");
server_cmd(g_addCvar, "amx_tempban_maxtime");
new flags = get_pcvar_flags(rcon_password);
if (!(flags & FCVAR_PROTECTED))
{
set_pcvar_flags(rcon_password, flags | FCVAR_PROTECTED);
}
}
public cmdKick(id, level, cid)
@ -775,6 +759,8 @@ public cmdCvar(id, level, cid)
return PLUGIN_HANDLED
}
trim(arg);
if ((pointer=get_cvar_pointer(arg))==0)
{
console_print(id, "[AMXX] %L", id, "UNKNOWN_CVAR", arg)

View File

@ -44,7 +44,7 @@ public plugin_init()
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminslots.txt")
register_dictionary("common.txt")
g_ResPtr = register_cvar("amx_reservation", "0")
g_ResPtr = register_cvar("amx_reservation", "0", FCVAR_PROTECTED)
g_HidePtr = register_cvar("amx_hideslots", "0")
g_sv_visiblemaxplayers = get_cvar_pointer("sv_visiblemaxplayers")
}

View File

@ -362,6 +362,8 @@ public cmdVote(id, level, cid)
new quest[48]
read_argv(1, quest, 47)
trim(quest);
if (contain(quest, "sv_password") != -1 || contain(quest, "rcon_password") != -1)
{
console_print(id, "%L", id, "VOTING_FORBIDDEN")

View File

@ -158,7 +158,7 @@ stock show_activity( id, const name[], const fmt[], any:... )
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
__amx_show_activity = register_cvar("amx_show_activity", "2", FCVAR_PROTECTED);
}
}
@ -256,7 +256,7 @@ stock show_activity_id(idtarget, idadmin, const name[], const fmt[], any:...)
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
__amx_show_activity = register_cvar("amx_show_activity", "2", FCVAR_PROTECTED);
}
}
@ -335,7 +335,7 @@ stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___Ad
// if still not found, then register the cvar as a dummy
if (__amx_show_activity == 0)
{
__amx_show_activity = register_cvar("amx_show_activity", "2");
__amx_show_activity = register_cvar("amx_show_activity", "2", FCVAR_PROTECTED);
}
}

View File

@ -175,7 +175,7 @@ public plugin_cfg()
p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime);
if( !p_amx_tempban_maxtime )
{
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320");
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320", FCVAR_PROTECTED);
server_cmd("amx_cvar add %s", amx_tempban_maxtime);
}
}