搜索
查看: 2094|回复: 3

简单的注册插件跟在游戏里面看ps3排名

[复制链接]
发表于 2008-5-20 03:37:08 | 显示全部楼层 |阅读模式 来自 中国–广东–汕尾–陆丰市
:burn: 做网吧苦啊.BOSS 要求那么高要像DCOO那样的可以看排名.还要注册的..
其实个人认为随便就好了.只要网吧有人打CS就好了
psrank3x.sma 在游戏里面可以显示你的ps3.x版本的stats 跟 玩家的信息 可以找战队 查找玩家ID成绩
[php]/*
* PSRank for http://www.psychostats.com/ - By: DynAstY
* (currently for Counter-Strike and Day of Defeat)
*
* SAY COMMANDS:
*
* - /ranks // shows all stats
*
* - /top10 // shows all stats
*
* - /topclan // shows clan page
*
* - /mystats // shows your player's stats (name must match in game)
*
* - /search [PLAYER NAME] // does a search with string entered as player name
*
*
* Set amx_psrank_url in amx.cfg to PsychoStats base web URL (trailing forward slash (/) needed)
* Example: amx_psrank_url "http://www.myclanweb.com/stats/"
*在游戏amx.cfg 添加一行 amx_psrank_url "http://你的ps3.x版本/stats/"
*
*
*/

#include <amxmodx>
public plugin_init() {
register_plugin("PSRank", "3.x", "From DynAstY - Edited by Kill4Free")
register_clcmd("say", "HandleSay", 0, "N/A")
register_cvar("amx_psrank_url", "http://你的ps3.x版本/stats")
register_cvar("amx_psrank_steamid", "0")
}
public client_putinserver(id) {
if (!is_user_bot(id)) {
new param[1]
param[0] = id
set_task(120.0, "showinfo", id, param, 1)
}
return PLUGIN_CONTINUE
}
public showinfo(param[]) {
client_print(param[0], print_chat, "[AMXX] Say Commands: /mystats, /ranks, /topclan and /search [playername]")
return PLUGIN_CONTINUE
}
public HandleSay(id) {
new sBaseURL[256]
get_cvar_string("amx_psrank_url",sBaseURL,255)
new args[256]
read_argv(1, args, 256)

// SAY /ranks or /top10
if(containi(args, "/ranks")!=-1 || containi(args, "/top10")!=-1) {
show_motd(id, sBaseURL, "")
return PLUGIN_HANDLED
}

// SAY /mystats
if(containi(args, "/mystats")!=-1) {
new gRankURL[256]
new search[33]
if (get_cvar_num("amx_psrank_steamid") == 0) {
get_user_name(id, search, 32)
} else {
get_user_authid(id, search, 32)
}
format(gRankURL, 255,"%sindex.php?submit=1&sort=skill&order=desc&search=%s", sBaseURL, search)
show_motd(id, gRankURL, "")
return PLUGIN_HANDLED
}

// if(containi(args, "/skill")!=-1) {


// return PLUGIN_HANDLED
// }
// SAY /search processing trailing argument
if(containi(args, "/search")!=-1) {
new t1[32]
new t2[32]
parse(args,t1,32,t2,32)
new gRankURL[256]
format(gRankURL, 255,"%sindex.php?submit=1&sort=skill&order=desc&search=%s", sBaseURL, t2)
show_motd(id, gRankURL, "")
return PLUGIN_HANDLED
}

//SAY /topclan
if (containi(args, "/topclan")!=-1) {
new gRankURL[256]
format(gRankURL, 255,"%sclans.php", sBaseURL)
show_motd(id, gRankURL, "")
return PLUGIN_HANDLED
}

return PLUGIN_CONTINUE
}
[/php]

userregister_system 一个注册插件 非常的狠..15秒内没有注册.或者没有输入正确密码直接把你T 了..很强大.. :super:

[php]#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "UserRegister System"
#define VERSION "1.0"
#define AUTHOR "Alka"
#define TASK_CHECK_LOG 2223
#define TASK_CHECK_REG 2132
#define PASSWORD_MIN_LEN 6
#define MAX_LOGIN_ATTEMPTS 3
#define STORE_REGISTER_DATE
new bool:user_is_registerd[33];
new user_saved_password[33][32];
new bool:user_has_loged[33];
new bool:user_has_registerd[33];
new bool:user_has_changed_pass[33];
new attempts[33];
new users_db_file[256];
public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR);

register_dictionary("userregister_system.txt");

