Ниже плагин который делал некий dias, плагин работает с файлом black_list.ini, я сделал подключение к базе, а далее уже не получается.
- Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <ucp>
#define PLUGIN "Black List
#define VERSION "0.000"
#define AUTHOR "hero"
new const user_file[] = "black_list.ini"
new Array:BlackList
new Handle:SQL_Tuple
new Handle:SQL_Connection
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
SQL_Tuple = SQL_MakeDbTuple("host","user","password","database")
new err, error[256]
SQL_Connection = SQL_Connect(SQL_Tuple, err, error, charsmax(error))
if(SQL_Connection != Empty_Handle)
{
log_amx("[SQLx connect ok]")
}else{
log_amx("[SQLX sql error] %s ",error)
pause("a")
}
}
public plugin_precache()
{
BlackList = ArrayCreate(32, 1)
read_user_from_file()
}
public read_user_from_file()
{
static user_file_url[64], config_dir[32]
get_configsdir(config_dir, sizeof(config_dir))
format(user_file_url, sizeof(user_file_url), "%s/%s", config_dir, user_file)
if(!file_exists(user_file_url))
return
static file_handle, line_data[64], line_count
file_handle = fopen(user_file_url, "rt")
while(!feof(file_handle))
{
fgets(file_handle, line_data, sizeof(line_data))
replace(line_data, charsmax(line_data), "^n", "")
if(!line_data[0] || line_data[0] == ';')
continue
ArrayPushString(BlackList, line_data)
line_count++
}
fclose(file_handle)
}
public client_connect(id)
{
check_and_handle(id)
}
public client_infochanged(id)
{
check_and_handle(id)
}
public check_and_handle(id)
{
static name[64], ucp[9], Data[32]
get_user_name(id, name, sizeof(name))
ucp_id(id, ucp)
for(new i = 0; i < ArraySize(BlackList); i++)
{
ArrayGetString(BlackList, i, Data, sizeof(Data))
if(equal(name, Data) || equal(ucp, Data))
{
server_cmd("amx_kick %s kappa^n", name)
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
Люди добрые, помогите с реализацией данной вещи