PHP Code:
#include <amxmodx>
#include <amxmisc>
new g_Password;
public plugin_init()
{
register_plugin("Simple Password",AMXX_VERSION_STR,"SmileY");
g_Password = get_cvar_pointer("sv_password");
register_clcmd("say","cmd_SAY");
register_clcmd("say_team","cmd_SAY");
// To remove a password using this comand, using .password "" (With the double quotes "")
register_concmd(".password","cmdPassword",ADMIN_PASSWORD,".password <Password>");
}
public cmd_SAY(id)
{
new szArgs[192];
read_args(szArgs,charsmax(szArgs));
remove_quotes(szArgs);
if(szArgs[0] == '.')
{
client_cmd(id,szArgs);
return PLUGIN_HANDLED; // Remove the .password XXX comand from Chat
}
return PLUGIN_CONTINUE;
}
public cmdPassword(id,level,cid)
{
if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
new szArgs[192];
read_args(szArgs,charsmax(szArgs));
remove_quotes(szArgs);
new szName[32];
get_user_name(id,szName,charsmax(szName));
if(equali(szArgs,"^"^""))
{
set_pcvar_string(g_Password,"");
client_print(0,print_chat,"[AMXX] %s Removed the Password to server!",szName);
return PLUGIN_HANDLED;
}
else
{
set_pcvar_string(g_Password,szArgs);
client_print(0,print_chat,"[AMXX] %s Added a new Password to server!",szName);
}
return PLUGIN_CONTINUE;
}
Use .password XXXX to add, and .password "" to remove the server pass
__________________