register_concmd("amx_register", "register_user", ADMIN_ALL, "<mod:1[Name],2[Ip],3[SteamID]> <password>");
register_concmd("amx_login", "login_user", ADMIN_ALL, "<password>");
register_concmd("amx_changepassword", "change_password", ADMIN_ALL, "<old password> <new password>");

register_forward(FM_ClientUserInfoChanged, "Fwd_ClientInfoChanged");

check_db();
}
public check_db()
{
new datadir[64];
get_datadir(datadir, 63);

format(users_db_file, sizeof users_db_file - 1, "%s/users_db.ini", datadir);

new file_pointer = fopen(users_db_file, "r");

if(!file_pointer)
{
server_print("%L", LANG_SERVER, "ERROR_DB", users_db_file);

write_file(users_db_file, "");
}
fclose(file_pointer);
}
public client_putinserver(id)
{
new Steamid[32], Ip[32], Name[32];

get_user_authid(id, Steamid, 31);
get_user_ip(id, Ip, 31, 1);
get_user_name(id, Name, 31);

new parm[1];
parm[0] = id;

check_user(id, Steamid, Ip, Name);

set_task(3.0, "warn_user", id);

if(user_is_registerd[id])
set_task(13.0, "check_user_login", TASK_CHECK_LOG, parm, 1);

else
set_task(18.0, "check_user_reg", TASK_CHECK_REG, parm, 1);
}
public client_disconnect(id)
{
if(user_has_loged[id])
user_has_loged[id] = false;

if(user_has_registerd[id])
user_has_registerd[id] = false;

if(user_has_changed_pass[id])
user_has_changed_pass[id] = false;

attempts[id] = 0;
}
public warn_user(id)
{
if(user_is_registerd[id])
{
set_hudmessage(255, 0, 0, -1.0, -1.0, 1, 6.0, 5.0, 0.1, 0.1, -1);
show_hudmessage(id, "%L", LANG_PLAYER, "LOGIN_ADV_HUD");

client_print(id, print_chat, "%L", LANG_PLAYER, "LOGIN_ADV_CHAT");
}
else
{
set_hudmessage(255, 0, 0, -1.0, -1.0, 1, 6.0, 5.0, 0.1, 0.1, -1);
show_hudmessage(id, "%L", LANG_PLAYER, "REGISTER_ADV_HUD");

client_print(id, print_chat, "%L", LANG_PLAYER, "REGISTER_ADV_CHAT");
}
}
public register_user(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return 1;

new name[32], ip[32], steamid[32];

new arg_mod[4], arg_pass[32];
new Buffer[256], Buffer2[128];

read_argv(1, arg_mod, 3);
read_argv(2, arg_pass, 31);

new adate[128];
get_time("%x", adate, sizeof adate - 1);

new mod = str_to_num(arg_mod);

new len = strlen(arg_pass);

switch(mod)
{
case 1:
{
get_user_name(id, name, 31);

format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"^n", name, arg_pass);
#if defined STORE_REGISTER_DATE
format(Buffer2, sizeof Buffer2 - 1, ";Register date: %s^n^n", adate);
#endif
}

case 2:
{
get_user_ip(id, ip, 31, 1);

format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"^n", ip, arg_pass);
#if defined STORE_REGISTER_DATE
format(Buffer2, sizeof Buffer2 - 1, ";Register date: %s^n^n", adate);
#endif
}

case 3:
{
get_user_authid(id, steamid, 31);

format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"^n", steamid, arg_pass);
#if defined STORE_REGISTER_DATE
format(Buffer2, sizeof Buffer2 - 1, ";Register date: %s^n^n", adate);
#endif
}
}

if(cont_exists(users_db_file, name, ip, steamid))
{
client_print(id, print_console, "%L", LANG_PLAYER, "ACCOUNT_EXISTS");
return 1;
}
if(len < PASSWORD_MIN_LEN)
{
client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_LEN", PASSWORD_MIN_LEN);
return 1;
}

client_print(id, print_console, "%L", LANG_PLAYER, "REGISTER_OK", arg_pass);

user_has_registerd[id] = true;

new file = fopen(users_db_file, "at+");
fprintf(file, Buffer);
fprintf(file, Buffer2);
fclose(file);

