Enosh123

ELogin2.0 by GTAItsMe (C) 2012

Jun 14th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.06 KB | None | 0 0
  1. #include <a_samp>
  2. #include dof2
  3. #include zcmd
  4. new str[256];
  5. #define logdiag 2010 // login dialog id
  6. #define regdiag 2011 // register dialog id
  7. #define cpassdiag 2012 // change password dialog id
  8. #define aldiag 2013 // Auto-Login dialog id
  9. #define infdiag 2014 // system information dialog id
  10. #define alldiag 2015 // "all-in-one" dialog id(all-in-one=change pass,info of player,info of system and auto login)
  11. #define newdiag 2016 // new password for change password
  12. #define WHITE "{FFFFFF}"
  13. #define RED "{F81414}"
  14. #define GREEN "{00FF22}"
  15. #define COLOR_GREEN 0x33AA33AA
  16. #define COLOR_BLUE 0x87CEEBFF
  17. new bool:login[MAX_PLAYERS];
  18. public OnFilterScriptInit()
  19. {
  20.     print("  --------------------------------------");
  21.     print("    ELogin v2.0 By TheKiller-GTAItsMe");
  22.     print("  --------------------------------------");
  23.     return 1;
  24. }
  25. public OnFilterScriptExit(){ DOF2_Exit(); return 1; }
  26.  
  27. public OnPlayerConnect(playerid)
  28. {
  29.     SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] that server using ELogin 2.0 SYSTEM that created by GTAItsMe/TheKiller/Enosh. Enjoy!");
  30.     if(DOF2_FileExists(pFile(playerid))){
  31.         if(DOF2_GetBool(pFile(playerid),"Auto Login")== true){
  32.             if(!strcmp(GetIp(playerid),DOF2_GetString(pFile(playerid),"IP"),false,16)){
  33.                 format(str,256,"[ELogin2.0] The player \"%s(%d)\" has been login to the game!",GetName(playerid),playerid);
  34.                 SendClientMessageToAll(COLOR_GREEN,str);
  35.                 login[playerid]=true;
  36.                 SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] You choose to use Auto-Login, welcome to the Server");
  37.             }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");
  38.         }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");
  39.     }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");
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerDisconnect(playerid, reason)
  44. {
  45.     if(DOF2_FileExists(pFile(playerid))){
  46.         DOF2_SaveFile();
  47.         login[playerid]=false;
  48.     }
  49.     return 1;
  50. }
  51. public OnPlayerRequestSpawn(playerid)
  52. {
  53.     if(login[playerid]==true)return 1;
  54.     return 0;
  55. }
  56. 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");
  57. CMD:changepass(playerid,params[])return ShowPlayerDialog(playerid,cpassdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r old password Below:","OK","Cancle");
  58. CMD:changepassword(playerid,params[])return cmd_changepass(playerid,params);
  59. CMD:autolog(playerid,params[])return ShowPlayerDialog(playerid,aldiag,DIALOG_STYLE_LIST,"ELogin2.0 - Auto Login","Switch On\r\nSwitch Off","OK","Cancle");
  60. CMD:autologin(playerid,params[])return cmd_autolog(playerid,params);
  61. 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","");
  62. CMD:systeminfo(playerid,params[])return cmd_sinfo(playerid,params);
  63. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  64. {
  65.     switch(dialogid)
  66.     {
  67.         case logdiag:
  68.         {
  69.             if(!response)return Kick(playerid);
  70.             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");
  71.             if(!strcmp(inputtext,DOF2_GetString(pFile(playerid),"Password"),false))
  72.             {
  73.                 login[playerid]=true;
  74.                 format(str,256,"[ELogin2.0] The player \"%s(%d)\" has been login to the game!",GetName(playerid),playerid);
  75.                 SendClientMessageToAll(COLOR_GREEN,str);
  76.                 SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you have been logged! use /elogin to see the Main Menu!");
  77.             }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");
  78.         }
  79.         case regdiag:
  80.         {
  81.             if(!response)return Kick(playerid);
  82.             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");
  83.             DOF2_CreateFile(pFile(playerid));
  84.             DOF2_SetString(pFile(playerid),"Password",inputtext);
  85.             DOF2_SetBool(pFile(playerid),"Auto Login",false);
  86.             DOF2_SetString(pFile(playerid),"IP",GetIp(playerid));
  87.             DOF2_SaveFile();
  88.             login[playerid]=true;
  89.             format(str,256,"[ELogin2.0] the player \"%s(%d)\" have been registered to the Server!",GetName(playerid),playerid);
  90.             SendClientMessage(playerid,COLOR_GREEN,str);
  91.             format(str,256,"[ELogin2.0] you have been registered with the password \"%s\". Enjoy the server!",inputtext);
  92.             SendClientMessage(playerid,COLOR_BLUE,str);
  93.             SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you have been logged! use /elogin to see the Main Menu!");
  94.         }
  95.         case alldiag:
  96.         {
  97.             if(!response)return 1;
  98.             switch(listitem)
  99.             {
  100.                 case 0: ShowPlayerDialog(playerid,cpassdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r old password Below:","OK","Cancle");
  101.                 case 1: ShowPlayerDialog(playerid,aldiag,DIALOG_STYLE_LIST,"ELogin2.0 - Auto Login","Switch On\r\nSwitch Off","OK","Cancle");
  102.                 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","");
  103.             }
  104.         }
  105.         case cpassdiag:
  106.         {
  107.             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");
  108.             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");
  109.         }
  110.         case aldiag:
  111.         {
  112.             switch(listitem)
  113.             {
  114.                 case 0:
  115.                 {
  116.                     if(DOF2_GetBool(pFile(playerid),"Auto Login") == true)return SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] the Auto-Login option already power");
  117.                     DOF2_SetBool(pFile(playerid),"Auto Login",true);
  118.                     DOF2_SaveFile();
  119.                     SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you choose to use the Auto-Login option that works by checking the IP!");
  120.                 }
  121.                 case 1:
  122.                 {
  123.                     if(DOF2_GetBool(pFile(playerid),"Auto Login") == false)return SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] the Auto-Login option already off!");
  124.                     DOF2_SetBool(pFile(playerid),"Auto Login",false);
  125.                     DOF2_SaveFile();
  126.                     SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] you choose to turn off the Auto-Login option!");
  127.                 }
  128.             }
  129.         }
  130.         case newdiag:
  131.         {
  132.             if(isnull(inputtext))return ShowPlayerDialog(playerid,newdiag,DIALOG_STYLE_PASSWORD,"ELogin2.0 - Change Password","Please Enter you'r new password below:","OK","Cancle");
  133.             DOF2_SetString(pFile(playerid),"Password",inputtext);
  134.             DOF2_SaveFile();
  135.             format(str,256,"[ELogin2.0] you are changed your password to \"{FFFFFF}%s{87CEFA}\"!",inputtext);
  136.             SendClientMessage(playerid,COLOR_BLUE,str);
  137.             SendClientMessage(playerid,COLOR_BLUE,"[ELogin2.0] please photo the screen to remember the new password with pressing on the button F8!");
  138.         }
  139.                    
  140.     }
  141.     return 1;
  142. }
  143. stock pFile(playerid)
  144. {
  145.     format(str,256,"ELogin2.0/%s.ini",GetName(playerid));
  146.     return str;
  147. }
  148. stock GetName(playerid)
  149. {
  150.     new name[24];
  151.     GetPlayerName(playerid,name,24);
  152.     return name;
  153. }
  154. stock GetIp(playerid)
  155. {
  156.     new ip[16];
  157.     GetPlayerIp(playerid,ip,16);
  158.     return ip;
  159. }
Advertisement
Add Comment
Please, Sign In to add comment