[PHP]/* AMXX-Studio ??*/
/* UTF-8 func by www.DT-Club.net */
#include <amxmodx>
#include <amxmisc>
#include <dbi>
#include <cstrike>
#include <csstats>
#include <fun>
#include <string>
#define MAX_STRING_LENGTH 33
#define INDEX 33
new g_players_name[INDEX][MAX_STRING_LENGTH]
//mysql struct
new g_host[MAX_STRING_LENGTH]
new g_user[MAX_STRING_LENGTH]
new g_pass[MAX_STRING_LENGTH]
new g_dbname[MAX_STRING_LENGTH]
new g_sql_table[MAX_STRING_LENGTH]
new g_error[MAX_STRING_LENGTH]
public plugin_init()
{
register_plugin("cheatkick", "1.0", "kof");
register_cvar("sql_host","127.0.0.1") //sql host
register_cvar("sql_user","root") //sql username
register_cvar("sql_pass","test") //sql password
register_cvar("sql_db","cheat") //database name
register_cvar("sql_table", "ban") //table name
get_cvar_string("sql_host", g_host,MAX_STRING_LENGTH)
get_cvar_string("sql_user", g_user,MAX_STRING_LENGTH)
get_cvar_string("sql_pass", g_pass,MAX_STRING_LENGTH)
get_cvar_string("sql_db", g_dbname,MAX_STRING_LENGTH)
get_cvar_string("sql_table", g_sql_table,MAX_STRING_LENGTH)
//???...
}
public client_connect(id)
{
new Sql:db= dbi_connect(g_host,g_user,g_pass,g_dbname,g_error,MAX_STRING_LENGTH)
if (db!= SQL_FAILED)
{
get_user_name(id,g_players_name[id], MAX_STRING_LENGTH-1)
new Result:QueryResult = dbi_query(db,"SELECT * FROM `%s` WHERE auth ='%s'",g_sql_table,g_players_name[id])
if (QueryResult == RESULT_NONE)
{
//new userid2 = get_user_userid(id)
log_amx("[test] Sorry")
//server_print("zhi xing dao le");
//server_cmd("kick #%d", g_players_name[id])
}
}else{
//log_amx("[www.rainbw.cn] MYSQL Connection Failed!")
//server_print("zhi xing dao le");
server_cmd("kick #%d", g_players_name[id])
//return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
[/PHP] |