return 1;
}
public login_user(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return 1;

if(user_has_loged[id])
{
client_print(id, print_console, "%L", LANG_PLAYER, "ALREADY_LOGEDIN");
return 1;
}

new arg_pass[32];
read_argv(1, arg_pass, 31);

if(!equali(arg_pass, user_saved_password[id]))
{
attempts[id] += 1;

if(attempts[id] >= MAX_LOGIN_ATTEMPTS)
{
server_cmd("kick #%i ^"Sorry you enterd a invalid password %d times in a row!^"", get_user_userid(id), MAX_LOGIN_ATTEMPTS);
return 1;
}

client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_INVALID", attempts[id], MAX_LOGIN_ATTEMPTS);
return 1;
}
else
{
client_print(id, print_console, "%L", LANG_PLAYER, "LOGIN_OK");

user_has_loged[id] = true;
}
return 1;
}
public change_password(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return 1;

if(user_has_changed_pass[id])
{
client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_WAIT_TIME");
return 1;
}

new arg_old_pass[32], arg_new_pass[32];
read_argv(1, arg_old_pass, 31);
read_argv(2, arg_new_pass, 31);

new name[32], ip[32], steamid[32];
get_user_name(id, name, 31);
get_user_ip(id, ip, 31, 1);
get_user_authid(id, steamid, 31);

new len = strlen(arg_new_pass);

if(!equali(arg_old_pass, user_saved_password[id]))
{
client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_NOMATCH");
return 1;
}

if(len < PASSWORD_MIN_LEN)
{
client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_LEN#2", PASSWORD_MIN_LEN);
return 1;
}

new file = fopen(users_db_file, "rt");

if(file)
{
new Buffer[128];
new counter;

while(!feof(file))
{
fgets(file, Buffer, 128);

parse(Buffer, Buffer, sizeof Buffer -1);

if(equal(Buffer, steamid) || equal(Buffer, ip) || equal(Buffer, name))
{
format(Buffer, sizeof Buffer - 1, "^"%s^" ^"%s^"", Buffer, arg_new_pass);

write_file(users_db_file, Buffer, counter);
}
counter++;
}
fclose(file);

client_print(id, print_console, "%L", LANG_PLAYER, "PASSWORD_NEW", arg_new_pass);

user_has_changed_pass[id] = true;
}
return 1;
}
public check_user_reg(parm[])
{
new id = parm[0];

if(!user_has_registerd[id])
{
server_cmd("kick #%i ^"You must to register to play in this server!^"", get_user_userid(id));
}
else
return 1;

return 0;
}
public check_user_login(parm[])
{
new id = parm[0];

if(!user_has_loged[id])
{
server_cmd("kick #%i ^"You must to login! Please retry...^"", get_user_userid(id));
}
else
return 1;

return 0;
}
stock check_user(id, steamid[], ip[], name[])
{
new szFile = fopen(users_db_file, "rt");

new Buffer[256], file_id[32], file_password[32];

while(!feof(szFile))
{
fgets(szFile, Buffer, 255);

if((strlen(Buffer) < 2) || Buffer[0] == ';')
continue;

parse(Buffer, file_id, 31, file_password, 31);

if(equal(file_id, steamid) || equal(file_id, ip) || equal(file_id, name))
{
user_is_registerd[id] = true;
user_saved_password[id] = file_password;

break;
}
}
fclose(szFile);
return 0;
}
stock bool:cont_exists(file[],name[], ip[], steamid[])
{
new file_pointer = fopen(file, "rt");

new Buffer[256];

while (!feof(file_pointer))
{
fgets(file_pointer, Buffer, 31);

if(containi(Buffer, name) != -1 || containi(Buffer, ip) != -1 || containi(Buffer, steamid) != -1)
{
fclose(file_pointer);
return true;
}
}
return false;
}
public Fwd_ClientInfoChanged(id, buffer)
{
if (!is_user_connected(id))
return FMRES_IGNORED;

static name[32], val[32];
get_user_name(id, name, sizeof name - 1)

engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val - 1);

if(equal(val, name))
return FMRES_IGNORED;

engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", name);

client_cmd(id, "name ^"%s^"; setinfo name ^"%s^"", name, name);

client_print(id, print_console, "%L", LANG_PLAYER, "NO_NAME_CHANGE");

return FMRES_SUPERCEDE;
}
[/php]
觉得有用处的就自己下吧..:boss: :boss: :boss: :boss:
高手们来汉化吧..

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2008-5-20 05:30:01 | 显示全部楼层 来自 中国–香港

回复: 简单的注册插件跟在游戏里面看ps3排名

有沒有不是讀網站而是直接讀sql的?..謝謝
回复

使用道具 举报

 楼主| 发表于 2008-5-20 11:40:52 | 显示全部楼层 来自 中国–广东–汕尾–陆丰市

回复: 简单的注册插件跟在游戏里面看ps3排名

读sql ?-。- 看排名的?
回复

使用道具 举报

发表于 2008-5-21 04:37:27 | 显示全部楼层 来自 中国–香港

回复: 简单的注册插件跟在游戏里面看ps3排名

直接從sql數據庫讀取已存的用戶資料
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表