Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- native WP_Hash(buffer[], len, const str[]);
- public OnPlayerRegister(playerid, password[])
- {
- if(IsPlayerConnected(playerid))
- {
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- new Str[200], criptedpassword[129];
- WP_Hash(criptedpassword, sizeof(criptedpassword), password);
- format(Str,sizeof(Str),"INSERT INTO `users` (`name`,`password`) VALUES ('%s','%s')",playername3,criptedpassword);
- mysql_query(SQL,Str);
- strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
- PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
- GetPlayerHealthEx(playerid,PlayerInfo[playerid][pHealth]);
- if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
- {
- PlayerInfo[playerid][pPos_x] = 2246.6;
- PlayerInfo[playerid][pPos_y] = -1161.9;
- PlayerInfo[playerid][pPos_z] = 1029.7;
- }
- if(Spectate[playerid] != 255)
- {
- PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
- PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
- PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
- PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
- PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
- }
- new wakaname[25];
- GetPlayerName(playerid,wakaname,25);
- new str[128];
- format(str,128,"UPDATE users SET `pHealth`='%.1f' WHERE `name`='%s'",PlayerInfo[playerid][pHealth],wakaname);
- mysql_query(SQL,str);
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"Account registered,you can login now by typing your password below.",loginname);
- ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Quit");
- return 1;
- }
- return 1;
- }
- if(dialogid == DIALOG_LOGIN2 || dialogid == DIALOG_LOGIN3)
- {
- if(strlen(inputtext))
- {
- new tmppass[129];
- WP_Hash(tmppass, sizeof(tmppass), inputtext);
- OnPlayerLoginEx(playerid,tmppass);
- }
- else
- {
- new loginstring[128];
- new loginname[64];
- GetPlayerName(playerid,loginname,sizeof(loginname));
- format(loginstring,sizeof(loginstring),"{FFFFFF}Password doesn't match your name!\n \nPlease reenter your password below to login to your account.",loginname);
- ShowPlayerDialog(playerid,DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Quit");
- gPlayerLogTries[playerid] += 1;
- if(gPlayerLogTries[playerid] == 4)
- {
- Kick(playerid);
- }
- }
- }
- if(dialogid == DIALOG_LOGIN1)
- {
- if(strlen(inputtext) >= 4 && strlen(inputtext) <= 30)
- {
- OnPlayerRegister(playerid,inputtext);
- }
- else
- {
- new regstring[200];
- new regname[64];
- GetPlayerName(playerid,regname,sizeof(regname));
- 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);
- ShowPlayerDialog(playerid,DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"Register",regstring,"Register","Quit");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement