Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. native WP_Hash(buffer[], len, const str[]);
  2.  
  3. public OnPlayerRegister(playerid, password[])
  4. {
  5. if(IsPlayerConnected(playerid))
  6. {
  7. new playername3[MAX_PLAYER_NAME];
  8. GetPlayerName(playerid, playername3, sizeof(playername3));
  9. new Str[200], criptedpassword[129];
  10. WP_Hash(criptedpassword, sizeof(criptedpassword), password);
  11. format(Str,sizeof(Str),"INSERT INTO `users` (`name`,`password`) VALUES ('%s','%s')",playername3,criptedpassword);
  12. mysql_query(SQL,Str);
  13. strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
  14. PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
  15. GetPlayerHealthEx(playerid,PlayerInfo[playerid][pHealth]);
  16. if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
  17. {
  18. PlayerInfo[playerid][pPos_x] = 2246.6;
  19. PlayerInfo[playerid][pPos_y] = -1161.9;
  20. PlayerInfo[playerid][pPos_z] = 1029.7;
  21. }
  22. if(Spectate[playerid] != 255)
  23. {
  24. PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
  25. PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
  26. PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
  27. PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
  28. PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
  29. }
  30. new wakaname[25];
  31. GetPlayerName(playerid,wakaname,25);
  32. new str[128];
  33. format(str,128,"UPDATE users SET `pHealth`='%.1f' WHERE `name`='%s'",PlayerInfo[playerid][pHealth],wakaname);
  34. mysql_query(SQL,str);
  35. new loginstring[128];
  36. new loginname[64];
  37. GetPlayerName(playerid,loginname,sizeof(loginname));
  38. format(loginstring,sizeof(loginstring),"Account registered,you can login now by typing your password below.",loginname);
  39. ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Quit");
  40. return 1;
  41. }
  42. return 1;
  43. }
  44.  
  45. if(dialogid == DIALOG_LOGIN2 || dialogid == DIALOG_LOGIN3)
  46. {
  47. if(strlen(inputtext))
  48. {
  49. new tmppass[129];
  50. WP_Hash(tmppass, sizeof(tmppass), inputtext);
  51. OnPlayerLoginEx(playerid,tmppass);
  52. }
  53. else
  54. {
  55. new loginstring[128];
  56. new loginname[64];
  57. GetPlayerName(playerid,loginname,sizeof(loginname));
  58. format(loginstring,sizeof(loginstring),"{FFFFFF}Password doesn't match your name!\n \nPlease reenter your password below to login to your account.",loginname);
  59. ShowPlayerDialog(playerid,DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Quit");
  60. gPlayerLogTries[playerid] += 1;
  61. if(gPlayerLogTries[playerid] == 4)
  62. {
  63. Kick(playerid);
  64. }
  65. }
  66. }
  67. if(dialogid == DIALOG_LOGIN1)
  68. {
  69. if(strlen(inputtext) >= 4 && strlen(inputtext) <= 30)
  70. {
  71. OnPlayerRegister(playerid,inputtext);
  72. }
  73. else
  74. {
  75. new regstring[200];
  76. new regname[64];
  77. GetPlayerName(playerid,regname,sizeof(regname));
  78. format(regstring,sizeof(regstring),"{FFFFFF}Welcome, {6EF83C}%s{FFFFFF}!\n \n{FFFFFF}You don't have an account.\n{FFFFFF}Please register your account to proceed by typing a password below.",regname);
  79. ShowPlayerDialog(playerid,DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"Register",regstring,"Register","Quit");
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement