/* AMX Mod X script
 *
 * (C) Copyright 2008, BoBRoCK + Ser_UFL
 * Этот файл распространяется "как есть" без каких-либо гарантий итд итп..
 * 
 * Пароль по умолчанию: "password"
 * Вставить следующую строчку в server.cfg для изменения пароля администратора
 * webmod_adminpass "password"
*/

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "WebMod Admin Password"
#define VERSION "0.4"
#define AUTHOR "BoBRoCK+Co"

public client_connect(id)
{
	new webmodflags
	new webmodflagsstring[32]
	new webmodflagscvar[32]

	webmodflags = get_user_flags(id)
	get_flags(webmodflags,webmodflagsstring,31)

	format(webmodflagscvar,18,"amx_userflags%d",id)
	set_cvar_string(webmodflagscvar, webmodflagsstring)
	return PLUGIN_CONTINUE
}

public client_infochanged(id) 
{
	client_connect(id)
	return PLUGIN_CONTINUE
} 


public admin_publicsay(id,level,cid){
	if (!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
	new message[192]
	read_args(message,191)
	remove_quotes(message)
	client_print(0,print_chat,"(WebMod) : %s",message)
	console_print(id,"(WebMod) : %s",message)
	return PLUGIN_HANDLED
}

public admin_privatesay(id,level,cid){
	if (!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED
	new name[32]
	read_argv(1,name,31)
	new priv = cmd_target(id,name,0)
	if (!priv) return PLUGIN_HANDLED
	new length = strlen(name)+1
	new message[192], name2[32]
	get_user_name(id,name2,31)
	read_args(message,191)
	remove_quotes(message[length])
	get_user_name(priv,name,31)
	if (id&&id!=priv) client_print(id,print_chat,"(WebMod)(Private) %s :   %s",name,message[length])
	client_print(priv,print_chat,"(WebMod)(Private) %s :   %s",name,message[length])
	console_print(id,"(WebMod)(Private) %s :   %s",name,message[length])
	return PLUGIN_HANDLED
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_srvcmd("webmod_publicsay","admin_publicsay")
	register_srvcmd("webmod_privatesay","admin_privatesay")
	register_cvar("webmod_adminpass","password")
	register_cvar("w_version","0.48 (Unofficial)")
	register_cvar("w_theme","1")
	register_cvar("w_reallite_version","Reallite Edition 1.0")

	register_cvar("amx_userflags1","",FCVAR_SPONLY)
	register_cvar("amx_userflags2","",FCVAR_SPONLY)
	register_cvar("amx_userflags3","",FCVAR_SPONLY)
	register_cvar("amx_userflags4","",FCVAR_SPONLY)
	register_cvar("amx_userflags5","",FCVAR_SPONLY)
	register_cvar("amx_userflags6","",FCVAR_SPONLY)
	register_cvar("amx_userflags7","",FCVAR_SPONLY)
	register_cvar("amx_userflags8","",FCVAR_SPONLY)
	register_cvar("amx_userflags9","",FCVAR_SPONLY)
	register_cvar("amx_userflags10","",FCVAR_SPONLY)
	register_cvar("amx_userflags11","",FCVAR_SPONLY)
	register_cvar("amx_userflags12","",FCVAR_SPONLY)
	register_cvar("amx_userflags13","",FCVAR_SPONLY)
	register_cvar("amx_userflags14","",FCVAR_SPONLY)
	register_cvar("amx_userflags15","",FCVAR_SPONLY)
	register_cvar("amx_userflags16","",FCVAR_SPONLY)
	register_cvar("amx_userflags17","",FCVAR_SPONLY)
	register_cvar("amx_userflags18","",FCVAR_SPONLY)
	register_cvar("amx_userflags19","",FCVAR_SPONLY)
	register_cvar("amx_userflags20","",FCVAR_SPONLY)
	register_cvar("amx_userflags21","",FCVAR_SPONLY)
	register_cvar("amx_userflags22","",FCVAR_SPONLY)
	register_cvar("amx_userflags23","",FCVAR_SPONLY)
	register_cvar("amx_userflags24","",FCVAR_SPONLY)
	register_cvar("amx_userflags25","",FCVAR_SPONLY)
	register_cvar("amx_userflags26","",FCVAR_SPONLY)
	register_cvar("amx_userflags27","",FCVAR_SPONLY)
	register_cvar("amx_userflags28","",FCVAR_SPONLY)
	register_cvar("amx_userflags29","",FCVAR_SPONLY)
	register_cvar("amx_userflags30","",FCVAR_SPONLY)
	register_cvar("amx_userflags31","",FCVAR_SPONLY)
	register_cvar("amx_userflags32","",FCVAR_SPONLY)

	return PLUGIN_CONTINUE
}
