|
发表于 2008-1-14 15:04:40
|
显示全部楼层
来自 中国–广东–东莞
回复: 【发布】ASP+MySQL论坛注册排行【071210修正】
Post by joes
//#include <amxmisc>
#include <amxmodx>
#include <csstats>
#include <dbi>
//#include <string>
我所用的amxx 1.76下,需要注释掉//#include <string>,//#include <amxmisc>
这两个才能编译,否则就会提示内部错误,我也不知何解,试过 Xp, win2003系统下也是如此,不过注释掉上面的语句后,稍改了一些地方,目前还是个性签名方面和注册等还是可以正常使用,
暂时...
你下载1.76D来编译,我是在1.76D下编译成功的。
你所说的加上进服提示我已经修改了,而且我没有和论坛整合,我是直接把字段添加到admins表的。改写了一个简单的注册页面,添加了几个字段,比如QQ信息。
我现在想在换图时候把玩家的IP信息写进数据库,可惜一直没成功。
附上我修改的部分
- public check(idx[])
- {
- new id = idx[0]
- new username[32]
- new userpwd[32]
- new passfield[32]
- new IP[16], addr[64];
- get_user_ip( id, IP, 15, 1);
- ipseeker( IP, ipseek_all, addr, 39, 63);
- new izStats[8], izBody[8];
- new iRankPos;
- iRankPos = get_user_stats( id, izStats, izBody);
-
- get_pcvar_string(amx_password_field, passfield, 31)
-
- get_user_info(id,"name",username,31)
- get_user_info(id,passfield,userpwd,31)
-
- replace_all(username,31,"[","[")
- replace_all(username,31,"]","]")
- replace_all(username,31,"<","<")
- replace_all(username,31,">",">")
-
- new g_sqlpwd[12]
- new g_Signature[64]
- new g_realname[32]
- new g_qq[10]
- g_dbc = dbi_connect(g_host,g_user,g_pass,g_dbname,g_error,MAX_NAME_LENGTH)
- if (g_dbc == SQL_FAILED)
- log_amx("[RegSqlRank] SQL Connection Failed")
- else
- {
- result = dbi_query(g_dbc,"set names utf8;")
- result = dbi_query(g_dbc,"select * from `%s` where auth = '%s'", g_sqlstats_table, username)
- if (result == RESULT_FAILED)
- {
- log_amx("[RegSqlRank] Sorry,No DataBase or Table")
- }
- else if(result == RESULT_NONE)
- {
- new szMessage[512];
- format( szMessage, 511, "^x01欢迎:^x03%s (未注册账号) ^x01地址:^x04%s ^x01来自:^x03%s ",username, IP, addr);
- display_chat( szMessage);
- client_print(id,print_chat,"您可以在主页注册此当前ID,然后登陆CS以保留成绩!")
- }
- else
- {
- dbi_result(result, "Password", g_sqlpwd, 31)
- dbi_result(result, "Real_name",g_realname,31)
- dbi_result(result, "Signature",g_Signature,63)
- dbi_result(result, "qq",g_qq,10)
- dbi_free_result(result)
- dbi_close(g_dbc)
- if (equal(g_sqlpwd,userpwd) && strlen(userpwd)>0)
- {
- replace_all(username,31,"[","[")
- replace_all(username,31,"]","]")
- replace_all(username,31,"<","<")
- replace_all(username,31,">",">")
-
- replace_all(g_Signature,31,"[","[")
- replace_all(g_Signature,31,"]","]")
- replace_all(g_Signature,31,"<","<")
- replace_all(g_Signature,31,">",">")
-
- //client_print(0,print_chat,"欢迎【VIP】%s -->>【昵称:】%s -->>【排名:】%s -->>【地址:】%s -->>【来自:】%s ,",username,g_realname,iRankPos,IP,addr)
- //client_print(0,print_chat,"【个性签名:】%s",g_Signature)
- new szMessage[512];
- format( szMessage, 511, "^x01欢迎 VIP:^x03%s ^x01昵称:^x04%s ^x01地址:^x04%s ^x01来自:^x03%s ^x01排名:^x04%d ",username, g_realname, IP, addr, iRankPos);
- display_chat( szMessage);
- format( szMessage, 511, "^x01QQ号码:^x04%s ^x01个性签名:^x04%s",g_qq,g_Signature);
- display_chat( szMessage);
- }
- else
- {
- new userid = get_user_userid( id)
- server_cmd( "kick #%d ^"对不起,该帐号需密码,输入密码或改名后重新进入!^"", userid)
- }
- }
- }
- return PLUGIN_CONTINUE
- }
复制代码 |
|