JonathanFeitosa

System Login/Register with recovery password via email at do

Dec 13th, 2012
2,830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.75 KB | None | 0 0
  1. /*
  2.  
  3. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PROJECT JFS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  4. PROJECT 'JFS'.
  5. SYSTEM LOGIN/REGISTER WITH RECOVERY PASSWORD VIA EMAIL AT DOF2 !!!!
  6.  
  7.  
  8.  
  9. Skype: jonathanfeitosajfs
  10.  
  11. Create By: JONATHAN FEITOSA
  12. DATE: 12/12/2012 *0*
  13. */
  14.  
  15.  
  16. #include                                                                <a_samp>
  17. #include                                                                  <dof2>
  18. #include                                                                <a_http>
  19. #define                          MAILER_URL "geradoresjfs.site90.net/mailer.php" // Archive. Php> upe your <!
  20. #include                                                                <mailer>
  21.  
  22. #define CONTAS            \
  23.                             "PlayersJFS/%s.ini"
  24. #define REGISTRO          \
  25.                             (787)
  26. #define LOGIN             \
  27.                             (790)
  28. #define MAXPLAYERSJFS     \
  29.                             (50) // Server Slots
  30. #define DinheiroInicio    \
  31.                             (1000) // Begins with MIL Grana
  32. #define LevelInicio       \
  33.                             (1) // Starts with Level 1
  34. #define EmailServidor     \
  35.                             ("[email protected]") //Your Email Addres
  36. #define NomeServidor      \
  37.                             ("[JFS/SAMP] - Recuperar Senha") // Configure :)
  38. #define TAtualizarLevel   \
  39.                             (4000) // Time to Upgrade Level, 4 man!
  40. new
  41.     Invalido[MAXPLAYERSJFS],
  42.     Nome[MAX_PLAYER_NAME],
  43.     String[128]
  44. ;
  45.  
  46. new
  47.     Matou[MAXPLAYERSJFS],
  48.     Morreu[MAXPLAYERSJFS],
  49.     Level[MAXPLAYERSJFS],
  50.     Logou[MAXPLAYERSJFS]
  51. ;
  52.  
  53. public OnFilterScriptInit()
  54. {
  55.     SetTimer("AtualizarLevel", TAtualizarLevel, true);
  56.     return true;
  57. }
  58.  
  59. public OnFilterScriptExit()
  60. {
  61.     for(new i=0; i<MAXPLAYERSJFS; ++i)
  62.     {
  63.         CarregarPlayer(i);
  64.     }
  65.     DOF2_Exit();
  66.     return true;
  67. }
  68.  
  69. public OnPlayerDeath(playerid, killerid, reason)
  70. {
  71.     if(IsPlayerConnected(killerid))
  72.     {
  73.         Matou[killerid]++;
  74.         Level[killerid] ++;
  75.         GameTextForPlayer(killerid,"~>~~r~Killed + 1 Level.!!!",4000,3);
  76.     }
  77.     if(IsPlayerConnected(playerid))
  78.     {
  79.         GameTextForPlayer(playerid,"~>~~r~Dead - Level 1!!!",4000,3);
  80.         Level[playerid] --;
  81.     }
  82.     return true;
  83. }
  84. public OnPlayerDisconnect(playerid, reason)
  85. {
  86.     SalvarPlayer(playerid);
  87.     return true;
  88. }
  89.  
  90. public OnPlayerCommandText(playerid, cmdtext[])
  91. {
  92.     if(strfind(cmdtext, "/stats", true) != -1)
  93.     {
  94.         new DialogStatus[250];
  95.         new EmailStats[40];
  96.         GetPlayerName(playerid, Nome, sizeof(Nome));
  97.         format(EmailStats, sizeof(EmailStats), CONTAS, Nome);
  98.         format(String, sizeof(String),"{FFFFFF}In Status {1E90FF}%s\n\n",Nome);
  99.         strcat(DialogStatus, String);
  100.         format(String, sizeof(String),"{FFFFFF}Email: {1E90FF}%s\n", DOF2_GetString(EmailStats,"Email"));
  101.         strcat(DialogStatus, String);
  102.         format(String, sizeof(String),"{FFFFFF}Level: {1E90FF}%d\n", Level[playerid]);
  103.         strcat(DialogStatus, String);
  104.         format(String, sizeof(String),"{FFFFFF}Money: {1E90FF}%d\n", GetPlayerMoney(playerid));
  105.         strcat(DialogStatus, String);
  106.         format(String, sizeof(String),"{FFFFFF}Kills: {1E90FF}%d\n", Matou[playerid]);
  107.         strcat(DialogStatus, String);
  108.         format(String, sizeof(String),"{FFFFFF}Death: {1E90FF}%d\n",Morreu[playerid]);
  109.         strcat(DialogStatus, String);
  110.         format(String, sizeof(String),"{FFFFFF}You've Logout {1E90FF}%d{FFFFFF} In times Server", Logou[playerid]);
  111.         strcat(DialogStatus, String);
  112.         ShowPlayerDialog(playerid, 5732, DIALOG_STYLE_MSGBOX, "{00F6F6}My Info( RG )", DialogStatus, "Close", "");
  113.         return true;
  114.     }
  115.     if(strfind(cmdtext, "/mudaremail", true) != -1)
  116.     {
  117.         if(strlen(cmdtext) == 11)
  118.             return SendClientMessage(playerid, -1, "/mudaremail [EMAIL]");
  119.         strdel(cmdtext, 0, 11);
  120.            
  121.         GetPlayerName(playerid, Nome, sizeof(Nome));
  122.         format(String, sizeof(String), CONTAS, Nome);
  123.         new Celula[128];
  124.  
  125.         format(Celula, sizeof(Celula),"JFS Registration System] - You Changed Your Email from %s to %s !!", DOF2_GetString(String,"Email"), cmdtext);
  126.         SendClientMessage(playerid, -1, Celula);
  127.         SendClientMessage(playerid, -1, "Caution! you should check if it's right! you may lose your Account.");
  128.  
  129.         DOF2_SetString(String,"Email", cmdtext);
  130.         DOF2_SaveFile();
  131.         return true;
  132.     }
  133.     return false;
  134. }
  135.  
  136. public OnPlayerConnect(playerid)
  137. {
  138.     SendClientMessage(playerid, -1, "This server has a FilterScript Created By JFS - Jonathan Feitosa:).");
  139.     GetPlayerName(playerid, Nome, sizeof(Nome));
  140.     format(String, sizeof(String), CONTAS, Nome);
  141.     if(!DOF2_FileExists(String))
  142.     {
  143.         format(String, sizeof(String), "\n{7FFFD4}Nick: {1E90FF}%s Unregistered\n\n{FFFFFF} Enter A Password For Your Account Register\n", Nome);
  144.         ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "System Register", String, "Register", "Cancel");
  145.     }
  146.     else
  147.     {
  148.         format(String, sizeof(String), "\n{7FFFD4}Nick: {1E90FF}%s Registered\n\n{FFFFFF} Enter your password correctly in space provided\n", Nome);
  149.         ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "System Login", String, "Login", "Cancel");
  150.     }
  151.     return true;
  152. }
  153. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  154. {
  155.       if(dialogid == REGISTRO)
  156.       {
  157.         if(response)
  158.         {
  159.             if(!strlen(inputtext))
  160.             {
  161.                 GetPlayerName(playerid, Nome, sizeof(Nome));
  162.                 format(String, sizeof(String), "\n{7FFFD4}Nick: {1E90FF}%s Unregistered\n\n{FFFFFF} Enter A Password For Your Account Register\n", Nome);
  163.                 ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "Registration System", String, "Register", "Cancel");
  164.                 return true;
  165.             }
  166.             GetPlayerName(playerid, Nome, sizeof(Nome));
  167.             format(String, sizeof(String), CONTAS, Nome);
  168.             DOF2_CreateFile(String);
  169.             DOF2_SetString(String,"Senha",inputtext);
  170.             DOF2_SetString(String,"Email","EmailDesconfigurado");
  171.             DOF2_SetInt(String,"Dinheiro", DinheiroInicio);
  172.             DOF2_SetInt(String,"Level", LevelInicio);
  173.             DOF2_SetInt(String,"Matou",0);
  174.             DOF2_SetInt(String,"Admin",0);
  175.             DOF2_SetInt(String,"Morreu",0);
  176.             DOF2_SetInt(String,"Logou",0);
  177.             DOF2_SaveFile();
  178.             ShowPlayerDialog(playerid, 6783, DIALOG_STYLE_INPUT, "JFS Registration - Set up your Email", "\n\n{1E90FF} Enter Your Email below to complete registration.\n\n{1E90FF} PS: If you lose your password, use to recover there.\n\n", "Configure", "");
  179.             return true;
  180.         }
  181.         else
  182.         {
  183.             SendClientMessage(playerid, 0xFF0000AA, "Why Do not You got kicked Register If I wanted!!");
  184.             Kick(playerid);
  185.             return true;
  186.         }
  187.       }
  188.       if(dialogid == 6783)
  189.       {
  190.         if(response)
  191.         {
  192.             GetPlayerName(playerid, Nome, sizeof(Nome));
  193.             format(String, sizeof(String), CONTAS, Nome);
  194.             DOF2_SetString(String,"Email", inputtext);
  195.             DOF2_SaveFile();
  196.             format(String, sizeof(String), "Configured Email to: %s", DOF2_GetString(String,"Email"));
  197.             SendClientMessage(playerid, -1, String);
  198.             format(String, sizeof(String), "\n{7FFFD4}Nick: {1E90FF}%s Registered\n\n{FFFFFF} Enter your password correctly to login\n", Nome);
  199.             ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "System Login", String, "Login", "Cancel");
  200.             return true;
  201.         }
  202.       }
  203.       if(dialogid == 6784)
  204.       {
  205.         if(response)
  206.         {
  207.             GetPlayerName(playerid, Nome, sizeof(Nome));
  208.             format(String, sizeof(String), CONTAS, Nome);
  209.             new Celula[300];
  210.             format(Celula, sizeof(Celula),
  211.                 "System Registration/Login with via Email Password Recovery - System Created By Jonathan Feitosa \nVisite: www.facebook.com/GoHumorGTA\n\nPassword: %s\n\n\nContato Skype: jonathanfeitosajfs\nContato MSN: [email protected]", DOF2_GetString(String,"Senha"));
  212.             SendMail(DOF2_GetString(String,"Email"), EmailServidor, NomeServidor, "JFS Projects - Recover Password", Celula);
  213.             SendClientMessage(playerid, -1, "An email with your password has been sent to your email address successfully.");
  214.             SendClientMessage(playerid, -1, "PS: The Times They may take about 5 minutes at most.");
  215.             Kick(playerid);
  216.         }
  217.         else
  218.         {
  219.             SendClientMessage(playerid, -1, "You would not Send an Email so got kicked :)");
  220.             Kick(playerid);
  221.         }
  222.         return true;
  223.       }
  224.       if(dialogid == LOGIN)
  225.       {
  226.         if(response)
  227.         {
  228.             if(!strlen(inputtext))
  229.             {
  230.                 GetPlayerName(playerid, Nome, sizeof(Nome));
  231.                 format(String, sizeof(String),
  232.                     "\n{7FFFD4}Nick: {1E90FF}%s Registered\n\n{FFFFFF} Enter your password correctly to login\n", Nome);
  233.                 ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Sistema de Login", String, "Login", "Cancel");
  234.                 SendClientMessage(playerid,0x1E90FFAA,"FIELD BLANK - Enter your password correctly!");
  235.                 return true;
  236.             }
  237.             GetPlayerName(playerid, Nome, sizeof(Nome));
  238.             format(String, sizeof(String), CONTAS, Nome);
  239.             if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false))
  240.             {
  241.                 Logando(playerid);
  242.                 return true;
  243.             }
  244.             else
  245.             {
  246.                 Invalido[playerid] += 1;
  247.                 if(Invalido[playerid] == 5)
  248.                     return ShowPlayerDialog(playerid, 6784, DIALOG_STYLE_MSGBOX, "JFS registration - Password Recovery", "\n\n{33CCFF}Press 'Submit' to send an email to your email address containing your password.\n\n{7491F6}PS: I hope it's a valid email address, if not, please contact Administrator Owner.\n\n", "Submit", "Cancel");
  249.                 SendClientMessage(playerid,0x00FF00AA,"Incorrect password, If you miss 5 times there will have to recover by Email!");
  250.                 format(String, sizeof(String),
  251.                     "\n{7FFFD4}Nick: {1E90FF}%s Registered\n\n{FFFFFF} Enter your password correctly to Login\n", Nome);
  252.                 ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "System Login", String, "Login", "Cancel");
  253.             }
  254.             return true;
  255.         }
  256.         else
  257.         {
  258.             SendClientMessage(playerid, 0xFF0000AA, "You do not want to login, for this reason can be kicked");
  259.             Kick(playerid);
  260.             return true;
  261.         }
  262.       }
  263.       return true;
  264. }
  265. stock SalvarPlayer(playerid)
  266. {
  267.     GetPlayerName(playerid, Nome, sizeof(Nome));
  268.     format(String, sizeof(String), CONTAS, Nome);
  269.     DOF2_SetInt(String,"Dinheiro", GetPlayerMoney(playerid));
  270.     DOF2_SetInt(String,"Level", Level[playerid]);
  271.     DOF2_SetInt(String,"Matou", Matou[playerid]);
  272.     DOF2_SetInt(String,"Morreu", Morreu[playerid]);
  273.     DOF2_SetInt(String,"Logou", Logou[playerid]);
  274.     DOF2_SaveFile();
  275.     return true;
  276. }
  277.  
  278. stock CarregarPlayer(playerid)
  279. {
  280.     GetPlayerName(playerid, Nome, sizeof(Nome));
  281.     format(String, sizeof(String), CONTAS, Nome);
  282.     GivePlayerMoney(playerid, DOF2_GetInt(String,"Dinheiro"));
  283.     Level[playerid] = DOF2_GetInt(String, "Level");
  284.     Matou[playerid] = DOF2_GetInt(String, "Matou");
  285.     Morreu[playerid] = DOF2_GetInt(String, "Morreu");
  286.     Logou[playerid] = DOF2_GetInt(String, "Logou");
  287.     DOF2_GetString(String, "Email");
  288.     DOF2_SaveFile();
  289.     return true;
  290. }
  291.  
  292. stock Logando(playerid)
  293. {
  294.    CarregarPlayer(playerid);
  295.    Logou[playerid]++;
  296.    
  297.    // Here Bote functions when the player is logging. PS: You may be a tutorial system :)
  298.    return true;
  299. }
  300.  
  301. forward AtualizarLevel();
  302. public AtualizarLevel()
  303. {
  304.     for(new i=0; i<MAXPLAYERSJFS; ++i)
  305.     {
  306.         SetPlayerScore(i, Level[i]);
  307.     }
  308.     return true;
  309. }
Add Comment
Please, Sign In to add comment