Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
Plugin inchide serverul
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Resources
Author
Message
988
rapp
[Mentally Stable]
Status: Offline
(since 24-01-2013 20:45)
Joined: 05 Nov 2009
Posts: 71
,
Topics: 18
Location:
Targoviste
Reputation:
231.6
Votes
: 7
Posted: 07-09-2011, 19:20:37
| Translate post to:
... (
Click for more languages
)
Seara buna la toti,am luat un plugin,nameregister,dar de cate ori am incercat sal fac tot nam reusit,deci am nevoie de ajutor:uitati sma nemodificat:
Code:
/* Plugin generated by AMXX-Studio */
/*
* This Plugin Was Created By Scriptxxcaz
*
* Credits
* -------
* Special Thanks to Allied Modders Forums for helpful and useful information.
*
*
* This plugin was created to do the following:
* -------------------------------------------
* Prevent stolen accounts from being used in servers. [Request in the Allied Modders Forums]
*---------------------------------------------------------------------------------------------------
*---------------------------------------------------------------------------------------------------
*
* Description:
* When a player enter's the server he/she must register within a certain
* amount of minutes or he/she will be kicked. A menu will pop-up asking
* to confirm password or re-type a new password. If confirmed, the
* players name,id, and password will be stored in a file. If the player
* chooses to re-type the password, he/she will be asked to re-register.
* If he/she re-registers, he/she will have to register within a certain amount of minutes
* and login within a certain amount of minutes or be kicked. If the
* player is already registered he/she must login within a certain
* amount of minutes or he/she will be kicked. The amount of minutes can
* be changed as desired. If a player has forgotten his/her password, he/she
* can ask an admin to reset their password if amx_resetacc = 1. If amx_resetacc = 2,
* the player can reset his,her password themselves. This is done by the amx_resetpass <name>
* command. This command over writes that players password as "default" and the
* player is asked to re-register. He/she must re-register and login within a certain
* amount of minutes or be kicked. If kicked or disconnect before re-registering,
* when they re-enter they will be asked to register. A userlist can
* be obtained to show player's steam id's that are in the server.If file doesn't exist
* the file will be created when the plugin is first ran.
*
*---------------------------------------------------------------------------------------------------
*Command's
*---------
* say /register -registers a user. writes name,id, and password to file.
* say /login -logs a user in. if password is same as one in file player is logged in.
* say /userlist -shows player id;s of the player in the server
*
*---------------------------------------------------------------------------------------------------
*Console Command's
*-----------------
*rg_resetpass -resets a players password(player must be in server). Writes "default" as their pass in the file.
* If the player disconnects before re-registering when they reconnect they will be asked to register.
*rg_useracc -sets the access to admin only or all players. This is used for setting the access on userlist(Admin only)
* Uses mp_useracc CVAR
*rg_resetacc -sets the access to admin only or all players. This is used for setting the access on amx_resetpass(Admin only)
* Uses mp_reseracc CVAR
* **Note access to these commands are use with #define ADMIN. This can be changed to any admin level of your choice.**
*---------------------------------------------------------------------------------------------------
*CVAR's
*------
*mp_useracc -1 = admins only / 2 = all players
*mp_resetacc -1 = admins only / 2 = all players
*mp_logmin -sets the time that players have to login or they will be kicked
*mp_regmin -sets the time that players have to register of they will be kicked
*---------------------------------------------------------------------------------------------------
* version 1.0.1
* ----------
*
*Fixed login time and register time. -The set_task's are now used with a cvar.
*Fixed chat. -[Registration] is green and rest in yellow
*
*
*/
#include <amxmodx>
#include <amxmisc>
#define ADMIN ADMIN_KICK
#define MAX_ATTEMPTS 3
#define DEFAULT_PASS "default"
#define PLUGIN "Registration"
#define VERSION "1.0"
#define AUTHOR "scriptxxcaz"
static const GREEN[] = "^x04"
static const YELLOW[] = "^x01"
new bool:registered[32],bool:logged_in[32]
new reg_file[72]
new pass[32][32]
new attempt[32] = 0
new g_useracc,g_resetacc,g_regmin,g_logmin
new gameSayText
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "TeamInfo", "load_player_info", "a")
register_clcmd("say","g_say")
register_concmd("rg_resetpass","reset_pass",ADMIN,"<Name of user>")
register_concmd("rg_useracc","user_access",ADMIN," -<1 = admin access only | 2 = all player access")
register_concmd("rg_resetacc","reset_access",ADMIN," -<1 = admin access only | 2 = all player access")
g_useracc = register_cvar("mp_useracc","1")
g_resetacc = register_cvar("mp_resetacc","1")
g_regmin = register_cvar("mp_regmin","25")
g_logmin = register_cvar("mp_logmin","8")
gameSayText = get_user_msgid("SayText")
get_configsdir(reg_file,71)
format(reg_file,71,"%s/reglist.ini",reg_file)
if(!file_exists(reg_file))
{
write_file(reg_file,"^"Registration File^" ^"Please Do Not Modify^" ^"Modifing This File Manualy May Cause Errors^"")
}
}
public load_player_info(id)
{
new g_text[256],message[112]
new Float:regtime = get_pcvar_float(g_regmin)
new Float:logtime = get_pcvar_float(g_logmin)
new len = format(message,111,"%s[Registration]",GREEN)
new p_name[32],p_id[32],p_pass[32]
new name[32],authid[32]
get_user_name(id,name,31)
get_user_authid(id,authid,31)
new pFile = fopen(reg_file,"rt+");
if(pFile)
{
while(fgets(pFile,g_text,255))
{
parse(g_text,p_name,31,p_id,31,p_pass,31)
if(equal(p_id,authid) && !equal(p_pass,DEFAULT_PASS))
{
registered[id] = true
copy(pass[id],31,p_pass)
format(message[len],111,"%s Please type /login password to login or be kicked in %d seconds.",YELLOW,g_logmin)
set_task(logtime,"check_player",id)
}
else
{
registered[id] = false
format(message[len],111,"%s Please type /register password to register or be kicked in %d seconds",YELLOW,g_regmin)
set_task(regtime,"check_player",id)
}
}
}
fclose(pFile);
print_message(id,message)
return PLUGIN_HANDLED
}
public check_player(id) {
if(registered[id] || logged_in[id]) return PLUGIN_HANDLED
kick_player(id)
return PLUGIN_CONTINUE
}
public g_say(id) {
new arg[32]
read_argv(id,arg,31)
new message[112]
new len = format(message,111,"%s[Registration]",GREEN)
if(contain(arg,"/register ") != -1)
{
if(!registered[id])
{
remove_quotes(arg)
format(pass[id],31,"%s",arg[10])
get_player_confirm(id)
return PLUGIN_HANDLED
}
}
if(contain(arg,"/login ") != -1)
{
if(registered[id] && !logged_in[id])
{
remove_quotes(arg)
format(arg,31,"%s",arg[7])
if(!equal(pass[id],arg) && attempt[id] < MAX_ATTEMPTS)
{
format(message[len],111,"%s Incorrect password.",YELLOW)
attempt[id]++
logged_in[id] = false
}
if(!equal(pass[id],arg) && attempt[id] == MAX_ATTEMPTS)
{
format(message[len],111,"%s Incorrect password. You will now be kicked for entering incorrect password %d times.",YELLOW,MAX_ATTEMPTS)
client_cmd(id,"echo Invalid password. You were kicked for entering the wrong password %d times.",MAX_ATTEMPTS)
kick_player(id)
logged_in[id] = false
}
if(equal(pass[id],arg) && attempt[id] < MAX_ATTEMPTS)
{
format(message[len],111,"%s You are now logged in.",YELLOW)
attempt[id] = 0
logged_in[id] = true
}
print_message(id,message)
return PLUGIN_HANDLED
}
if(!registered[id])
{
format(message[len],111,"%s You must register before you can login.",YELLOW)
print_message(id,message)
return PLUGIN_HANDLED
}
if(logged_in[id])
{
format(message[len],111,"%s You are already logged in.",YELLOW)
print_message(id,message)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
if(contain(arg,"/userlist") != -1)
{
if(get_pcvar_num(g_useracc) == 1 && !is_user_admin(id))
{
format(message[len],111,"%s You do not have access to that command.",YELLOW)
print_message(id,message)
return PLUGIN_HANDLED
}
new menu = menu_create("Player Id's","menuhandle")
new players[32],num
get_players(players,num)
for(new player_id = 0;player_id<num;player_id++)
{
new mess[32],authid[32],name[32]
get_user_authid(players[player_id],authid,31)
get_user_name(players[player_id],name,31)
format(mess,31,"%s -- [%s]",authid,name)
menu_additem(menu,message)
}
menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu,0)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public reset_pass(id) {
new message[112]
new lenmes = format(message,111,"%s[Registration]",GREEN)
if(get_pcvar_num(g_resetacc) == 1 && !is_user_admin(id))
{
format(message[lenmes],111,"%s You do not have access to that command.",YELLOW)
print_message(id,message)
return PLUGIN_HANDLED
}
new con_name[31]
read_argv(1,con_name,31)
new player = cmd_target(id, con_name)
if(!player)
{
console_print(id,"Please specify user: amx_resetpass <name>")
return PLUGIN_HANDLED
}
new authid[32],g_name[32]
get_user_authid(player,authid,31)
get_user_name(player,g_name,31)
registered[id] = false
new p_name[32],p_auth[32],p_pass[32]
new text[512], line, len, msg[256]
while (read_file(reg_file, line++, text, 511, len) )
{
parse(text,p_name,31,p_auth,31,p_pass,31)
if(equal(p_auth,authid))
{
format(msg,255,"^"%s^" ^"%s^" ^"%s^"",g_name,authid,DEFAULT_PASS)
copy(pass[id],31,DEFAULT_PASS)
replace(text, 511, text, msg)
write_file(reg_file, text, line - 1)
if(registered[player])
{
registered[player] = false
}
if(logged_in[player])
{
logged_in[player] = false
}
format(message[lenmes],111,"%s You must now re-register. Type /register password to re-register.",YELLOW)
print_message(player,message)
}
else
{
format(message[lenmes],111,"%s Player not found.",YELLOW)
print_message(id,message)
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}
public get_player_confirm(id) {
new title[32]
format(title,31,"Confirm Password: %s",pass[id])
new menu2 = menu_create(title,"menu_handle_confirm")
menu_additem(menu2,"Confirm","1")
menu_additem(menu2,"Re-type","2")
menu_setprop(menu2,MPROP_EXIT,MEXIT_ALL)
menu_display(id,menu2,0)
return PLUGIN_HANDLED
}
public menu_handle_confirm(id,menu2,item) {
if(item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
new message[112]
new lenmes = format(message,111,"%s[Registration]",GREEN)
new name[32],auth[32]
get_user_authid(id,auth,31)
get_user_name(id,name,31)
new data[6],iName[64]
new access,callback
menu_item_getinfo(menu2,item,access,data,5,iName,63,callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
remove_task(id)
new Float:logtime = get_pcvar_float(g_logmin)
new text[512], line, len, msg[112]
while (read_file(reg_file, line++, text, 511, len) )
{
if(!registered[id] && contain(text,auth) != -1)
{
registered[id] = true
format(msg,111,"^"%s^" ^"%s^" ^"%s^"",name,auth,pass[id])
replace(text, 511, text, msg)
write_file(reg_file, text, line - 1)
console_print(id,"****[Registration] Your password is %s****",pass[id])
menu_destroy(menu2)
set_task(logtime,"check_player",id)
format(message[lenmes],111,"%s Please type /login password to login or be kicked in %d seconds.",YELLOW,logtime)
print_message(id,message)
return PLUGIN_HANDLED
}
}
registered[id] = true
console_print(id,"****[Registration] Your password is %s****",pass[id])
new writedata[128]
formatex(writedata,127,"^"%s^" ^"%s^" ^"%s^"",name,auth,pass[id]);
write_file(reg_file,writedata)
menu_destroy(menu2)
set_task(logtime,"check_player",id)
format(message[lenmes],111,"%s Please type /login password to login or be kicked in %d seconds.",YELLOW,logtime)
print_message(id,message)
return PLUGIN_HANDLED
}
case 2:
{
remove_task(id)
registered[id] = false
pass[id] = DEFAULT_PASS
format(message[lenmes],111,"%s Please re-type /register password.",YELLOW)
print_message(id,message)
menu_destroy(menu2)
new Float:regtime = get_pcvar_float(g_regmin)
set_task(regtime,"check_player",id)
return PLUGIN_HANDLED
}
}
menu_destroy(menu2)
return PLUGIN_HANDLED
}
public menuhandle(id,menu,item) {
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public user_access(id) {
new arg[2]
read_argv(1,arg,1)
new cvar = str_to_num(arg)
switch(cvar)
{
case 0: console_print(id,"cv_resetacc <1 = admin access only | 2 = all player access")
case 1: {
set_pcvar_num(g_useracc,cvar)
console_print(id,"****[Registration] Only admins have access to the user list.")
}
case 2: {
set_pcvar_num(g_useracc,cvar)
console_print(id,"****[Registration] All players now have access to the user list.")
}
}
return PLUGIN_HANDLED
}
public reset_access(id) {
new arg[2]
read_argv(1,arg,1)
new cvar = str_to_num(arg)
switch(cvar)
{
case 0: console_print(id,"cv_resetacc <1 = admin access only | 2 = all player access")
case 1: {
set_pcvar_num(g_resetacc,cvar)
console_print(id,"****[Registration] Only admins now have access to reset passwords.")
}
case 2: {
set_pcvar_num(g_resetacc,cvar)
console_print(id,"****[Registration] All players now have access to reset their own passwords.")
}
}
return PLUGIN_HANDLED
}
public client_disconnect(id) {
registered[id] = false
logged_in[id] = false
attempt[id] = 0
format(pass[id],31,"")
remove_task(id)
}
public kick_player(id) {
if(!registered[id])
{
client_cmd(id,"echo ****You did not register within %d seconds.****",g_regmin)
}
else if(!logged_in[id])
{
client_cmd(id,"echo ****You did not login within %d seconds.****",g_logmin)
}
client_cmd(id,"disconnect")
return PLUGIN_HANDLED
}
print_message(id, mesg[]) {
message_begin(MSG_ONE, gameSayText, {0,0,0}, id)
write_byte(id)
write_string(mesg)
message_end()
}
Cat am modificat in el tot nam reusit,va raman indatorat daca ma puteti ajuta,vreau sal folosesc la modul zombie plague advance+zombie xp
MS
0
0
Back to top
NoMad
[cel_din_$_scaun]
Status: Offline
(since 27-08-2014 09:27)
Joined: 15 Jul 2011
Posts: 1097
,
Topics: 26
Location:
Timisoara
Reputation:
78.6
Votes
: 5
Posted: 07-09-2011, 19:54:03
| Translate post to:
... (
Click for more languages
)
ce vrei sa modifici la el mai exact ?
0
0
Back to top
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Resources
The time now is 02-03-2025, 09:14:50
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details