Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include dof2
- #include zcmd
- new str[256];
- #define logdiag 2010 // login dialog id
- #define regdiag 2011 // register dialog id
- #define cpassdiag 2012 // change password dialog id
- #define aldiag 2013 // Auto-Login dialog id
- #define infdiag 2014 // system information dialog id
- #define alldiag 2015 // "all-in-one" dialog id(all-in-one=change pass,info of player,info of system and auto login)
- #define newdiag 2016 // new password for change password
- #define WHITE "{FFFFFF}"
- #define RED "{F81414}"
- #define GREEN "{00FF22}"
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_BLUE 0x87CEEBFF
- new bool:login[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print(" --------------------------------------");
- print(" ELogin v2.0 By TheKiller-GTAItsMe");
- print(" --------------------------------------");
- return 1;
- }
- public OnFilterScriptExit(){ DOF2_Exit(); return 1; }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] that server using ELogin 2.0 SYSTEM that created by GTAItsMe/TheKiller/Enosh. Enjoy!");
- if(DOF2_FileExists(pFile(playerid))){
- if(DOF2_GetBool(pFile(playerid),"Auto Login")== true){
- if(!strcmp(GetIp(playerid),DOF2_GetString(pFile(playerid),"IP"),false,16)){
- format(str,256,"[ELogin2.0] The player \"%s(%d)\" has been login to the game!",GetName(playerid),playerid);
- SendClientMessageToAll(COLOR_GREEN,str);
- login[playerid]=true;
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] You choose to use Auto-Login, welcome to the Server");
- }else return ShowPlayerDialog(playerid,logdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - login",""WHITE"Welcome to the Server!\r\n"GREEN"To Login"WHITE", type your password below","Login","Quit");
- }else return ShowPlayerDialog(playerid,logdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - login",""WHITE"Welcome to the Server!\r\n"GREEN"To Login"WHITE", type your password below","Login","Quit");
- }else return ShowPlayerDialog(playerid,regdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - Register",""WHITE"Welcome to the Server!\r\n"GREEN"To register"WHITE", type a password below","Register","Quit");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(DOF2_FileExists(pFile(playerid))){
- DOF2_SaveFile();
- login[playerid]=false;
- }
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- if(login[playerid]==true)return 1;
- return 0;
- }
- CMD:elogin(playerid,params[])return ShowPlayerDialog(playerid,alldiag,DIALOG_STYLE_LIST,"ELogin2.0 - Main Menu","Change Password - /changepass(word)\r\nAuto Login switch - /autolog(in)\r\nSystem Info - /s(ystem)info","OK","Cancle");
- CMD:changepass(playerid,params[])return ShowPlayerDialog(playerid,cpassdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r old password Below:","OK","Cancle");
- CMD:changepassword(playerid,params[])return cmd_changepass(playerid,params);
- CMD:autolog(playerid,params[])return ShowPlayerDialog(playerid,aldiag,DIALOG_STYLE_LIST,"ELogin2.0 - Auto Login","Switch On\r\nSwitch Off","OK","Cancle");
- CMD:autologin(playerid,params[])return cmd_autolog(playerid,params);
- CMD:sinfo(playerid,params[])return ShowPlayerDialog(playerid,infdiag,DIALOG_STYLE_MSGBOX,"ELogin2.0 - System Info",""GREEN"ELogin System\r\n"WHITE"Version:"GREEN" 2.0\r\n"WHITE"Creator:"GREEN" GTAItsMe","OK","");
- CMD:systeminfo(playerid,params[])return cmd_sinfo(playerid,params);
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case logdiag:
- {
- if(!response)return Kick(playerid);
- if(isnull(inputtext))return ShowPlayerDialog(playerid,logdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - login",""WHITE"Welcome to the Server!\r\n"GREEN"To Login"WHITE", type your password below","Login","Quit");
- if(!strcmp(inputtext,DOF2_GetString(pFile(playerid),"Password"),false))
- {
- login[playerid]=true;
- format(str,256,"[ELogin2.0] The player \"%s(%d)\" has been login to the game!",GetName(playerid),playerid);
- SendClientMessageToAll(COLOR_GREEN,str);
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you have been logged! use /elogin to see the Main Menu!");
- }else return ShowPlayerDialog(playerid,logdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - login",""RED"you entered a wrong password!\r\n"GREEN"Try to Login again"WHITE", type your password below","Login","Quit");
- }
- case regdiag:
- {
- if(!response)return Kick(playerid);
- if(isnull(inputtext))return ShowPlayerDialog(playerid,regdiag,DIALOG_STYLE_PASSWORD,"ELogin 2.0 - Register",""WHITE"Welcome to the Server!\r\n"GREEN"To register"WHITE", type a password below","Register","Quit");
- DOF2_CreateFile(pFile(playerid));
- DOF2_SetString(pFile(playerid),"Password",inputtext);
- DOF2_SetBool(pFile(playerid),"Auto Login",false);
- DOF2_SetString(pFile(playerid),"IP",GetIp(playerid));
- DOF2_SaveFile();
- login[playerid]=true;
- format(str,256,"[ELogin2.0] the player \"%s(%d)\" have been registered to the Server!",GetName(playerid),playerid);
- SendClientMessage(playerid,COLOR_GREEN,str);
- format(str,256,"[ELogin2.0] you have been registered with the password \"%s\". Enjoy the server!",inputtext);
- SendClientMessage(playerid,COLOR_BLUE,str);
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you have been logged! use /elogin to see the Main Menu!");
- }
- case alldiag:
- {
- if(!response)return 1;
- switch(listitem)
- {
- case 0: ShowPlayerDialog(playerid,cpassdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r old password Below:","OK","Cancle");
- case 1: ShowPlayerDialog(playerid,aldiag,DIALOG_STYLE_LIST,"ELogin2.0 - Auto Login","Switch On\r\nSwitch Off","OK","Cancle");
- case 2: ShowPlayerDialog(playerid,infdiag,DIALOG_STYLE_MSGBOX,"ELogin2.0 - System Info",""GREEN"ELogin System\r\nVersion:"GREEN"2.0\r\nCreator:"GREEN"GTAItsMe - TheKiller - Enosh","OK","");
- }
- }
- case cpassdiag:
- {
- if(!strcmp(inputtext,DOF2_GetString(pFile(playerid),"Password"),false))return ShowPlayerDialog(playerid,newdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r new password below:","OK","Cancle");
- ShowPlayerDialog(playerid,cpassdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r old password "RED"Again - you Entered worng password"WHITE" Below:","OK","Cancle");
- }
- case aldiag:
- {
- switch(listitem)
- {
- case 0:
- {
- if(DOF2_GetBool(pFile(playerid),"Auto Login") == true)return SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] the Auto-Login option already power");
- DOF2_SetBool(pFile(playerid),"Auto Login",true);
- DOF2_SaveFile();
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you choose to use the Auto-Login option that works by checking the IP!");
- }
- case 1:
- {
- if(DOF2_GetBool(pFile(playerid),"Auto Login") == false)return SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] the Auto-Login option already off!");
- DOF2_SetBool(pFile(playerid),"Auto Login",false);
- DOF2_SaveFile();
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you choose to turn off the Auto-Login option!");
- }
- }
- }
- case newdiag:
- {
- if(isnull(inputtext))return ShowPlayerDialog(playerid,newdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r new password below:","OK","Cancle");
- DOF2_SetString(pFile(playerid),"Password",inputtext);
- DOF2_SaveFile();
- format(str,256,"[ELogin2.0] you are changed your password to \"{FFFFFF}%s{87CEFA}\"!",inputtext);
- SendClientMessage(playerid,COLOR_BLUE,str);
- SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] please photo the screen to remember the new password with pressing on the button F8!");
- }
- }
- return 1;
- }
- stock pFile(playerid)
- {
- format(str,256,"ELogin2.0/%s.ini",GetName(playerid));
- return str;
- }
- stock GetName(playerid)
- {
- new name[24];
- GetPlayerName(playerid,name,24);
- return name;
- }
- stock GetIp(playerid)
- {
- new ip[16];
- GetPlayerIp(playerid,ip,16);
- return ip;
- }
Advertisement
Add Comment
Please, Sign In to add comment