兄弟們歡迎挑戰這個插件..能幫我轉為amxx的就是高手
//使用指令:amx_sql_pluginsaccess "0" //修改設定權限 0=所有管理員
amx_sql_system "0" //SQL儲存系統 0=關閉 1=ip address 2=name
amx_designation "0" //稱號系統
amx_designation_default "沒有稱號" //預設稱號
amx_sqlserver_ip "" //SQL 伺服器IP
amx_sqlserver_ac "" //SQL 伺服器帳戶
amx_sqlserver_pw "" //SQL 伺服器密碼
amx_sqlserver_db "" //SQL 伺服器數據庫
amx_sqlserver_tab "" //SQL 伺服器資料表
注意...此不是歷史文物.....這是遠古創世文物
所以技術含量極低.....請自行用腦力變成現代技術版
//-----------------//稱號
new fun_name;
new steam_id;
//-----------------//稱號
//稱號系統
register_cvar("amx_funname","0"); //是否打開稱號系統
register_cvar("amx_funname_save","0"); //是否打開存檔系統
//稱號系統
setting_funname = get_cvar_num("amx_funname"); //是否打開稱號系統
setting_funname_save = get_cvar_num("amx_funname_save"); //是否打開存檔系統
register_clcmd("say","allchat")
public client_putinserver(id)
{
if(setting_sqlserver_open && setting_funname && setting_funname_save)
{
sql_load_data(id)
}
return PLUGIN_CONTINUE
}
public sql_load_data(id)
{
new NetAddr
get_user_ip(id, NetAddr, 31, 1)
new Handle:hkcs_sql_connect = SQL_MakeDbTuple(hkcs_host,hkcs_user,hkcs_pass,hkcs_db)
new Handle:hkcs_sql = SQL_Connect(hkcs_sql_connect, errno, hkcs_error, 511)
get_user_authid(id, steam_id, 34)
if(equal(steam_id,"VALVE_ID_LAN"))
{
new Handle:hkcs_query_acc = SQL_PrepareQuery(hkcs_sql, "SELECT * FROM `%s` WHERE name_ip= '%s';",hkcs_tab,NetAddr);
SQL_Execute(hkcs_query_acc)
if(SQL_NumResults(hkcs_query_acc))
{
SQL_ReadResult(hkcs_query_acc, 2, fun_name,30) //設定稱號
}
else
if(!SQL_NumResults(hkcs_query_acc))
{
new Handle:query = SQL_PrepareQuery(hkcs_sql, "INSERT INTO `%s` (`name_ip`,`name`) VALUES ('%s','%s');",hkcs_tab,NetAddr,default_name);
SQL_Execute(query) //建立稱號
format(fun_name, 12, "%s",default_name)
}
}
else
{
new Handle:hkcs_query_acc = SQL_PrepareQuery(hkcs_sql, "SELECT * FROM `%s` WHERE steam_id= '%s';",hkcs_tab,steam_id);
SQL_Execute(hkcs_query_acc)
if(SQL_NumResults(hkcs_query_acc))
{
SQL_ReadResult(hkcs_query_acc, 2, fun_name,30)
}
else
if(!SQL_NumResults(hkcs_query_acc))
{
new Handle:query = SQL_PrepareQuery(hkcs_sql, "INSERT INTO `%s` (`steam_id`,`name_ip`) VALUES ('%s','%s');",hkcs_tab,steam_id,NetAddr);
SQL_Execute(query)
format(fun_name, 12, "%s",default_name)
}
}
SQL_FreeHandle(hkcs_sql)
}
public allchat(id)
{
if(!is_user_connected(id))
{
return PLUGIN_HANDLED
}
new system_msg
new all_msg
new name
get_user_name(id, name, 31)
read_args(all_msg, 200)
remove_quotes(all_msg)
replace_all(all_msg, 200, "%", "%")
format(all_msg, 200, " %s", all_msg) // 獲取SAY信息
new check_name
new send_msg,get_msg
format(get_msg, 200, "%s", all_msg) // 復制信息
strtok(get_msg,check_name,30,send_msg,170,' ') // 分離信息
if(containi(check_name,"/fun_name") != -1 && setting_funname)
{
if(!send_msg)
{
format(system_msg, 149, "%s^x04 稱號長度必須大於1字節", setting_plugin_name)
client_color(id, id, system_msg)
return PLUGIN_HANDLED
}
new fun_len = strlen(send_msg);
if(fun_len > 15)
{
format(system_msg, 149, "%s^x04 稱號長度必需小於5個中文字或15個英文字", setting_plugin_name)
client_color(id, id, system_msg)
return PLUGIN_HANDLED
}
format(fun_name, 30, "%s",send_msg)
format(system_msg, 149, "%s^x04 稱號變更為^x03 %s", setting_plugin_name,fun_name)
client_color(id, id, system_msg)
if(setting_sqlserver_open && setting_funname_save)
{
if(equal(steam_id,"VALVE_ID_LAN"))
{
new NetAddr
get_user_ip(id, NetAddr, 31, 1)
new Handle:hkcs_sql_connect = SQL_MakeDbTuple(hkcs_host,hkcs_user,hkcs_pass,hkcs_db)
new Handle:hkcs_sql = SQL_Connect(hkcs_sql_connect, errno, hkcs_error, 511)
new Handle:query = SQL_PrepareQuery(hkcs_sql, "UPDATE `%s` SET `name` = '%s' WHERE ( `name_ip` = '%s');",hkcs_tab,fun_name,NetAddr)
SQL_Execute(query)
SQL_FreeHandle(hkcs_sql)
}
else
{
new NetAddr
get_user_ip(id, NetAddr, 31, 1)
new Handle:hkcs_sql_connect = SQL_MakeDbTuple(hkcs_host,hkcs_user,hkcs_pass,hkcs_db)
new Handle:hkcs_sql = SQL_Connect(hkcs_sql_connect, errno, hkcs_error, 511)
new Handle:query = SQL_PrepareQuery(hkcs_sql, "UPDATE `%s` SET `name` = '%s',`name_ip` = '%s' WHERE ( `steam_id` = '%s');",hkcs_tab,fun_name,NetAddr,steam_id)
SQL_Execute(query)
SQL_FreeHandle(hkcs_sql)
}
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
页:
[1]