Guest User

OnPlayerRegister

a guest
May 9th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. forward OnPlayerRegister(playerid, password[]);
  2.  
  3. public OnPlayerRegister(playerid)
  4. {
  5. if(IsPlayerConnected(playerid))
  6. {
  7. PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
  8. if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
  9. {
  10. PlayerInfo[playerid][pPos_x] = 2246.6;
  11. PlayerInfo[playerid][pPos_y] = -1161.9;
  12. PlayerInfo[playerid][pPos_z] = 1029.7;
  13. }
  14. if(Spectate[playerid] != -1)
  15. {
  16. PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
  17. PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
  18. PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
  19. PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
  20. PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
  21. }
  22. ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"SERVER: Login","Welcome to the RPG.CZM.RO Server.\n\nPlease enter your password below!","Login","Cancel");
  23. return 1;
  24. }
  25. return 1;
  26. }
  27.  
  28.  
  29. if(dialogid == DIALOG_LOGIN1)
  30. {
  31. if(response)
  32. {
  33. if(strlen(inputtext) > 3)
  34. {
  35. new Str[200], password[129];
  36. mysql_real_escape_string(MD5_Hash(inputtext), password);
  37. new password2[129];
  38. for(new i = 0; i < 129; i++)
  39. {
  40. password2[i] = tolower(password[i]);
  41. }
  42. new playername3[MAX_PLAYER_NAME];
  43. new y, m, d, h, mi, s;
  44. getdate(y,m,d);
  45. gettime(h,mi,s);
  46. GetPlayerName(playerid, playername3, sizeof(playername3));
  47. mysql_format(SQL,Str,sizeof(Str),"INSERT INTO `users` (`name`,`password`,`RegisterDate`) VALUES ('%s','%s','%d-%02d-%02d %02d:%02d:%02d')",playername3,password2, y, m, d, h, mi, s);
  48. mysql_tquery(SQL,Str,"","");
  49. OnPlayerRegister(playerid, inputtext);
  50. }
  51. else
  52. {
  53. ShowPlayerDialog(playerid,DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"SERVER: Registration","Your password must exceed 4 characters!\n\nWelcome to the ForEver RPG Server.\n\nPlease enter your desired password below!","Register","Cancel");
  54. }
  55. }
  56. else return ShowPlayerDialog(playerid,DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"SERVER: Registration","Welcome to the ForEver RPG Server.\n\nPlease enter your desired password below!","Register","Cancel");
  57. }
Add Comment
Please, Sign In to add comment